rest-core 0.2.3 → 0.3.0.pre.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. data/.travis.yml +8 -4
  2. data/CHANGES.md +20 -0
  3. data/Gemfile +4 -3
  4. data/README.md +8 -8
  5. data/Rakefile +42 -2
  6. data/example/rails2/Gemfile +13 -0
  7. data/example/rails2/README +4 -0
  8. data/example/rails2/Rakefile +11 -0
  9. data/example/rails2/app/controllers/application_controller.rb +119 -0
  10. data/example/rails2/app/views/application/helper.html.erb +1 -0
  11. data/example/rails2/config/boot.rb +130 -0
  12. data/example/rails2/config/environment.rb +15 -0
  13. data/example/rails2/config/environments/development.rb +17 -0
  14. data/example/rails2/config/environments/production.rb +28 -0
  15. data/example/rails2/config/environments/test.rb +30 -0
  16. data/example/rails2/config/initializers/cookie_verification_secret.rb +7 -0
  17. data/example/rails2/config/initializers/new_rails_defaults.rb +21 -0
  18. data/example/rails2/config/initializers/session_store.rb +15 -0
  19. data/example/rails2/config/preinitializer.rb +23 -0
  20. data/example/rails2/config/rest-core.yaml +12 -0
  21. data/example/rails2/config/routes.rb +43 -0
  22. data/example/rails2/log +0 -0
  23. data/example/rails2/test/functional/application_controller_test.rb +183 -0
  24. data/example/rails2/test/test_helper.rb +18 -0
  25. data/example/rails2/test/unit/rails_util_test.rb +44 -0
  26. data/example/rails3/Gemfile +13 -0
  27. data/example/rails3/README +4 -0
  28. data/example/rails3/Rakefile +7 -0
  29. data/example/rails3/app/controllers/application_controller.rb +119 -0
  30. data/example/rails3/app/views/application/helper.html.erb +1 -0
  31. data/example/rails3/config/application.rb +23 -0
  32. data/example/rails3/config/environment.rb +5 -0
  33. data/example/rails3/config/environments/development.rb +26 -0
  34. data/example/rails3/config/environments/production.rb +49 -0
  35. data/example/rails3/config/environments/test.rb +30 -0
  36. data/example/rails3/config/initializers/secret_token.rb +7 -0
  37. data/example/rails3/config/initializers/session_store.rb +8 -0
  38. data/example/rails3/config/rest-core.yaml +12 -0
  39. data/example/rails3/config/routes.rb +5 -0
  40. data/example/rails3/config.ru +4 -0
  41. data/example/rails3/test/functional/application_controller_test.rb +183 -0
  42. data/example/rails3/test/test_helper.rb +18 -0
  43. data/example/rails3/test/unit/rails_util_test.rb +44 -0
  44. data/example/sinatra/config.ru +16 -0
  45. data/lib/rest-core/app/ask.rb +0 -2
  46. data/lib/rest-core/client/facebook/rails_util.rb +342 -0
  47. data/lib/rest-core/client/{rest-graph.rb → facebook.rb} +21 -28
  48. data/lib/rest-core/client/github.rb +1 -1
  49. data/lib/rest-core/client/linkedin.rb +3 -1
  50. data/lib/rest-core/client/twitter.rb +2 -2
  51. data/lib/rest-core/client.rb +2 -2
  52. data/lib/rest-core/client_oauth1.rb +3 -3
  53. data/lib/rest-core/middleware/oauth2_query.rb +3 -3
  54. data/{test/common.rb → lib/rest-core/test.rb} +7 -3
  55. data/lib/rest-core/util/config.rb +22 -17
  56. data/lib/rest-core/util/vendor.rb +31 -0
  57. data/lib/rest-core/version.rb +1 -1
  58. data/lib/rest-core.rb +5 -0
  59. data/rest-core.gemspec +135 -108
  60. data/test/client/facebook/config/rest-core.yaml +8 -0
  61. data/test/{test_api.rb → client/facebook/test_api.rb} +22 -23
  62. data/test/{test_cache.rb → client/facebook/test_cache.rb} +4 -8
  63. data/test/{test_default.rb → client/facebook/test_default.rb} +6 -10
  64. data/test/client/facebook/test_error.rb +65 -0
  65. data/test/{test_handler.rb → client/facebook/test_handler.rb} +12 -15
  66. data/test/{test_load_config.rb → client/facebook/test_load_config.rb} +6 -9
  67. data/test/{test_misc.rb → client/facebook/test_misc.rb} +15 -18
  68. data/test/{test_oauth.rb → client/facebook/test_oauth.rb} +4 -8
  69. data/test/{test_old.rb → client/facebook/test_old.rb} +16 -18
  70. data/test/{test_page.rb → client/facebook/test_page.rb} +5 -9
  71. data/test/{test_parse.rb → client/facebook/test_parse.rb} +13 -16
  72. data/test/client/facebook/test_serialize.rb +42 -0
  73. data/test/client/facebook/test_timeout.rb +22 -0
  74. data/test/test_oauth1_header.rb +1 -5
  75. metadata +99 -58
  76. data/test/config/rest-core.yaml +0 -7
  77. data/test/test_error.rb +0 -66
  78. data/test/test_serialize.rb +0 -44
  79. data/test/test_timeout.rb +0 -25
data/.travis.yml CHANGED
@@ -1,9 +1,13 @@
1
- script: 'git submodule update --init; bundle exec rake test'
1
+ script: 'git submodule update --init; bundle exec rake test:travis'
2
+
3
+ env:
4
+ - 'RESTCORE=rest-graph'
5
+ - 'RESTCORE=rails2'
6
+ - 'RESTCORE=rails3'
7
+
2
8
  rvm:
3
9
  - 1.8.7
4
10
  - 1.9.2
5
- - ruby-head
6
- - rbx
11
+ - 1.9.3
7
12
  - rbx-2.0
8
13
  - jruby
9
- - ree
data/CHANGES.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # rest-core CHANGES
2
2
 
3
+ ## rest-core 0.3.0 -- ?
4
+
5
+ * [facebook] RestGraph is Facebook now.
6
+ * [facebook] Facebook::RailsUtil is imported from [rest-graph][]
7
+ * [facebook] Use json_decode instead of auto_decode as rest-graph
8
+ * [twitter] Fixed opts in Twitter#tweet
9
+ * [rest-core] We no longer explicitly depends on Rack
10
+ * [rest-core] Added a shorthand RC to access RestCore
11
+ * [cache] All clients no longer have default hash cache
12
+ * [oauth2_query] Now we always use the term "access_token"
13
+ * [config] Now Config#load and Config#load_for_rails take namespace
14
+ e.g. rest-core.yaml:
15
+ development:
16
+ facebook:
17
+ app_id: 123
18
+ twitter:
19
+ consumer_key: abc
20
+
21
+ [rest-graph]: https://github.com/cardinalblue/rest-graph
22
+
3
23
  ## rest-core 0.2.3 -- 2011-08-27
4
24
 
5
25
  * Adding rack as a runtime dependency for now.
data/Gemfile CHANGED
@@ -3,6 +3,7 @@ source 'http://rubygems.org'
3
3
 
4
4
  gemspec
5
5
 
6
- if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
7
- gem 'jruby-openssl'
8
- end
6
+ gem 'rails', '2.3.14' if ENV['RESTCORE'] == 'rails2'
7
+ gem 'rails', '3.0.9' if ENV['RESTCORE'] == 'rails3'
8
+
9
+ gem 'jruby-openssl', :platforms => [:jruby]
data/README.md CHANGED
@@ -28,9 +28,8 @@ for any other REST APIs.
28
28
 
29
29
  ## REQUIREMENTS:
30
30
 
31
- * Tested with MRI (official ruby) 1.9.2, 1.8.7, and trunk
32
- * Tested with Rubinius (rbx) 1.2
33
- * Tested with JRuby 1.6
31
+ * Tested with MRI (official CRuby) 1.8.7, 1.9.2, 1.9.3, Rubinius and JRuby
32
+ * gem rest-client (for now)
34
33
 
35
34
  ## INSTALLATION:
36
35
 
@@ -67,11 +66,12 @@ See [example][] for more complex examples.
67
66
  require 'rest-core'
68
67
 
69
68
  YourClient = RestCore::Builder.client do
70
- use DefaultSite , 'https://api.github.com/users/'
71
- use JsonDecode , true
72
- use CommonLogger, method(:puts)
73
- use Cache , {}, 3600
74
- run RestClient
69
+ s = self.class # this is only for ruby 1.8!
70
+ use s::DefaultSite , 'https://api.github.com/users/'
71
+ use s::JsonDecode , true
72
+ use s::CommonLogger, method(:puts)
73
+ use s::Cache , {}, 3600
74
+ run s::RestClient
75
75
  end
76
76
 
77
77
  client = YourClient.new
data/Rakefile CHANGED
@@ -14,8 +14,8 @@ task 'gem:spec' do
14
14
  s.homepage = 'https://github.com/cardinalblue/rest-core'
15
15
  # s.executables = [s.name]
16
16
 
17
- %w[rest-client rack].each{ |g| s.add_runtime_dependency(g) }
18
- %w[yajl-ruby json json_pure ruby-hmac
17
+ %w[rest-client].each{ |g| s.add_runtime_dependency(g) }
18
+ %w[yajl-ruby rack json json_pure ruby-hmac
19
19
  webmock bacon rr rake].each{ |g| s.add_development_dependency(g) }
20
20
 
21
21
  s.authors = ['Cardinal Blue', 'Lin Jen-Shin (godfat)']
@@ -24,3 +24,43 @@ task 'gem:spec' do
24
24
 
25
25
  Gemgem.write
26
26
  end
27
+
28
+ module Gemgem
29
+ module_function
30
+ def test_rails *rails
31
+ rails.each{ |framework|
32
+ opts = Rake.application.options
33
+ args = (opts.singleton_methods - [:rakelib, 'rakelib']).map{ |arg|
34
+ if arg.to_s !~ /=$/ && opts.send(arg)
35
+ "--#{arg}"
36
+ else
37
+ ''
38
+ end
39
+ }.join(' ')
40
+ Rake.sh "cd example/#{framework}; #{Gem.ruby} -S rake test #{args}"
41
+ }
42
+ end
43
+ end
44
+
45
+ desc 'Run example tests'
46
+ task 'test:example' do
47
+ Gemgem.test_rails('rails3', 'rails2')
48
+ end
49
+
50
+ desc 'Run all tests'
51
+ task 'test:all' => ['test', 'test:example']
52
+
53
+ desc 'Run different json test'
54
+ task 'test:json' do
55
+ %w[yajl json].each{ |json|
56
+ Rake.sh "#{Gem.ruby} -S rake -r #{json} test"
57
+ }
58
+ end
59
+
60
+ task 'test:travis' do
61
+ case ENV['RESTCORE']
62
+ when 'rails3'; Gemgem.test_rails('rails3')
63
+ when 'rails2'; Gemgem.test_rails('rails2')
64
+ else ; Rake::Task['test'].invoke
65
+ end
66
+ end
@@ -0,0 +1,13 @@
1
+
2
+ source 'http://rubygems.org'
3
+
4
+ gem 'rails', '2.3.14'
5
+
6
+ gem 'rest-client' # for rest-core
7
+ gem 'yajl-ruby' # for rest-core
8
+ gem 'rest-core', :path => '../../'
9
+
10
+ group 'test' do
11
+ gem 'rr'
12
+ gem 'webmock'
13
+ end
@@ -0,0 +1,4 @@
1
+
2
+ Please fill config/rest-core.yaml with your app_id, secret, etc., to
3
+ see if this example is working or not. The default setup is designed for
4
+ standalone site with Facebook JavaScript SDK.
@@ -0,0 +1,11 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require(File.join(File.dirname(__FILE__), 'config', 'boot'))
5
+
6
+ require 'rake/dsl_definition'
7
+ require 'rake'
8
+ require 'rake/testtask'
9
+ require 'rake/rdoctask'
10
+
11
+ require 'tasks/rails'
@@ -0,0 +1,119 @@
1
+
2
+ class ApplicationController < ActionController::Base
3
+ protect_from_forgery
4
+
5
+ include RestCore::Facebook::RailsUtil
6
+
7
+ before_filter :filter_common , :only => [:index]
8
+ before_filter :filter_canvas , :only => [:canvas]
9
+ before_filter :filter_options , :only => [:options]
10
+ before_filter :filter_no_auto , :only => [:no_auto]
11
+ before_filter :filter_diff_app_id , :only => [:diff_app_id]
12
+ before_filter :filter_diff_canvas , :only => [:diff_canvas]
13
+ before_filter :filter_iframe_canvas, :only => [:iframe_canvas]
14
+ before_filter :filter_cache , :only => [:cache]
15
+ before_filter :filter_hanlder , :only => [:handler_]
16
+ before_filter :filter_session , :only => [:session_]
17
+ before_filter :filter_cookies , :only => [:cookies_]
18
+
19
+ def index
20
+ render :text => rc_facebook.get('me').to_json
21
+ end
22
+ alias_method :canvas , :index
23
+ alias_method :options , :index
24
+ alias_method :diff_canvas , :index
25
+ alias_method :iframe_canvas, :index
26
+ alias_method :handler_ , :index
27
+ alias_method :session_ , :index
28
+ alias_method :cookies_ , :index
29
+
30
+ def no_auto
31
+ rc_facebook.get('me')
32
+ rescue RestCore::Facebook::Error
33
+ render :text => 'XD'
34
+ end
35
+
36
+ def diff_app_id
37
+ render :text => rc_facebook.app_id
38
+ end
39
+
40
+ def cache
41
+ url = rc_facebook.url('cache')
42
+ rc_facebook.get('cache')
43
+ rc_facebook.get('cache')
44
+ render :text => Rails.cache.read(Digest::MD5.hexdigest(url))
45
+ end
46
+
47
+ def error
48
+ raise RestCore::Facebook::Error.new("don't rescue me")
49
+ end
50
+
51
+ def reinitialize
52
+ cache_nil = rc_facebook.cache
53
+ rc_facebook_setup(:cache => {'a' => 'b'})
54
+ cache = rc_facebook.cache
55
+ render :text => YAML.dump([cache_nil, cache])
56
+ end
57
+
58
+ def helper; end
59
+
60
+ private
61
+ def filter_common
62
+ rc_facebook_setup(:auto_authorize => true, :canvas => '')
63
+ end
64
+
65
+ def filter_canvas
66
+ rc_facebook_setup(:canvas => RestCore::Facebook.
67
+ default_canvas,
68
+ :auto_authorize_scope => 'publish_stream')
69
+ end
70
+
71
+ def filter_diff_canvas
72
+ rc_facebook_setup(:canvas => 'ToT',
73
+ :auto_authorize_scope => 'email')
74
+ end
75
+
76
+ def filter_iframe_canvas
77
+ rc_facebook_setup(:canvas => 'zzz',
78
+ :auto_authorize => true)
79
+ end
80
+
81
+ def filter_no_auto
82
+ rc_facebook_setup(:auto_authorize => false)
83
+ end
84
+
85
+ def filter_diff_app_id
86
+ rc_facebook_setup(:app_id => 'zzz',
87
+ :auto_authorize => true)
88
+ end
89
+
90
+ def filter_options
91
+ rc_facebook_setup(:auto_authorize_options => {:scope => 'bogus'},
92
+ :canvas => nil)
93
+ end
94
+
95
+ def filter_cache
96
+ rc_facebook_setup(:cache => Rails.cache)
97
+ end
98
+
99
+ def filter_hanlder
100
+ rc_facebook_setup(:write_handler => method(:write_handler),
101
+ :check_handler => method(:check_handler))
102
+ end
103
+
104
+ def write_handler fbs
105
+ Rails.cache[:fbs] = fbs
106
+ end
107
+
108
+ def check_handler
109
+ Rails.cache[:fbs]
110
+ end
111
+
112
+ def filter_session
113
+ rc_facebook_setup(:write_session => true)
114
+ end
115
+
116
+ def filter_cookies
117
+ rc_facebook_setup(:write_cookies => true)
118
+ end
119
+ end
@@ -0,0 +1 @@
1
+ <%= rc_facebook.app_id %>
@@ -0,0 +1,130 @@
1
+ # Don't change this file!
2
+ # Configure your app in config/environment.rb and config/environments/*.rb
3
+
4
+ RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
5
+
6
+ module Rails
7
+ class << self
8
+ def boot!
9
+ unless booted?
10
+ preinitialize
11
+ pick_boot.run
12
+ end
13
+ end
14
+
15
+ def booted?
16
+ defined? Rails::Initializer
17
+ end
18
+
19
+ def pick_boot
20
+ (vendor_rails? ? VendorBoot : GemBoot).new
21
+ end
22
+
23
+ def vendor_rails?
24
+ File.exist?("#{RAILS_ROOT}/vendor/rails")
25
+ end
26
+
27
+ def preinitialize
28
+ load(preinitializer_path) if File.exist?(preinitializer_path)
29
+ end
30
+
31
+ def preinitializer_path
32
+ "#{RAILS_ROOT}/config/preinitializer.rb"
33
+ end
34
+ end
35
+
36
+ class Boot
37
+ def run
38
+ load_initializer
39
+ Rails::Initializer.run(:set_load_path)
40
+ end
41
+ end
42
+
43
+ class VendorBoot < Boot
44
+ def load_initializer
45
+ require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
46
+ Rails::Initializer.run(:install_gem_spec_stubs)
47
+ Rails::GemDependency.add_frozen_gem_path
48
+ end
49
+ end
50
+
51
+ class GemBoot < Boot
52
+ def load_initializer
53
+ self.class.load_rubygems
54
+ load_rails_gem
55
+ require 'initializer'
56
+ end
57
+
58
+ def load_rails_gem
59
+ if version = self.class.gem_version
60
+ gem 'rails', version
61
+ else
62
+ gem 'rails'
63
+ end
64
+ rescue Gem::LoadError => load_error
65
+ if load_error.message =~ /Could not find RubyGem rails/
66
+ STDERR.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
67
+ exit 1
68
+ else
69
+ raise
70
+ end
71
+ end
72
+
73
+ class << self
74
+ def rubygems_version
75
+ Gem::RubyGemsVersion rescue nil
76
+ end
77
+
78
+ def gem_version
79
+ if defined? RAILS_GEM_VERSION
80
+ RAILS_GEM_VERSION
81
+ elsif ENV.include?('RAILS_GEM_VERSION')
82
+ ENV['RAILS_GEM_VERSION']
83
+ else
84
+ parse_gem_version(read_environment_rb)
85
+ end
86
+ end
87
+
88
+ def load_rubygems
89
+ min_version = '1.3.2'
90
+ require 'rubygems'
91
+ unless rubygems_version >= min_version
92
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
93
+ exit 1
94
+ end
95
+
96
+ rescue LoadError
97
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
98
+ exit 1
99
+ end
100
+
101
+ def parse_gem_version(text)
102
+ $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
103
+ end
104
+
105
+ private
106
+ def read_environment_rb
107
+ File.read("#{RAILS_ROOT}/config/environment.rb")
108
+ end
109
+ end
110
+ end
111
+ end
112
+
113
+ # begin copied from http://gembundler.com/rails23.html
114
+ class Rails::Boot
115
+ def run
116
+ load_initializer
117
+
118
+ Rails::Initializer.class_eval do
119
+ def load_gems
120
+ @bundler_loaded ||= Bundler.require(:default, Rails.env.to_sym)
121
+ end
122
+ end
123
+
124
+ Rails::Initializer.run(:set_load_path)
125
+ end
126
+ end
127
+ # end copied from http://gembundler.com/rails23.html
128
+
129
+ # All that for this:
130
+ Rails.boot!
@@ -0,0 +1,15 @@
1
+ # Be sure to restart your server when you modify this file
2
+
3
+ # Specifies gem version of Rails to use when vendor/rails is not present
4
+ RAILS_GEM_VERSION = '2.3.14' unless defined? RAILS_GEM_VERSION
5
+
6
+ # Bootstrap the Rails environment, frameworks, and default configuration
7
+ require File.join(File.dirname(__FILE__), 'boot')
8
+
9
+ Rails::Initializer.run do |config|
10
+ # we use bundler now, so don't do this at this example
11
+ # config.gem 'rest-graph'
12
+
13
+ config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
14
+ config.time_zone = 'UTC'
15
+ end
@@ -0,0 +1,17 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # In the development environment your application's code is reloaded on
4
+ # every request. This slows down response time but is perfect for development
5
+ # since you don't have to restart the webserver when you make code changes.
6
+ config.cache_classes = false
7
+
8
+ # Log error messages when you accidentally call methods on nil.
9
+ config.whiny_nils = true
10
+
11
+ # Show full error reports and disable caching
12
+ config.action_controller.consider_all_requests_local = true
13
+ config.action_view.debug_rjs = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send
17
+ config.action_mailer.raise_delivery_errors = false
@@ -0,0 +1,28 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # The production environment is meant for finished, "live" apps.
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
+
7
+ # Full error reports are disabled and caching is turned on
8
+ config.action_controller.consider_all_requests_local = false
9
+ config.action_controller.perform_caching = true
10
+ config.action_view.cache_template_loading = true
11
+
12
+ # See everything in the log (default is :info)
13
+ # config.log_level = :debug
14
+
15
+ # Use a different logger for distributed setups
16
+ # config.logger = SyslogLogger.new
17
+
18
+ # Use a different cache store in production
19
+ # config.cache_store = :mem_cache_store
20
+
21
+ # Enable serving of images, stylesheets, and javascripts from an asset server
22
+ # config.action_controller.asset_host = "http://assets.example.com"
23
+
24
+ # Disable delivery errors, bad email addresses will be ignored
25
+ # config.action_mailer.raise_delivery_errors = false
26
+
27
+ # Enable threaded mode
28
+ # config.threadsafe!
@@ -0,0 +1,30 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # The test environment is used exclusively to run your application's
4
+ # test suite. You never need to work with it otherwise. Remember that
5
+ # your test database is "scratch space" for the test suite and is wiped
6
+ # and recreated between test runs. Don't rely on the data there!
7
+ config.cache_classes = true
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.action_controller.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+ config.action_view.cache_template_loading = true
16
+
17
+ # Disable request forgery protection in test environment
18
+ config.action_controller.allow_forgery_protection = false
19
+
20
+ # Tell Action Mailer not to deliver emails to the real world.
21
+ # The :test delivery method accumulates sent emails in the
22
+ # ActionMailer::Base.deliveries array.
23
+ config.action_mailer.delivery_method = :test
24
+
25
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
26
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
27
+ # like if you have constraints or database-specific column types
28
+ # config.active_record.schema_format = :sql
29
+
30
+ config.logger = Logger.new($stdout, :debug)
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ ActionController::Base.cookie_verifier_secret = '095e8e5c0b6b901901efb23fab50005b68d9d6a9d41f4ec780946cff34b26603762bc0ea1baf204613b252e5ae499d38b232d5b75edac513a723e450e76548a3';
@@ -0,0 +1,21 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # These settings change the behavior of Rails 2 apps and will be defaults
4
+ # for Rails 3. You can remove this initializer when Rails 3 is released.
5
+
6
+ if defined?(ActiveRecord)
7
+ # Include Active Record class name as root for JSON serialized output.
8
+ ActiveRecord::Base.include_root_in_json = true
9
+
10
+ # Store the full class name (including module namespace) in STI type column.
11
+ ActiveRecord::Base.store_full_sti_class = true
12
+ end
13
+
14
+ ActionController::Routing.generate_best_match = false
15
+
16
+ # Use ISO 8601 format for JSON serialized times and dates.
17
+ ActiveSupport.use_standard_json_time_format = true
18
+
19
+ # Don't escape HTML entities in JSON, leave that for the #json_escape helper.
20
+ # if you're including raw json in an HTML page.
21
+ ActiveSupport.escape_html_entities_in_json = false
@@ -0,0 +1,15 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying cookie session data integrity.
4
+ # If you change this key, all old sessions will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ ActionController::Base.session = {
8
+ :key => '_rails2_session',
9
+ :secret => 'c99a19ce0dc4ed1809e32b6b43bd9229c3a504c456230119dd445fdcb63c0ce06b436f1bf1eace27ebbe0da6041ff2b65cbb4ae4beadc3077e3e6ae07ea75118'
10
+ }
11
+
12
+ # Use the database for sessions instead of the cookie-based default,
13
+ # which shouldn't be used to store highly confidential information
14
+ # (create the session table with "rake db:sessions:create")
15
+ # ActionController::Base.session_store = :active_record_store
@@ -0,0 +1,23 @@
1
+
2
+ # copied from http://gembundler.com/rails23.html
3
+
4
+ begin
5
+ require "rubygems"
6
+ require "bundler"
7
+ rescue LoadError
8
+ raise "Could not load the bundler gem. Install it with `gem install bundler`."
9
+ end
10
+
11
+ if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
12
+ raise RuntimeError, "Your bundler version is too old for Rails 2.3." +
13
+ "Run `gem install bundler` to upgrade."
14
+ end
15
+
16
+ begin
17
+ # Set up load paths for all bundled gems
18
+ ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
19
+ Bundler.setup
20
+ rescue Bundler::GemNotFound
21
+ raise RuntimeError, "Bundler couldn't find some gems." +
22
+ "Did you run `bundle install`?"
23
+ end
@@ -0,0 +1,12 @@
1
+
2
+ development: &default
3
+ facebook:
4
+ app_id: '123'
5
+ secret: '456'
6
+ canvas: 'can'
7
+
8
+ production:
9
+ *default
10
+
11
+ test:
12
+ *default
@@ -0,0 +1,43 @@
1
+ ActionController::Routing::Routes.draw do |map|
2
+ # The priority is based upon order of creation: first created -> highest priority.
3
+
4
+ # Sample of regular route:
5
+ # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
6
+ # Keep in mind you can assign values other than :controller and :action
7
+
8
+ # Sample of named route:
9
+ # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
10
+ # This route can be invoked with purchase_url(:id => product.id)
11
+
12
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
13
+ # map.resources :products
14
+
15
+ # Sample resource route with options:
16
+ # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
17
+
18
+ # Sample resource route with sub-resources:
19
+ # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
20
+
21
+ # Sample resource route with more complex sub-resources
22
+ # map.resources :products do |products|
23
+ # products.resources :comments
24
+ # products.resources :sales, :collection => { :recent => :get }
25
+ # end
26
+
27
+ # Sample resource route within a namespace:
28
+ # map.namespace :admin do |admin|
29
+ # # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
30
+ # admin.resources :products
31
+ # end
32
+
33
+ # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
34
+ map.connect ':action', :controller => 'application'
35
+
36
+ # See how all your routes lay out with "rake routes"
37
+
38
+ # Install the default routes as the lowest priority.
39
+ # Note: These default routes make all actions in every controller accessible via GET requests. You should
40
+ # consider removing or commenting them out if you're using named routes and resources.
41
+ # map.connect ':controller/:action/:id'
42
+ # map.connect ':controller/:action/:id.:format'
43
+ end
File without changes