rest-core 0.2.3 → 0.3.0.pre.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,183 @@
1
+
2
+ require 'test_helper'
3
+ require 'webmock'
4
+
5
+ WebMock.disable_net_connect!
6
+
7
+ class ApplicationControllerTest < ActionController::TestCase
8
+ include WebMock::API
9
+
10
+ def setup
11
+ body = rand(2) == 0 ? '{"error":{"type":"OAuthException"}}' :
12
+ '{"error_code":104}'
13
+
14
+ stub_request(:get, 'https://graph.facebook.com/me').
15
+ to_return(:body => body)
16
+ end
17
+
18
+ def teardown
19
+ WebMock.reset!
20
+ end
21
+
22
+ def assert_url expected
23
+ assert_equal(expected, normalize_url(assigns(:rc_facebook_authorize_url)))
24
+ if @response.status == 200 # js redirect
25
+ assert_equal(
26
+ expected,
27
+ normalize_url(
28
+ @response.body.match(/window\.top\.location\.href = '(.+?)'/)[1]))
29
+
30
+ assert_equal(
31
+ CGI.escapeHTML(expected),
32
+ normalize_url(
33
+ @response.body.match(/content="0;url=(.+?)"/)[1], '&amp;'))
34
+
35
+ assert_equal(
36
+ CGI.escapeHTML(expected),
37
+ normalize_url(
38
+ @response.body.match(/<a href="(.+?)" target="_top">/)[1], '&amp;'))
39
+ end
40
+ end
41
+
42
+ def test_index
43
+ get(:index)
44
+ assert_response :redirect
45
+
46
+ url = normalize_url(
47
+ 'https://graph.facebook.com/oauth/authorize?client_id=123&' \
48
+ 'scope=&redirect_uri=http%3A%2F%2Ftest.host%2F')
49
+
50
+ assert_url(url)
51
+ end
52
+
53
+ def test_canvas
54
+ get(:canvas)
55
+ assert_response :success
56
+
57
+ url = normalize_url(
58
+ 'https://graph.facebook.com/oauth/authorize?client_id=123&' \
59
+ 'scope=publish_stream&' \
60
+ 'redirect_uri=http%3A%2F%2Fapps.facebook.com%2Fcan%2Fcanvas')
61
+
62
+ assert_url(url)
63
+ end
64
+
65
+ def test_diff_canvas
66
+ get(:diff_canvas)
67
+ assert_response :success
68
+
69
+ url = normalize_url(
70
+ 'https://graph.facebook.com/oauth/authorize?client_id=123&' \
71
+ 'scope=email&' \
72
+ 'redirect_uri=http%3A%2F%2Fapps.facebook.com%2FToT%2Fdiff_canvas')
73
+
74
+ assert_url(url)
75
+ end
76
+
77
+ def test_iframe_canvas
78
+ get(:iframe_canvas)
79
+ assert_response :success
80
+
81
+ url = normalize_url(
82
+ 'https://graph.facebook.com/oauth/authorize?client_id=123&' \
83
+ 'scope=&' \
84
+ 'redirect_uri=http%3A%2F%2Fapps.facebook.com%2Fzzz%2Fiframe_canvas')
85
+
86
+ assert_url(url)
87
+ end
88
+
89
+ def test_options
90
+ get(:options)
91
+ assert_response :redirect
92
+
93
+ url = normalize_url(
94
+ 'https://graph.facebook.com/oauth/authorize?client_id=123&' \
95
+ 'scope=bogus&' \
96
+ 'redirect_uri=http%3A%2F%2Ftest.host%2Foptions')
97
+
98
+ assert_url(url)
99
+ end
100
+
101
+ def test_protected
102
+ assert_nil @controller.public_methods.find{ |m| m.to_s =~ /^rest_graph/ }
103
+ end
104
+
105
+ def test_no_auto
106
+ get(:no_auto)
107
+ assert_response :success
108
+ assert_equal 'XD', @response.body
109
+ end
110
+
111
+ def test_app_id
112
+ get(:diff_app_id)
113
+ assert_response :success
114
+ assert_equal 'zzz', @response.body
115
+ end
116
+
117
+ def test_cache
118
+ WebMock.reset!
119
+ stub_request(:get, 'https://graph.facebook.com/cache').
120
+ to_return(:body => '{"message":"ok"}')
121
+
122
+ get(:cache)
123
+ assert_response :success
124
+ assert_equal '{"message":"ok"}', @response.body
125
+ end
126
+
127
+ def test_handler
128
+ WebMock.reset!
129
+ stub_request(:get, 'https://graph.facebook.com/me?access_token=aloha').
130
+ to_return(:body => '["snowman"]')
131
+
132
+ Rails.cache[:fbs] = RestCore::Facebook.new(:access_token => 'aloha').fbs
133
+ get(:handler_)
134
+ assert_response :success
135
+ assert_equal '["snowman"]', @response.body
136
+ ensure
137
+ Rails.cache.clear
138
+ end
139
+
140
+ def test_session
141
+ WebMock.reset!
142
+ stub_request(:get, 'https://graph.facebook.com/me?access_token=wozilla').
143
+ to_return(:body => '["fireball"]')
144
+
145
+ @request.session[RestCore::Facebook::RailsUtil.rc_facebook_storage_key] =
146
+ RestCore::Facebook.new(:access_token => 'wozilla').fbs
147
+
148
+ get(:session_)
149
+ assert_response :success
150
+ assert_equal '["fireball"]', @response.body
151
+ end
152
+
153
+ def test_cookies
154
+ WebMock.reset!
155
+ stub_request(:get, 'https://graph.facebook.com/me?access_token=blizzard').
156
+ to_return(:body => '["yeti"]')
157
+
158
+ @request.cookies[RestCore::Facebook::RailsUtil.rc_facebook_storage_key] =
159
+ RestCore::Facebook.new(:access_token => 'blizzard').fbs
160
+
161
+ get(:cookies_)
162
+ assert_response :success
163
+ assert_equal '["yeti"]', @response.body
164
+ end
165
+
166
+ def test_error
167
+ get(:error)
168
+ rescue => e
169
+ assert_equal RestCore::Facebook::Error, e.class
170
+ end
171
+
172
+ def test_reinitailize
173
+ get(:reinitialize)
174
+ assert_response :success
175
+ assert_equal [nil, {'a' => 'b'}], YAML.load(@response.body)
176
+ end
177
+
178
+ def test_helper
179
+ get(:helper)
180
+ assert_response :success
181
+ assert_equal RestCore::Facebook.default_app_id, @response.body.strip
182
+ end
183
+ end
@@ -0,0 +1,18 @@
1
+
2
+ ENV["RAILS_ENV"] = "test"
3
+ require File.expand_path('../../config/environment', __FILE__)
4
+ begin
5
+ require 'rails/test_help'
6
+ rescue LoadError # for rails2
7
+ require 'test_help'
8
+ end
9
+
10
+ class ActiveSupport::TestCase
11
+ def normalize_query query, amp='&'
12
+ '?' + query[1..-1].split(amp).sort.join(amp)
13
+ end
14
+
15
+ def normalize_url url, amp='&'
16
+ url.sub(/\?.+/){ |query| normalize_query(query, amp) }
17
+ end
18
+ end
@@ -0,0 +1,44 @@
1
+
2
+ require 'test_helper'
3
+ require 'rr'
4
+
5
+ class RailsUtilTest < ActiveSupport::TestCase
6
+ include RR::Adapters::TestUnit
7
+
8
+ def setup_mock url
9
+ mock(RestCore::Facebook::RailsUtil).rc_facebook_in_canvas?{ false }
10
+ mock(RestCore::Facebook::RailsUtil).request{
11
+ mock(Object.new).url{ url }
12
+ }
13
+ end
14
+
15
+ def test_rest_graph_normalized_request_uri_0
16
+ setup_mock( 'http://test.com/?code=123&lang=en')
17
+ assert_equal('http://test.com/?lang=en',
18
+ RestCore::Facebook::RailsUtil.rc_facebook_normalized_request_uri)
19
+ end
20
+
21
+ def test_rest_graph_normalized_request_uri_1
22
+ setup_mock( 'http://test.com/?lang=en&code=123')
23
+ assert_equal('http://test.com/?lang=en',
24
+ RestCore::Facebook::RailsUtil.rc_facebook_normalized_request_uri)
25
+ end
26
+
27
+ def test_rest_graph_normalized_request_uri_2
28
+ setup_mock( 'http://test.com/?session=abc&lang=en&code=123')
29
+ assert_equal('http://test.com/?lang=en',
30
+ RestCore::Facebook::RailsUtil.rc_facebook_normalized_request_uri)
31
+ end
32
+
33
+ def test_rest_graph_normalized_request_uri_3
34
+ setup_mock( 'http://test.com/?code=123')
35
+ assert_equal('http://test.com/',
36
+ RestCore::Facebook::RailsUtil.rc_facebook_normalized_request_uri)
37
+ end
38
+
39
+ def test_rest_graph_normalized_request_uri_4
40
+ setup_mock( 'http://test.com/?signed_request=abc&code=123')
41
+ assert_equal('http://test.com/',
42
+ RestCore::Facebook::RailsUtil.rc_facebook_normalized_request_uri)
43
+ end
44
+ end
@@ -0,0 +1,13 @@
1
+
2
+ source 'http://rubygems.org'
3
+
4
+ gem 'rails', '3.0.9'
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,7 @@
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.expand_path('../config/application', __FILE__)
5
+ require 'rake'
6
+
7
+ Rails3::Application.load_tasks
@@ -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,23 @@
1
+
2
+ # Set up gems listed in the Gemfile.
3
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
4
+
5
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
6
+
7
+ require 'action_controller/railtie'
8
+ require 'rails/test_unit/railtie'
9
+
10
+ Bundler.require(:default, Rails.env)
11
+
12
+ module Rails3
13
+ class Application < Rails::Application
14
+ config.encoding = 'utf-8'
15
+
16
+ logger = Logger.new($stdout)
17
+ logger.level = Logger::INFO
18
+ config.logger = logger
19
+
20
+ # Configure sensitive parameters which will be filtered from the log file.
21
+ config.filter_parameters += [:password]
22
+ end
23
+ end
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Rails3::Application.initialize!
@@ -0,0 +1,26 @@
1
+ Rails3::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the webserver when you make code changes.
7
+ config.cache_classes = false
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.consider_all_requests_local = true
14
+ config.action_view.debug_rjs = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Don't care if the mailer can't send
18
+ config.action_mailer.raise_delivery_errors = false
19
+
20
+ # Print deprecation notices to the Rails logger
21
+ config.active_support.deprecation = :log
22
+
23
+ # Only use best-standards-support built into browsers
24
+ config.action_dispatch.best_standards_support = :builtin
25
+ end
26
+
@@ -0,0 +1,49 @@
1
+ Rails3::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The production environment is meant for finished, "live" apps.
5
+ # Code is not reloaded between requests
6
+ config.cache_classes = true
7
+
8
+ # Full error reports are disabled and caching is turned on
9
+ config.consider_all_requests_local = false
10
+ config.action_controller.perform_caching = true
11
+
12
+ # Specifies the header that your server uses for sending files
13
+ config.action_dispatch.x_sendfile_header = "X-Sendfile"
14
+
15
+ # For nginx:
16
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
17
+
18
+ # If you have no front-end server that supports something like X-Sendfile,
19
+ # just comment this out and Rails will serve the files
20
+
21
+ # See everything in the log (default is :info)
22
+ # config.log_level = :debug
23
+
24
+ # Use a different logger for distributed setups
25
+ # config.logger = SyslogLogger.new
26
+
27
+ # Use a different cache store in production
28
+ # config.cache_store = :mem_cache_store
29
+
30
+ # Disable Rails's static asset server
31
+ # In production, Apache or nginx will already do this
32
+ config.serve_static_assets = false
33
+
34
+ # Enable serving of images, stylesheets, and javascripts from an asset server
35
+ # config.action_controller.asset_host = "http://assets.example.com"
36
+
37
+ # Disable delivery errors, bad email addresses will be ignored
38
+ # config.action_mailer.raise_delivery_errors = false
39
+
40
+ # Enable threaded mode
41
+ # config.threadsafe!
42
+
43
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
44
+ # the I18n.default_locale when a translation can not be found)
45
+ config.i18n.fallbacks = true
46
+
47
+ # Send deprecation notices to registered listeners
48
+ config.active_support.deprecation = :notify
49
+ end
@@ -0,0 +1,30 @@
1
+ Rails3::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Log error messages when you accidentally call methods on nil.
11
+ config.whiny_nils = true
12
+
13
+ # Show full error reports and disable caching
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Raise exceptions instead of rendering exception templates
18
+ config.action_dispatch.show_exceptions = false
19
+
20
+ # Disable request forgery protection in test environment
21
+ config.action_controller.allow_forgery_protection = false
22
+
23
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
24
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
25
+ # like if you have constraints or database-specific column types
26
+ # config.active_record.schema_format = :sql
27
+
28
+ # Print deprecation notices to the stderr
29
+ config.active_support.deprecation = :stderr
30
+ end
@@ -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
+ Rails3::Application.config.secret_token = '74c293b4c5df1981d2f92785aa5538a21b0901293d693e6bb828669cbb1f1d1f5ddd1b3e21325304c90e952a4866a9eec7620379b6f6c27aae0670cdefda97ae'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails3::Application.config.session_store :cookie_store, :key => '_rails3_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # Rails3::Application.config.session_store :active_record_store
@@ -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,5 @@
1
+
2
+ Rails3::Application.routes.draw do
3
+ root :controller => 'application', :action => 'index'
4
+ match ':action', :controller => 'application'
5
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails3::Application