diff --git a/.rvmrc b/.rvmrc index bc14ef2..eb741e4 100644 --- a/.rvmrc +++ b/.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|^$' \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index ab3b768..038bdff 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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) diff --git a/app/models/platform/application.rb b/app/models/platform/application.rb index 4ab60a9..9e75190 100644 --- a/app/models/platform/application.rb +++ b/app/models/platform/application.rb @@ -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" @@ -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) @@ -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 diff --git a/app/models/platform/application_metric.rb b/app/models/platform/application_metric.rb index b707f34..02268c6 100644 --- a/app/models/platform/application_metric.rb +++ b/app/models/platform/application_metric.rb @@ -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 diff --git a/app/views/platform/developer/api_explorer/index.html.erb b/app/views/platform/developer/api_explorer/index.html.erb index ab40450..2b8e036 100644 --- a/app/views/platform/developer/api_explorer/index.html.erb +++ b/app/views/platform/developer/api_explorer/index.html.erb @@ -36,17 +36,17 @@
-
- <%=select_tag("api_version", options_for_select(Platform::Config.api_supported_version_options, @api_version), :onChange=>"switchApiVersion()")%> + + <%=select_tag("api_version", options_for_select(Platform::Config.api_supported_version_options, @api_version), :style=>"width:55px;", :onChange=>"switchApiVersion()")%> - <%=select_tag("request_method", options_for_select(['GET', 'POST', 'PUT', 'DELETE'], params[:method] || 'GET'), :style=>"", :onChange=>"switchRequestMethod()")%> + <%=select_tag("request_method", options_for_select(['GET', 'POST', 'PUT', 'DELETE'], params[:method] || 'GET'), :style=>"width:78px;", :onChange=>"switchRequestMethod()")%> - +
http://<%=Platform::Config.api_base_url%>/<%=text_field_tag(:api_path, params[:path], :style=>"width:500px;border:0px;padding:0px;margin:0px;font-size:12px;vertical-align:middle;", :onKeyUp=>"if (event.keyCode == 13) {api_history_index=-1; submitRequest();}")%><%=text_field_tag(:api_path, params[:path], :style=>"width:530px;border:0px;padding:0px;margin:0px;font-size:14px;vertical-align:middle;", :onKeyUp=>"if (event.keyCode == 13) {api_history_index=-1; submitRequest();}")%> <%=link_to_function(image_tag("platform/arrow_down.gif"), "toggleApiOptions(this)")%>
diff --git a/app/views/platform/developer/apps/index.html.erb b/app/views/platform/developer/apps/index.html.erb index 931505b..3e6732b 100644 --- a/app/views/platform/developer/apps/index.html.erb +++ b/app/views/platform/developer/apps/index.html.erb @@ -289,7 +289,7 @@ <%=link_to(tr("edit"), :action => :edit, :id => @app.id)%> <%= platform_toggler_tag("authentication") %> - <%=tr('Authentication', 'Client application section')%> + <%=tr('Authorization', 'Client application section')%>
@@ -300,7 +300,10 @@
<%=tr('Callback URL:', 'Client application field label')%>
<%=@app.callback_url%>
- +
+
<%=tr('Authorization URL:', 'Client application field label')%>
+
<%=@app.oauth_url%>
+
<%=tr('Deauthorize Callback URL:', 'Client application field label')%>
<%=@app.deauthorize_callback_url%>
diff --git a/lib/platform/config.rb b/lib/platform/config.rb index 50fd28f..f56e4d4 100644 --- a/lib/platform/config.rb +++ b/lib/platform/config.rb @@ -280,6 +280,10 @@ def self.oauth_web_layout site_info[:oauth_web_layout] end + def self.oauth_fluid_layout + site_info[:oauth_fluid_layout] + end + def self.oauth_popup_layout site_info[:oauth_popup_layout] end diff --git a/lib/platform/version.rb b/lib/platform/version.rb index b96df2d..fb0be98 100644 --- a/lib/platform/version.rb +++ b/lib/platform/version.rb @@ -22,5 +22,5 @@ #++ module Platform - VERSION = "3.1.3" + VERSION = "3.1.4" end diff --git a/platform.gemspec b/platform.gemspec index 8a274bf..86d8900 100644 --- a/platform.gemspec +++ b/platform.gemspec @@ -22,14 +22,13 @@ Gem::Specification.new do |s| s.licenses = ['MIT'] - s.add_dependency 'rails', ['>= 3.1.0'] - s.add_dependency 'will_filter', ['>= 3.1.2'] - s.add_dependency 'tr8n', ['>= 3.1.1'] + s.add_dependency 'rails', ['>= 3.2.3'] + s.add_dependency 'will_filter', ['>= 3.1.6'] + s.add_dependency 'tr8n', ['>= 3.2.3'] s.add_dependency 'kaminari', ['>= 0'] s.add_dependency 'sass', ['>= 0'] - s.add_dependency 'coffee-script', ['>= 0'] - s.add_dependency 'acts_as_tree', ['>= 0'] - s.add_dependency 'acts_as_state_machine', ['>= 0'] + s.add_dependency 'acts_as_tree_rails3', ['>= 0'] + s.add_dependency 'aasm', ['>= 0'] s.add_development_dependency 'pry', ['>= 0'] s.add_development_dependency 'bundler', ['>= 1.0.0'] s.add_development_dependency 'sqlite3', ['>= 0'] diff --git a/test/dummy/.sass-cache/a08d27d603cebe0b6d72ea1ea3ff687bbe7f4320/api_explorer.css.scssc b/test/dummy/.sass-cache/a08d27d603cebe0b6d72ea1ea3ff687bbe7f4320/api_explorer.css.scssc deleted file mode 100644 index a930032..0000000 Binary files a/test/dummy/.sass-cache/a08d27d603cebe0b6d72ea1ea3ff687bbe7f4320/api_explorer.css.scssc and /dev/null differ diff --git a/test/dummy/.sass-cache/a08d27d603cebe0b6d72ea1ea3ff687bbe7f4320/platform.css.scssc b/test/dummy/.sass-cache/a08d27d603cebe0b6d72ea1ea3ff687bbe7f4320/platform.css.scssc deleted file mode 100644 index 9a54812..0000000 Binary files a/test/dummy/.sass-cache/a08d27d603cebe0b6d72ea1ea3ff687bbe7f4320/platform.css.scssc and /dev/null differ diff --git a/test/dummy/config/application.rb b/test/dummy/config/application.rb index dfca28d..0859190 100644 --- a/test/dummy/config/application.rb +++ b/test/dummy/config/application.rb @@ -7,8 +7,8 @@ require "tr8n" require "kaminari" require "platform" -require "acts_as_tree" -require "acts_as_state_machine" +require "acts_as_tree_rails3" +require "aasm" module Dummy class Application < Rails::Application