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.
- data/.travis.yml +8 -4
- data/CHANGES.md +20 -0
- data/Gemfile +4 -3
- data/README.md +8 -8
- data/Rakefile +42 -2
- data/example/rails2/Gemfile +13 -0
- data/example/rails2/README +4 -0
- data/example/rails2/Rakefile +11 -0
- data/example/rails2/app/controllers/application_controller.rb +119 -0
- data/example/rails2/app/views/application/helper.html.erb +1 -0
- data/example/rails2/config/boot.rb +130 -0
- data/example/rails2/config/environment.rb +15 -0
- data/example/rails2/config/environments/development.rb +17 -0
- data/example/rails2/config/environments/production.rb +28 -0
- data/example/rails2/config/environments/test.rb +30 -0
- data/example/rails2/config/initializers/cookie_verification_secret.rb +7 -0
- data/example/rails2/config/initializers/new_rails_defaults.rb +21 -0
- data/example/rails2/config/initializers/session_store.rb +15 -0
- data/example/rails2/config/preinitializer.rb +23 -0
- data/example/rails2/config/rest-core.yaml +12 -0
- data/example/rails2/config/routes.rb +43 -0
- data/example/rails2/log +0 -0
- data/example/rails2/test/functional/application_controller_test.rb +183 -0
- data/example/rails2/test/test_helper.rb +18 -0
- data/example/rails2/test/unit/rails_util_test.rb +44 -0
- data/example/rails3/Gemfile +13 -0
- data/example/rails3/README +4 -0
- data/example/rails3/Rakefile +7 -0
- data/example/rails3/app/controllers/application_controller.rb +119 -0
- data/example/rails3/app/views/application/helper.html.erb +1 -0
- data/example/rails3/config/application.rb +23 -0
- data/example/rails3/config/environment.rb +5 -0
- data/example/rails3/config/environments/development.rb +26 -0
- data/example/rails3/config/environments/production.rb +49 -0
- data/example/rails3/config/environments/test.rb +30 -0
- data/example/rails3/config/initializers/secret_token.rb +7 -0
- data/example/rails3/config/initializers/session_store.rb +8 -0
- data/example/rails3/config/rest-core.yaml +12 -0
- data/example/rails3/config/routes.rb +5 -0
- data/example/rails3/config.ru +4 -0
- data/example/rails3/test/functional/application_controller_test.rb +183 -0
- data/example/rails3/test/test_helper.rb +18 -0
- data/example/rails3/test/unit/rails_util_test.rb +44 -0
- data/example/sinatra/config.ru +16 -0
- data/lib/rest-core/app/ask.rb +0 -2
- data/lib/rest-core/client/facebook/rails_util.rb +342 -0
- data/lib/rest-core/client/{rest-graph.rb → facebook.rb} +21 -28
- data/lib/rest-core/client/github.rb +1 -1
- data/lib/rest-core/client/linkedin.rb +3 -1
- data/lib/rest-core/client/twitter.rb +2 -2
- data/lib/rest-core/client.rb +2 -2
- data/lib/rest-core/client_oauth1.rb +3 -3
- data/lib/rest-core/middleware/oauth2_query.rb +3 -3
- data/{test/common.rb → lib/rest-core/test.rb} +7 -3
- data/lib/rest-core/util/config.rb +22 -17
- data/lib/rest-core/util/vendor.rb +31 -0
- data/lib/rest-core/version.rb +1 -1
- data/lib/rest-core.rb +5 -0
- data/rest-core.gemspec +135 -108
- data/test/client/facebook/config/rest-core.yaml +8 -0
- data/test/{test_api.rb → client/facebook/test_api.rb} +22 -23
- data/test/{test_cache.rb → client/facebook/test_cache.rb} +4 -8
- data/test/{test_default.rb → client/facebook/test_default.rb} +6 -10
- data/test/client/facebook/test_error.rb +65 -0
- data/test/{test_handler.rb → client/facebook/test_handler.rb} +12 -15
- data/test/{test_load_config.rb → client/facebook/test_load_config.rb} +6 -9
- data/test/{test_misc.rb → client/facebook/test_misc.rb} +15 -18
- data/test/{test_oauth.rb → client/facebook/test_oauth.rb} +4 -8
- data/test/{test_old.rb → client/facebook/test_old.rb} +16 -18
- data/test/{test_page.rb → client/facebook/test_page.rb} +5 -9
- data/test/{test_parse.rb → client/facebook/test_parse.rb} +13 -16
- data/test/client/facebook/test_serialize.rb +42 -0
- data/test/client/facebook/test_timeout.rb +22 -0
- data/test/test_oauth1_header.rb +1 -5
- metadata +99 -58
- data/test/config/rest-core.yaml +0 -7
- data/test/test_error.rb +0 -66
- data/test/test_serialize.rb +0 -44
- 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], '&'))
|
34
|
+
|
35
|
+
assert_equal(
|
36
|
+
CGI.escapeHTML(expected),
|
37
|
+
normalize_url(
|
38
|
+
@response.body.match(/<a href="(.+?)" target="_top">/)[1], '&'))
|
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,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,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
|