clearance 0.8.4 → 0.8.5
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.
- data/CHANGELOG.textile +12 -1
- data/README.textile +27 -44
- data/Rakefile +20 -36
- data/VERSION +1 -0
- data/app/controllers/clearance/confirmations_controller.rb +1 -1
- data/app/controllers/clearance/passwords_controller.rb +2 -2
- data/app/controllers/clearance/sessions_controller.rb +3 -3
- data/app/controllers/clearance/users_controller.rb +1 -1
- data/app/models/clearance_mailer.rb +2 -4
- data/app/views/sessions/new.html.erb +1 -1
- data/generators/clearance/clearance_generator.rb +6 -0
- data/generators/clearance/lib/insert_commands.rb +1 -1
- data/generators/clearance/templates/README +13 -11
- data/generators/clearance/templates/clearance.rb +3 -0
- data/generators/clearance_features/templates/features/step_definitions/clearance_steps.rb +12 -8
- data/generators/clearance_features/templates/features/support/paths.rb +10 -9
- data/generators/clearance_views/templates/formtastic/sessions/new.html.erb +1 -1
- data/lib/clearance.rb +2 -1
- data/lib/clearance/authentication.rb +2 -2
- data/lib/clearance/configuration.rb +25 -0
- data/lib/clearance/routes.rb +49 -0
- data/lib/clearance/user.rb +0 -18
- data/shoulda_macros/clearance.rb +1 -1
- data/test/controllers/confirmations_controller_test.rb +100 -0
- data/test/controllers/passwords_controller_test.rb +183 -0
- data/test/controllers/sessions_controller_test.rb +141 -0
- data/test/controllers/users_controller_test.rb +65 -0
- data/test/models/clearance_mailer_test.rb +55 -0
- data/test/models/user_test.rb +227 -0
- data/test/rails_root/app/controllers/accounts_controller.rb +10 -0
- data/test/rails_root/app/controllers/application_controller.rb +5 -0
- data/test/rails_root/app/helpers/application_helper.rb +5 -0
- data/test/rails_root/app/helpers/confirmations_helper.rb +2 -0
- data/test/rails_root/app/helpers/passwords_helper.rb +2 -0
- data/test/rails_root/app/models/user.rb +3 -0
- data/test/rails_root/config/boot.rb +110 -0
- data/test/rails_root/config/environment.rb +17 -0
- data/test/rails_root/config/environments/development.rb +19 -0
- data/test/rails_root/config/environments/production.rb +1 -0
- data/test/rails_root/config/environments/test.rb +36 -0
- data/test/rails_root/config/initializers/clearance.rb +3 -0
- data/test/rails_root/config/initializers/clearance_loader.rb +8 -0
- data/test/rails_root/config/initializers/inflections.rb +10 -0
- data/test/rails_root/config/initializers/mime_types.rb +5 -0
- data/test/rails_root/config/initializers/requires.rb +13 -0
- data/test/rails_root/config/initializers/time_formats.rb +4 -0
- data/test/rails_root/config/routes.rb +6 -0
- data/test/rails_root/db/migrate/20100120045223_clearance_create_users.rb +21 -0
- data/test/rails_root/features/step_definitions/clearance_steps.rb +122 -0
- data/test/rails_root/features/step_definitions/factory_girl_steps.rb +5 -0
- data/test/rails_root/features/step_definitions/web_steps.rb +259 -0
- data/test/rails_root/features/support/env.rb +47 -0
- data/test/rails_root/features/support/paths.rb +23 -0
- data/test/rails_root/public/dispatch.rb +10 -0
- data/test/rails_root/script/create_project.rb +52 -0
- data/test/rails_root/test/factories/clearance.rb +13 -0
- data/test/rails_root/test/functional/accounts_controller_test.rb +23 -0
- data/test/rails_root/vendor/gems/justinfrench-formtastic-0.2.1/generators/formtastic_stylesheets/formtastic_stylesheets_generator.rb +21 -0
- data/test/rails_root/vendor/gems/justinfrench-formtastic-0.2.1/lib/formtastic.rb +1236 -0
- data/test/rails_root/vendor/gems/justinfrench-formtastic-0.2.1/lib/justin_french/formtastic.rb +10 -0
- data/test/rails_root/vendor/gems/justinfrench-formtastic-0.2.1/rails/init.rb +3 -0
- data/test/rails_root/vendor/gems/justinfrench-formtastic-0.2.1/spec/formtastic_spec.rb +2900 -0
- data/test/rails_root/vendor/gems/justinfrench-formtastic-0.2.1/spec/test_helper.rb +14 -0
- data/test/test_helper.rb +19 -0
- metadata +60 -18
- data/TODO.textile +0 -6
- data/config/clearance_routes.rb +0 -30
- data/lib/clearance/extensions/routes.rb +0 -14
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class UsersControllerTest < ActionController::TestCase
|
|
4
|
+
|
|
5
|
+
tests Clearance::UsersController
|
|
6
|
+
|
|
7
|
+
should_filter_params :password
|
|
8
|
+
|
|
9
|
+
context "when signed out" do
|
|
10
|
+
setup { sign_out }
|
|
11
|
+
|
|
12
|
+
context "on GET to #new" do
|
|
13
|
+
setup { get :new }
|
|
14
|
+
|
|
15
|
+
should_respond_with :success
|
|
16
|
+
should_render_template :new
|
|
17
|
+
should_not_set_the_flash
|
|
18
|
+
|
|
19
|
+
should_display_a_sign_up_form
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
context "on GET to #new with email" do
|
|
23
|
+
setup do
|
|
24
|
+
@email = "a@example.com"
|
|
25
|
+
get :new, :user => { :email => @email }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
should "set assigned user's email" do
|
|
29
|
+
assert_equal @email, assigns(:user).email
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
context "on POST to #create with valid attributes" do
|
|
34
|
+
setup do
|
|
35
|
+
user_attributes = Factory.attributes_for(:user)
|
|
36
|
+
post :create, :user => user_attributes
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
should_assign_to :user
|
|
40
|
+
should_change 'User.count', :by => 1
|
|
41
|
+
|
|
42
|
+
should "send the confirmation email" do
|
|
43
|
+
assert_sent_email do |email|
|
|
44
|
+
email.subject =~ /account confirmation/i
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
should_set_the_flash_to /confirm/i
|
|
49
|
+
should_redirect_to_url_after_create
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
signed_in_user_context do
|
|
54
|
+
context "GET to new" do
|
|
55
|
+
setup { get :new }
|
|
56
|
+
should_redirect_to("the home page") { root_url }
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
context "POST to create" do
|
|
60
|
+
setup { post :create, :user => {} }
|
|
61
|
+
should_redirect_to("the home page") { root_url }
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class ClearanceMailerTest < ActiveSupport::TestCase
|
|
4
|
+
|
|
5
|
+
context "A change password email" do
|
|
6
|
+
setup do
|
|
7
|
+
@user = Factory(:user)
|
|
8
|
+
@email = ClearanceMailer.create_change_password @user
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
should "be from DO_NOT_REPLY" do
|
|
12
|
+
assert_match /#{@email.from[0]}/i, Clearance.configuration.mailer_sender
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
should "be sent to user" do
|
|
16
|
+
assert_match /#{@user.email}/i, @email.to.first
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
should "contain a link to edit the user's password" do
|
|
20
|
+
host = ActionMailer::Base.default_url_options[:host]
|
|
21
|
+
regexp = %r{http://#{host}/users/#{@user.id}/password/edit\?token=#{@user.confirmation_token}}
|
|
22
|
+
assert_match regexp, @email.body
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
should "set its subject" do
|
|
26
|
+
assert_match /Change your password/, @email.subject
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
context "A confirmation email" do
|
|
31
|
+
setup do
|
|
32
|
+
@user = Factory(:user)
|
|
33
|
+
@email = ClearanceMailer.create_confirmation @user
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
should "be from DO_NOT_REPLY" do
|
|
37
|
+
assert_match /#{@email.from[0]}/i, Clearance.configuration.mailer_sender
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
should "be sent to user" do
|
|
41
|
+
assert_match /#{@user.email}/i, @email.to.first
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
should "set its subject" do
|
|
45
|
+
assert_match /Account confirmation/, @email.subject
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
should "contain a link to confirm the user's account" do
|
|
49
|
+
host = ActionMailer::Base.default_url_options[:host]
|
|
50
|
+
regexp = %r{http://#{host}/users/#{@user.id}/confirmation/new\?token=#{@user.confirmation_token}}
|
|
51
|
+
assert_match regexp, @email.body
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
end
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class UserTest < ActiveSupport::TestCase
|
|
4
|
+
|
|
5
|
+
# signing up
|
|
6
|
+
|
|
7
|
+
context "When signing up" do
|
|
8
|
+
should_validate_presence_of :email, :password
|
|
9
|
+
should_allow_values_for :email, "foo@example.com"
|
|
10
|
+
should_not_allow_values_for :email, "foo"
|
|
11
|
+
should_not_allow_values_for :email, "example.com"
|
|
12
|
+
|
|
13
|
+
should "require password confirmation on create" do
|
|
14
|
+
user = Factory.build(:user, :password => 'blah',
|
|
15
|
+
:password_confirmation => 'boogidy')
|
|
16
|
+
assert ! user.save
|
|
17
|
+
assert user.errors.on(:password)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
should "require non blank password confirmation on create" do
|
|
21
|
+
user = Factory.build(:user, :password => 'blah',
|
|
22
|
+
:password_confirmation => '')
|
|
23
|
+
assert ! user.save
|
|
24
|
+
assert user.errors.on(:password)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
should "initialize salt" do
|
|
28
|
+
assert_not_nil Factory(:user).salt
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
should "initialize confirmation token" do
|
|
32
|
+
assert_not_nil Factory(:user).confirmation_token
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
context "encrypt password" do
|
|
36
|
+
setup do
|
|
37
|
+
@salt = "salt"
|
|
38
|
+
@user = Factory.build(:user, :salt => @salt)
|
|
39
|
+
def @user.initialize_salt; end
|
|
40
|
+
@user.save!
|
|
41
|
+
@password = @user.password
|
|
42
|
+
|
|
43
|
+
@user.send(:encrypt, @password)
|
|
44
|
+
@expected = Digest::SHA1.hexdigest("--#{@salt}--#{@password}--")
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
should "create an encrypted password using SHA1 encryption" do
|
|
48
|
+
assert_equal @expected, @user.encrypted_password
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
should "store email in exact case" do
|
|
53
|
+
user = Factory(:user, :email => "John.Doe@example.com")
|
|
54
|
+
assert_equal "John.Doe@example.com", user.email
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
should "send the confirmation email" do
|
|
58
|
+
assert_sent_email do |email|
|
|
59
|
+
email.subject =~ /account confirmation/i
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
context "When signing up with email already confirmed" do
|
|
65
|
+
setup do
|
|
66
|
+
ActionMailer::Base.deliveries.clear
|
|
67
|
+
Factory(:user, :email_confirmed => true)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
should "not send the confirmation email" do
|
|
71
|
+
assert_did_not_send_email
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
context "When multiple users have signed up" do
|
|
76
|
+
setup { @user = Factory(:user) }
|
|
77
|
+
should_validate_uniqueness_of :email
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# confirming email
|
|
81
|
+
|
|
82
|
+
context "A user without email confirmation" do
|
|
83
|
+
setup do
|
|
84
|
+
@user = Factory(:user)
|
|
85
|
+
assert ! @user.email_confirmed?
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
context "after #confirm_email!" do
|
|
89
|
+
setup do
|
|
90
|
+
assert @user.confirm_email!
|
|
91
|
+
@user.reload
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
should "have confirmed their email" do
|
|
95
|
+
assert @user.email_confirmed?
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
should "reset confirmation token" do
|
|
99
|
+
assert_nil @user.confirmation_token
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# authenticating
|
|
105
|
+
|
|
106
|
+
context "A user" do
|
|
107
|
+
setup do
|
|
108
|
+
@user = Factory(:user)
|
|
109
|
+
@password = @user.password
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
should "authenticate with good credentials" do
|
|
113
|
+
assert ::User.authenticate(@user.email, @password)
|
|
114
|
+
assert @user.authenticated?(@password)
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
should "not authenticate with bad credentials" do
|
|
118
|
+
assert ! ::User.authenticate(@user.email, 'bad_password')
|
|
119
|
+
assert ! @user.authenticated?('bad_password')
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# remember me
|
|
124
|
+
|
|
125
|
+
context "When authenticating with remember_me!" do
|
|
126
|
+
setup do
|
|
127
|
+
@user = Factory(:email_confirmed_user)
|
|
128
|
+
assert_nil @user.remember_token
|
|
129
|
+
@user.remember_me!
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
should "set the remember token" do
|
|
133
|
+
assert_not_nil @user.remember_token
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# updating password
|
|
138
|
+
|
|
139
|
+
context "An email confirmed user" do
|
|
140
|
+
setup do
|
|
141
|
+
@user = Factory(:email_confirmed_user)
|
|
142
|
+
@old_encrypted_password = @user.encrypted_password
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
context "who updates password with confirmation" do
|
|
146
|
+
setup do
|
|
147
|
+
@user.update_password("new_password", "new_password")
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
should "change encrypted password" do
|
|
151
|
+
assert_not_equal @user.encrypted_password,
|
|
152
|
+
@old_encrypted_password
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
should "not generate the same remember token for users with the same password at the same time" do
|
|
158
|
+
password = 'secret'
|
|
159
|
+
first_user = Factory(:email_confirmed_user,
|
|
160
|
+
:password => password,
|
|
161
|
+
:password_confirmation => password)
|
|
162
|
+
second_user = Factory(:email_confirmed_user,
|
|
163
|
+
:password => password,
|
|
164
|
+
:password_confirmation => password)
|
|
165
|
+
|
|
166
|
+
Time.stubs(:now => Time.now)
|
|
167
|
+
first_user.remember_me!
|
|
168
|
+
second_user.remember_me!
|
|
169
|
+
|
|
170
|
+
assert_not_equal first_user.remember_token, second_user.remember_token
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# recovering forgotten password
|
|
174
|
+
|
|
175
|
+
context "An email confirmed user" do
|
|
176
|
+
setup do
|
|
177
|
+
@user = Factory(:email_confirmed_user)
|
|
178
|
+
@old_encrypted_password = @user.encrypted_password
|
|
179
|
+
@user.confirm_email!
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
context "who requests password reminder" do
|
|
183
|
+
setup do
|
|
184
|
+
assert_nil @user.confirmation_token
|
|
185
|
+
@user.forgot_password!
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
should "generate confirmation token" do
|
|
189
|
+
assert_not_nil @user.confirmation_token
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
context "and then updates password" do
|
|
193
|
+
context 'with confirmation' do
|
|
194
|
+
setup do
|
|
195
|
+
@user.update_password("new_password", "new_password")
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
should "change encrypted password" do
|
|
199
|
+
assert_not_equal @user.encrypted_password,
|
|
200
|
+
@old_encrypted_password
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
should "clear confirmation token" do
|
|
204
|
+
assert_nil @user.confirmation_token
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
context 'without confirmation' do
|
|
209
|
+
setup do
|
|
210
|
+
@user.update_password("new_password", "")
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
should "not change encrypted password" do
|
|
214
|
+
assert_equal @user.encrypted_password,
|
|
215
|
+
@old_encrypted_password
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
should "not clear confirmation token" do
|
|
219
|
+
assert_not_nil @user.confirmation_token
|
|
220
|
+
end
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
end
|
|
@@ -0,0 +1,110 @@
|
|
|
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
|
+
$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.)
|
|
66
|
+
exit 1
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
class << self
|
|
70
|
+
def rubygems_version
|
|
71
|
+
Gem::RubyGemsVersion rescue nil
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def gem_version
|
|
75
|
+
if defined? RAILS_GEM_VERSION
|
|
76
|
+
RAILS_GEM_VERSION
|
|
77
|
+
elsif ENV.include?('RAILS_GEM_VERSION')
|
|
78
|
+
ENV['RAILS_GEM_VERSION']
|
|
79
|
+
else
|
|
80
|
+
parse_gem_version(read_environment_rb)
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def load_rubygems
|
|
85
|
+
require 'rubygems'
|
|
86
|
+
min_version = '1.3.1'
|
|
87
|
+
unless rubygems_version >= min_version
|
|
88
|
+
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
|
89
|
+
exit 1
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
rescue LoadError
|
|
93
|
+
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
|
|
94
|
+
exit 1
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def parse_gem_version(text)
|
|
98
|
+
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
private
|
|
102
|
+
def read_environment_rb
|
|
103
|
+
File.read("#{RAILS_ROOT}/config/environment.rb")
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# All that for this:
|
|
110
|
+
Rails.boot!
|