Skip to content

Commit

Permalink
upgraded to rails 2.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Berkovich committed Apr 14, 2012
1 parent 2b88511 commit d4a8c03
Show file tree
Hide file tree
Showing 12 changed files with 162 additions and 154 deletions.
2 changes: 1 addition & 1 deletion .rvmrc
@@ -1,2 +1,2 @@
rvm 1.9.2@platform --create
rvm use 1.9.2@platform --create
#rvm gemset import | grep -v -E 'already installed|default\.gems|^$'
201 changes: 99 additions & 102 deletions Gemfile.lock
Expand Up @@ -2,158 +2,155 @@ PATH
remote: .
specs:
platform (3.1.3)
acts_as_state_machine
acts_as_tree
coffee-script
aasm
acts_as_tree_rails3
kaminari
rails (>= 3.1.0)
rails (>= 3.2.3)
sass
tr8n (>= 3.1.1)
will_filter (>= 3.1.2)
tr8n (>= 3.2.3)
will_filter (>= 3.1.6)

GEM
remote: http://rubygems.org/
specs:
actionmailer (3.1.0)
actionpack (= 3.1.0)
mail (~> 2.3.0)
actionpack (3.1.0)
activemodel (= 3.1.0)
activesupport (= 3.1.0)
aasm (3.0.4)
activerecord
actionmailer (3.2.3)
actionpack (= 3.2.3)
mail (~> 2.4.4)
actionpack (3.2.3)
activemodel (= 3.2.3)
activesupport (= 3.2.3)
builder (~> 3.0.0)
erubis (~> 2.7.0)
i18n (~> 0.6)
rack (~> 1.3.2)
rack-cache (~> 1.0.3)
rack-mount (~> 0.8.2)
journey (~> 1.0.1)
rack (~> 1.4.0)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.0.0)
activemodel (3.1.0)
activesupport (= 3.1.0)
bcrypt-ruby (~> 3.0.0)
sprockets (~> 2.1.2)
activemodel (3.2.3)
activesupport (= 3.2.3)
builder (~> 3.0.0)
i18n (~> 0.6)
activerecord (3.1.0)
activemodel (= 3.1.0)
activesupport (= 3.1.0)
arel (~> 2.2.1)
activerecord (3.2.3)
activemodel (= 3.2.3)
activesupport (= 3.2.3)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.1.0)
activemodel (= 3.1.0)
activesupport (= 3.1.0)
activesupport (3.1.0)
activeresource (3.2.3)
activemodel (= 3.2.3)
activesupport (= 3.2.3)
activesupport (3.2.3)
i18n (~> 0.6)
multi_json (~> 1.0)
acts_as_state_machine (2.2.0)
activerecord (>= 2.1)
acts_as_tree (0.1.1)
arel (2.2.1)
bcrypt-ruby (3.0.1)
acts_as_tree_rails3 (0.1.0)
addressable (2.2.7)
arel (3.0.2)
builder (3.0.0)
capybara (1.1.1)
capybara (1.1.2)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 0.1.4)
childprocess (0.2.2)
childprocess (0.3.1)
ffi (~> 1.0.6)
coderay (0.9.8)
coderay (1.0.6)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.1.2)
database_cleaner (0.6.7)
coffee-script-source (1.3.1)
database_cleaner (0.7.2)
diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.2.9)
execjs (1.3.0)
multi_json (~> 1.0)
factory_girl (2.1.2)
activesupport
ffi (1.0.9)
factory_girl (3.1.0)
activesupport (>= 3.0.0)
ffi (1.0.11)
hike (1.2.1)
i18n (0.6.0)
json_pure (1.6.1)
kaminari (0.12.4)
rails (>= 3.0.0)
mail (2.3.0)
journey (1.0.3)
json (1.6.6)
kaminari (0.13.0)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
railties (>= 3.0.0)
libwebsocket (0.1.3)
addressable
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
memcache-client (1.8.5)
method_source (0.6.6)
ruby_parser (~> 2.0.5)
mime-types (1.16)
multi_json (1.0.3)
nokogiri (1.5.0)
polyglot (0.3.2)
pry (0.9.6.2)
coderay (~> 0.9.8)
method_source (~> 0.6.5)
ruby_parser (~> 2.0.5)
slop (~> 2.1.0)
rack (1.3.4)
rack-cache (1.0.3)
method_source (0.7.1)
mime-types (1.18)
multi_json (1.2.0)
nokogiri (1.5.2)
polyglot (0.3.3)
pry (0.9.8.4)
coderay (~> 1.0.5)
method_source (~> 0.7.1)
slop (>= 2.4.4, < 3)
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
rack-mount (0.8.3)
rack (>= 1.0.0)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.1.0)
actionmailer (= 3.1.0)
actionpack (= 3.1.0)
activerecord (= 3.1.0)
activeresource (= 3.1.0)
activesupport (= 3.1.0)
rails (3.2.3)
actionmailer (= 3.2.3)
actionpack (= 3.2.3)
activerecord (= 3.2.3)
activeresource (= 3.2.3)
activesupport (= 3.2.3)
bundler (~> 1.0)
railties (= 3.1.0)
railties (3.1.0)
actionpack (= 3.1.0)
activesupport (= 3.1.0)
railties (= 3.2.3)
railties (3.2.3)
actionpack (= 3.2.3)
activesupport (= 3.2.3)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2)
rdoc (3.9.4)
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
rr (1.0.4)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
rspec-mocks (~> 2.6.0)
rspec-core (2.6.4)
rspec-expectations (2.6.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.6.0)
rspec-rails (2.6.1)
actionpack (~> 3.0)
activesupport (~> 3.0)
railties (~> 3.0)
rspec (~> 2.6.0)
ruby_parser (2.0.6)
sexp_processor (~> 3.0)
rubyzip (0.9.4)
sass (3.1.10)
selenium-webdriver (2.7.0)
childprocess (>= 0.2.1)
ffi (>= 1.0.7)
json_pure
rspec (2.9.0)
rspec-core (~> 2.9.0)
rspec-expectations (~> 2.9.0)
rspec-mocks (~> 2.9.0)
rspec-core (2.9.0)
rspec-expectations (2.9.1)
diff-lcs (~> 1.1.3)
rspec-mocks (2.9.0)
rspec-rails (2.9.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec (~> 2.9.0)
rubyzip (0.9.7)
sass (3.1.15)
selenium-webdriver (2.21.0)
childprocess (>= 0.2.5)
ffi (~> 1.0)
libwebsocket (~> 0.1.3)
multi_json (~> 1.0)
rubyzip
sexp_processor (3.0.7)
slop (2.1.0)
sprockets (2.0.2)
slop (2.4.4)
sprockets (2.1.2)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.4)
sqlite3 (1.3.5)
steak (2.0.0)
capybara (>= 1.0.0)
rspec-rails (>= 2.5.0)
thor (0.14.6)
tilt (1.3.3)
tr8n (3.1.4)
tr8n (3.2.3)
coffee-script
kaminari
rails (>= 3.1.0)
Expand All @@ -162,8 +159,8 @@ GEM
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.30)
will_filter (3.1.3)
tzinfo (0.3.33)
will_filter (3.1.6)
coffee-script
kaminari
rails (>= 3.1.0)
Expand Down
75 changes: 40 additions & 35 deletions app/models/platform/application.rb
Expand Up @@ -26,6 +26,9 @@ class Platform::Application < ActiveRecord::Base

# useful methods - should be public
include Platform::SimpleStringPermissions
# include ActiveRecord::Acts:Tree
include AASM

acts_as_tree :order => "version"

belongs_to :developer, :class_name => "Platform::Developer"
Expand All @@ -51,50 +54,47 @@ class Platform::Application < ActiveRecord::Base
URL_REGEX = /\Ahttp(s?):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/i
validates_format_of :url, :with => URL_REGEX, :allow_blank=>true
validates_format_of :support_url, :with => URL_REGEX, :allow_blank=>true
validates_format_of :callback_url, :with => URL_REGEX, :allow_blank=>true
validates_format_of :support_url, :with => URL_REGEX, :allow_blank=>true
validates_format_of :privacy_policy_url, :with => URL_REGEX, :allow_blank=>true
validates_format_of :terms_of_service_url, :with => URL_REGEX, :allow_blank=>true
validates_format_of :canvas_url, :with => URL_REGEX, :allow_blank=>true

attr_accessor :token_callback_url

acts_as_state_machine :initial => :new

state :new
state :submitted
state :approved
state :rejected
state :blocked
state :deprecated

event :submit do
transitions :from => :new, :to => :submitted
transitions :from => :rejected, :to => :submitted
end
aasm :column => :state do
state :new, :initial => true
state :submitted
state :approved
state :rejected
state :blocked
state :deprecated

event :submit do
transitions :from => :new, :to => :submitted
transitions :from => :rejected, :to => :submitted
end

event :deprecate do
transitions :from => :approved, :to => :deprecated
end

event :block do
transitions :from => :new, :to => :blocked
transitions :from => :submitted, :to => :blocked
transitions :from => :approved, :to => :blocked
transitions :from => :rejected, :to => :blocked
end
event :deprecate do
transitions :from => :approved, :to => :deprecated
end
event :block do
transitions :from => :new, :to => :blocked
transitions :from => :submitted, :to => :blocked
transitions :from => :approved, :to => :blocked
transitions :from => :rejected, :to => :blocked
end

event :unblock do
transitions :from => :blocked, :to => :new
end
event :unblock do
transitions :from => :blocked, :to => :new
end

event :approve do
transitions :from => :new, :to => :approved
transitions :from => :submitted, :to => :approved
end
event :approve do
transitions :from => :new, :to => :approved
transitions :from => :submitted, :to => :approved
end

event :reject do
transitions :from => :submitted, :to => :rejected
event :reject do
transitions :from => :submitted, :to => :rejected
end
end

def self.for(client_id)
Expand Down Expand Up @@ -375,6 +375,11 @@ def versioned_name
end
end

def oauth_url
protocol = Platform::Config.env == "development" ? 'http' : 'https'
"#{protocol}://#{Platform::Config.site_base_url}/platform/oauth/authorize?client_id=#{key}&response_type=token&display=web&redirect_url=#{CGI.escape(callback_url || '')}"
end

protected

def generate_keys
Expand Down
2 changes: 1 addition & 1 deletion app/models/platform/application_metric.rb
Expand Up @@ -27,7 +27,7 @@ class Platform::ApplicationMetric < ActiveRecord::Base
belongs_to :application, :class_name => "Platform::Application"

def self.find_or_create(app, interval)
metric = self.find(:first, :conditions => ["application_id = ? and interval = ?", app.id, interval])
metric = self.find(:first, :conditions => ["application_id = ? and 'interval' = ?", app.id, interval])
metric || self.create(:application => app, :interval => interval, :type => self.name)
end

Expand Down

0 comments on commit d4a8c03

Please sign in to comment.