clearance 0.8.8 → 0.9.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of clearance might be problematic. Click here for more details.
- data/CHANGELOG.md +8 -0
- data/README.md +27 -32
- data/Rakefile +25 -31
- data/app/controllers/clearance/passwords_controller.rb +1 -1
- data/app/controllers/clearance/sessions_controller.rb +1 -1
- data/app/models/clearance_mailer.rb +4 -4
- data/app/views/passwords/edit.html.erb +1 -1
- data/app/views/passwords/new.html.erb +2 -2
- data/app/views/sessions/new.html.erb +1 -1
- data/app/views/users/_form.html.erb +1 -1
- data/app/views/users/new.html.erb +1 -1
- data/config/routes.rb +30 -0
- data/lib/clearance.rb +2 -1
- data/lib/clearance/authentication.rb +2 -2
- data/lib/clearance/configuration.rb +10 -3
- data/lib/clearance/engine.rb +8 -0
- data/lib/clearance/user.rb +5 -6
- data/lib/rails/generators/clearance_features_generator.rb +20 -0
- data/{generators/clearance_features/templates → lib/rails/generators/clearance_features_templates}/features/password_reset.feature +1 -1
- data/{generators/clearance_features/templates → lib/rails/generators/clearance_features_templates}/features/sign_in.feature +0 -0
- data/{generators/clearance_features/templates → lib/rails/generators/clearance_features_templates}/features/sign_out.feature +0 -0
- data/{generators/clearance_features/templates → lib/rails/generators/clearance_features_templates}/features/sign_up.feature +0 -0
- data/{generators/clearance_features/templates → lib/rails/generators/clearance_features_templates}/features/step_definitions/clearance_steps.rb +13 -5
- data/lib/rails/generators/clearance_generator.rb +68 -0
- data/{generators/clearance/templates → lib/rails/generators/clearance_templates}/README +0 -0
- data/{generators/clearance/templates → lib/rails/generators/clearance_templates}/clearance.rb +0 -0
- data/{generators/clearance/templates → lib/rails/generators/clearance_templates}/factories.rb +0 -0
- data/{generators/clearance/templates → lib/rails/generators/clearance_templates}/migrations/create_users.rb +0 -1
- data/{generators/clearance/templates → lib/rails/generators/clearance_templates}/migrations/update_users.rb +0 -1
- data/{generators/clearance/templates → lib/rails/generators/clearance_templates}/user.rb +0 -0
- data/lib/rails/generators/clearance_views_generator.rb +14 -0
- data/{generators/clearance_views/templates/formtastic → lib/rails/generators/clearance_views_templates/formtastic/erb}/passwords/edit.html.erb +3 -3
- data/{generators/clearance_views/templates/formtastic → lib/rails/generators/clearance_views_templates/formtastic/erb}/passwords/new.html.erb +3 -3
- data/{generators/clearance_views/templates/formtastic → lib/rails/generators/clearance_views_templates/formtastic/erb}/sessions/new.html.erb +3 -3
- data/{generators/clearance_views/templates/formtastic → lib/rails/generators/clearance_views_templates/formtastic/erb}/users/_inputs.html.erb +1 -1
- data/{generators/clearance_views/templates/formtastic → lib/rails/generators/clearance_views_templates/formtastic/erb}/users/new.html.erb +2 -2
- data/shoulda_macros/clearance.rb +9 -17
- data/test/controllers/confirmations_controller_test.rb +6 -6
- data/test/controllers/passwords_controller_test.rb +10 -10
- data/test/controllers/sessions_controller_test.rb +57 -16
- data/test/controllers/users_controller_test.rb +12 -8
- data/test/models/clearance_mailer_test.rb +2 -2
- data/test/models/user_test.rb +14 -7
- data/test/rails_root/app/helpers/application_helper.rb +0 -3
- data/test/rails_root/config/application.rb +46 -0
- data/test/rails_root/config/boot.rb +5 -109
- data/test/rails_root/config/environment.rb +5 -15
- data/test/rails_root/config/environments/development.rb +15 -15
- data/test/rails_root/config/environments/production.rb +42 -1
- data/test/rails_root/config/environments/test.rb +25 -29
- data/test/rails_root/config/initializers/backtrace_silencers.rb +7 -0
- data/test/rails_root/config/initializers/inflections.rb +1 -1
- data/test/rails_root/config/initializers/secret_token.rb +7 -0
- data/test/rails_root/config/initializers/session_store.rb +8 -0
- data/test/rails_root/config/routes.rb +57 -2
- data/test/rails_root/features/step_definitions/web_steps.rb +125 -165
- data/test/rails_root/features/support/env.rb +24 -14
- data/test/rails_root/features/support/paths.rb +26 -4
- data/test/rails_root/test/functional/accounts_controller_test.rb +0 -1
- data/test/rails_root/test/performance/browsing_test.rb +9 -0
- data/test/rails_root/test/test_helper.rb +13 -0
- data/test/rails_root/vendor/plugins/dynamic_form/init.rb +5 -0
- data/test/rails_root/vendor/plugins/dynamic_form/lib/action_view/helpers/dynamic_form.rb +300 -0
- data/test/rails_root/vendor/plugins/dynamic_form/test/dynamic_form_i18n_test.rb +42 -0
- data/test/rails_root/vendor/plugins/dynamic_form/test/dynamic_form_test.rb +370 -0
- data/test/rails_root/vendor/plugins/dynamic_form/test/test_helper.rb +9 -0
- data/test/test_helper.rb +30 -1
- metadata +104 -49
- data/VERSION +0 -1
- data/generators/clearance/USAGE +0 -1
- data/generators/clearance/clearance_generator.rb +0 -68
- data/generators/clearance/lib/insert_commands.rb +0 -33
- data/generators/clearance/lib/rake_commands.rb +0 -22
- data/generators/clearance_features/USAGE +0 -1
- data/generators/clearance_features/clearance_features_generator.rb +0 -19
- data/generators/clearance_features/templates/features/support/paths.rb +0 -23
- data/generators/clearance_views/USAGE +0 -0
- data/generators/clearance_views/clearance_views_generator.rb +0 -27
- data/lib/clearance/routes.rb +0 -49
- data/test/rails_root/app/helpers/confirmations_helper.rb +0 -2
- data/test/rails_root/app/helpers/passwords_helper.rb +0 -2
- data/test/rails_root/config/initializers/requires.rb +0 -13
- data/test/rails_root/config/initializers/time_formats.rb +0 -4
- data/test/rails_root/db/migrate/20100225210436_clearance_create_users.rb +0 -21
- data/test/rails_root/features/step_definitions/clearance_steps.rb +0 -122
- data/test/rails_root/features/step_definitions/factory_girl_steps.rb +0 -5
- data/test/rails_root/public/dispatch.rb +0 -10
- data/test/rails_root/script/create_project.rb +0 -52
- data/test/rails_root/vendor/gems/justinfrench-formtastic-0.2.1/generators/formtastic_stylesheets/formtastic_stylesheets_generator.rb +0 -21
- data/test/rails_root/vendor/gems/justinfrench-formtastic-0.2.1/lib/formtastic.rb +0 -1236
- data/test/rails_root/vendor/gems/justinfrench-formtastic-0.2.1/lib/justin_french/formtastic.rb +0 -10
- data/test/rails_root/vendor/gems/justinfrench-formtastic-0.2.1/rails/init.rb +0 -3
- data/test/rails_root/vendor/gems/justinfrench-formtastic-0.2.1/spec/formtastic_spec.rb +0 -2900
- data/test/rails_root/vendor/gems/justinfrench-formtastic-0.2.1/spec/test_helper.rb +0 -14
metadata
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clearance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 977940486
|
5
|
+
prerelease: true
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 9
|
9
|
+
- 0
|
10
|
+
- rc1
|
11
|
+
version: 0.9.0.rc1
|
5
12
|
platform: ruby
|
6
13
|
authors:
|
7
14
|
- Dan Croak
|
@@ -26,10 +33,26 @@ autorequire:
|
|
26
33
|
bindir: bin
|
27
34
|
cert_chain: []
|
28
35
|
|
29
|
-
date: 2010-
|
36
|
+
date: 2010-06-11 00:00:00 -04:00
|
30
37
|
default_executable:
|
31
|
-
dependencies:
|
32
|
-
|
38
|
+
dependencies:
|
39
|
+
- !ruby/object:Gem::Dependency
|
40
|
+
name: rails
|
41
|
+
prerelease: false
|
42
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
hash: -1848230024
|
48
|
+
segments:
|
49
|
+
- 3
|
50
|
+
- 0
|
51
|
+
- 0
|
52
|
+
- beta4
|
53
|
+
version: 3.0.0.beta4
|
54
|
+
type: :runtime
|
55
|
+
version_requirements: *id001
|
33
56
|
description: Rails authentication with email & password.
|
34
57
|
email: support@thoughtbot.com
|
35
58
|
executables: []
|
@@ -44,7 +67,6 @@ files:
|
|
44
67
|
- LICENSE
|
45
68
|
- README.md
|
46
69
|
- Rakefile
|
47
|
-
- VERSION
|
48
70
|
- app/controllers/clearance/confirmations_controller.rb
|
49
71
|
- app/controllers/clearance/passwords_controller.rb
|
50
72
|
- app/controllers/clearance/sessions_controller.rb
|
@@ -57,40 +79,71 @@ files:
|
|
57
79
|
- app/views/sessions/new.html.erb
|
58
80
|
- app/views/users/_form.html.erb
|
59
81
|
- app/views/users/new.html.erb
|
60
|
-
-
|
61
|
-
- generators/clearance/clearance_generator.rb
|
62
|
-
- generators/clearance/lib/insert_commands.rb
|
63
|
-
- generators/clearance/lib/rake_commands.rb
|
64
|
-
- generators/clearance/templates/README
|
65
|
-
- generators/clearance/templates/clearance.rb
|
66
|
-
- generators/clearance/templates/factories.rb
|
67
|
-
- generators/clearance/templates/migrations/create_users.rb
|
68
|
-
- generators/clearance/templates/migrations/update_users.rb
|
69
|
-
- generators/clearance/templates/user.rb
|
70
|
-
- generators/clearance_features/USAGE
|
71
|
-
- generators/clearance_features/clearance_features_generator.rb
|
72
|
-
- generators/clearance_features/templates/features/password_reset.feature
|
73
|
-
- generators/clearance_features/templates/features/sign_in.feature
|
74
|
-
- generators/clearance_features/templates/features/sign_out.feature
|
75
|
-
- generators/clearance_features/templates/features/sign_up.feature
|
76
|
-
- generators/clearance_features/templates/features/step_definitions/clearance_steps.rb
|
77
|
-
- generators/clearance_features/templates/features/support/paths.rb
|
78
|
-
- generators/clearance_views/USAGE
|
79
|
-
- generators/clearance_views/clearance_views_generator.rb
|
80
|
-
- generators/clearance_views/templates/formtastic/passwords/edit.html.erb
|
81
|
-
- generators/clearance_views/templates/formtastic/passwords/new.html.erb
|
82
|
-
- generators/clearance_views/templates/formtastic/sessions/new.html.erb
|
83
|
-
- generators/clearance_views/templates/formtastic/users/_inputs.html.erb
|
84
|
-
- generators/clearance_views/templates/formtastic/users/new.html.erb
|
82
|
+
- config/routes.rb
|
85
83
|
- lib/clearance.rb
|
86
84
|
- lib/clearance/authentication.rb
|
87
85
|
- lib/clearance/configuration.rb
|
86
|
+
- lib/clearance/engine.rb
|
88
87
|
- lib/clearance/extensions/errors.rb
|
89
88
|
- lib/clearance/extensions/rescue.rb
|
90
|
-
- lib/clearance/routes.rb
|
91
89
|
- lib/clearance/user.rb
|
90
|
+
- lib/rails/generators/clearance_features_generator.rb
|
91
|
+
- lib/rails/generators/clearance_features_templates/features/password_reset.feature
|
92
|
+
- lib/rails/generators/clearance_features_templates/features/sign_in.feature
|
93
|
+
- lib/rails/generators/clearance_features_templates/features/sign_out.feature
|
94
|
+
- lib/rails/generators/clearance_features_templates/features/sign_up.feature
|
95
|
+
- lib/rails/generators/clearance_features_templates/features/step_definitions/clearance_steps.rb
|
96
|
+
- lib/rails/generators/clearance_generator.rb
|
97
|
+
- lib/rails/generators/clearance_templates/README
|
98
|
+
- lib/rails/generators/clearance_templates/clearance.rb
|
99
|
+
- lib/rails/generators/clearance_templates/factories.rb
|
100
|
+
- lib/rails/generators/clearance_templates/migrations/create_users.rb
|
101
|
+
- lib/rails/generators/clearance_templates/migrations/update_users.rb
|
102
|
+
- lib/rails/generators/clearance_templates/user.rb
|
103
|
+
- lib/rails/generators/clearance_views_generator.rb
|
104
|
+
- lib/rails/generators/clearance_views_templates/formtastic/erb/passwords/edit.html.erb
|
105
|
+
- lib/rails/generators/clearance_views_templates/formtastic/erb/passwords/new.html.erb
|
106
|
+
- lib/rails/generators/clearance_views_templates/formtastic/erb/sessions/new.html.erb
|
107
|
+
- lib/rails/generators/clearance_views_templates/formtastic/erb/users/_inputs.html.erb
|
108
|
+
- lib/rails/generators/clearance_views_templates/formtastic/erb/users/new.html.erb
|
92
109
|
- rails/init.rb
|
93
110
|
- shoulda_macros/clearance.rb
|
111
|
+
- test/controllers/confirmations_controller_test.rb
|
112
|
+
- test/controllers/passwords_controller_test.rb
|
113
|
+
- test/controllers/sessions_controller_test.rb
|
114
|
+
- test/controllers/users_controller_test.rb
|
115
|
+
- test/models/clearance_mailer_test.rb
|
116
|
+
- test/models/user_test.rb
|
117
|
+
- test/rails_root/app/controllers/accounts_controller.rb
|
118
|
+
- test/rails_root/app/controllers/application_controller.rb
|
119
|
+
- test/rails_root/app/helpers/application_helper.rb
|
120
|
+
- test/rails_root/app/models/user.rb
|
121
|
+
- test/rails_root/config/application.rb
|
122
|
+
- test/rails_root/config/boot.rb
|
123
|
+
- test/rails_root/config/environment.rb
|
124
|
+
- test/rails_root/config/environments/development.rb
|
125
|
+
- test/rails_root/config/environments/production.rb
|
126
|
+
- test/rails_root/config/environments/test.rb
|
127
|
+
- test/rails_root/config/initializers/backtrace_silencers.rb
|
128
|
+
- test/rails_root/config/initializers/clearance.rb
|
129
|
+
- test/rails_root/config/initializers/inflections.rb
|
130
|
+
- test/rails_root/config/initializers/mime_types.rb
|
131
|
+
- test/rails_root/config/initializers/secret_token.rb
|
132
|
+
- test/rails_root/config/initializers/session_store.rb
|
133
|
+
- test/rails_root/config/routes.rb
|
134
|
+
- test/rails_root/features/step_definitions/web_steps.rb
|
135
|
+
- test/rails_root/features/support/env.rb
|
136
|
+
- test/rails_root/features/support/paths.rb
|
137
|
+
- test/rails_root/test/factories/clearance.rb
|
138
|
+
- test/rails_root/test/functional/accounts_controller_test.rb
|
139
|
+
- test/rails_root/test/performance/browsing_test.rb
|
140
|
+
- test/rails_root/test/test_helper.rb
|
141
|
+
- test/rails_root/vendor/plugins/dynamic_form/init.rb
|
142
|
+
- test/rails_root/vendor/plugins/dynamic_form/lib/action_view/helpers/dynamic_form.rb
|
143
|
+
- test/rails_root/vendor/plugins/dynamic_form/test/dynamic_form_i18n_test.rb
|
144
|
+
- test/rails_root/vendor/plugins/dynamic_form/test/dynamic_form_test.rb
|
145
|
+
- test/rails_root/vendor/plugins/dynamic_form/test/test_helper.rb
|
146
|
+
- test/test_helper.rb
|
94
147
|
has_rdoc: true
|
95
148
|
homepage: http://github.com/thoughtbot/clearance
|
96
149
|
licenses: []
|
@@ -101,21 +154,27 @@ rdoc_options:
|
|
101
154
|
require_paths:
|
102
155
|
- lib
|
103
156
|
required_ruby_version: !ruby/object:Gem::Requirement
|
157
|
+
none: false
|
104
158
|
requirements:
|
105
159
|
- - ">="
|
106
160
|
- !ruby/object:Gem::Version
|
161
|
+
hash: 3
|
162
|
+
segments:
|
163
|
+
- 0
|
107
164
|
version: "0"
|
108
|
-
version:
|
109
165
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
|
+
none: false
|
110
167
|
requirements:
|
111
168
|
- - ">="
|
112
169
|
- !ruby/object:Gem::Version
|
170
|
+
hash: 3
|
171
|
+
segments:
|
172
|
+
- 0
|
113
173
|
version: "0"
|
114
|
-
version:
|
115
174
|
requirements: []
|
116
175
|
|
117
176
|
rubyforge_project:
|
118
|
-
rubygems_version: 1.3.
|
177
|
+
rubygems_version: 1.3.7
|
119
178
|
signing_key:
|
120
179
|
specification_version: 3
|
121
180
|
summary: Rails authentication with email & password.
|
@@ -129,34 +188,30 @@ test_files:
|
|
129
188
|
- test/rails_root/app/controllers/accounts_controller.rb
|
130
189
|
- test/rails_root/app/controllers/application_controller.rb
|
131
190
|
- test/rails_root/app/helpers/application_helper.rb
|
132
|
-
- test/rails_root/app/helpers/confirmations_helper.rb
|
133
|
-
- test/rails_root/app/helpers/passwords_helper.rb
|
134
191
|
- test/rails_root/app/models/user.rb
|
192
|
+
- test/rails_root/config/application.rb
|
135
193
|
- test/rails_root/config/boot.rb
|
136
194
|
- test/rails_root/config/environment.rb
|
137
195
|
- test/rails_root/config/environments/development.rb
|
138
196
|
- test/rails_root/config/environments/production.rb
|
139
197
|
- test/rails_root/config/environments/test.rb
|
198
|
+
- test/rails_root/config/initializers/backtrace_silencers.rb
|
140
199
|
- test/rails_root/config/initializers/clearance.rb
|
141
200
|
- test/rails_root/config/initializers/inflections.rb
|
142
201
|
- test/rails_root/config/initializers/mime_types.rb
|
143
|
-
- test/rails_root/config/initializers/
|
144
|
-
- test/rails_root/config/initializers/
|
202
|
+
- test/rails_root/config/initializers/secret_token.rb
|
203
|
+
- test/rails_root/config/initializers/session_store.rb
|
145
204
|
- test/rails_root/config/routes.rb
|
146
|
-
- test/rails_root/db/migrate/20100225210436_clearance_create_users.rb
|
147
|
-
- test/rails_root/features/step_definitions/clearance_steps.rb
|
148
|
-
- test/rails_root/features/step_definitions/factory_girl_steps.rb
|
149
205
|
- test/rails_root/features/step_definitions/web_steps.rb
|
150
206
|
- test/rails_root/features/support/env.rb
|
151
207
|
- test/rails_root/features/support/paths.rb
|
152
|
-
- test/rails_root/public/dispatch.rb
|
153
|
-
- test/rails_root/script/create_project.rb
|
154
208
|
- test/rails_root/test/factories/clearance.rb
|
155
209
|
- test/rails_root/test/functional/accounts_controller_test.rb
|
156
|
-
- test/rails_root/
|
157
|
-
- test/rails_root/
|
158
|
-
- test/rails_root/vendor/
|
159
|
-
- test/rails_root/vendor/
|
160
|
-
- test/rails_root/vendor/
|
161
|
-
- test/rails_root/vendor/
|
210
|
+
- test/rails_root/test/performance/browsing_test.rb
|
211
|
+
- test/rails_root/test/test_helper.rb
|
212
|
+
- test/rails_root/vendor/plugins/dynamic_form/init.rb
|
213
|
+
- test/rails_root/vendor/plugins/dynamic_form/lib/action_view/helpers/dynamic_form.rb
|
214
|
+
- test/rails_root/vendor/plugins/dynamic_form/test/dynamic_form_i18n_test.rb
|
215
|
+
- test/rails_root/vendor/plugins/dynamic_form/test/dynamic_form_test.rb
|
216
|
+
- test/rails_root/vendor/plugins/dynamic_form/test/test_helper.rb
|
162
217
|
- test/test_helper.rb
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.8.8
|
data/generators/clearance/USAGE
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
script/generate clearance
|
@@ -1,68 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + "/lib/insert_commands.rb")
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + "/lib/rake_commands.rb")
|
3
|
-
|
4
|
-
class ClearanceGenerator < Rails::Generator::Base
|
5
|
-
|
6
|
-
def manifest
|
7
|
-
record do |m|
|
8
|
-
m.directory File.join("config", "initializers")
|
9
|
-
m.file "clearance.rb", "config/initializers/clearance.rb"
|
10
|
-
|
11
|
-
m.insert_into "app/controllers/application_controller.rb",
|
12
|
-
"include Clearance::Authentication"
|
13
|
-
|
14
|
-
user_model = "app/models/user.rb"
|
15
|
-
if File.exists?(user_model)
|
16
|
-
m.insert_into user_model, "include Clearance::User"
|
17
|
-
else
|
18
|
-
m.directory File.join("app", "models")
|
19
|
-
m.file "user.rb", user_model
|
20
|
-
end
|
21
|
-
|
22
|
-
m.insert_into "config/routes.rb",
|
23
|
-
"Clearance::Routes.draw(map)"
|
24
|
-
|
25
|
-
m.directory File.join("test", "factories")
|
26
|
-
m.file "factories.rb", "test/factories/clearance.rb"
|
27
|
-
|
28
|
-
m.migration_template "migrations/#{migration_source_name}.rb",
|
29
|
-
'db/migrate',
|
30
|
-
:migration_file_name => "clearance_#{migration_target_name}"
|
31
|
-
|
32
|
-
m.readme "README"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def schema_version_constant
|
37
|
-
if upgrading_clearance_again?
|
38
|
-
"To#{schema_version.gsub('_', '')}"
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
private
|
43
|
-
|
44
|
-
def migration_source_name
|
45
|
-
if ActiveRecord::Base.connection.table_exists?(:users)
|
46
|
-
'update_users'
|
47
|
-
else
|
48
|
-
'create_users'
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def migration_target_name
|
53
|
-
if upgrading_clearance_again?
|
54
|
-
"update_users_to_#{schema_version}"
|
55
|
-
else
|
56
|
-
'create_users'
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def schema_version
|
61
|
-
IO.read(File.join(File.dirname(__FILE__), '..', '..', 'VERSION')).strip.gsub(/[^\d]/, '_')
|
62
|
-
end
|
63
|
-
|
64
|
-
def upgrading_clearance_again?
|
65
|
-
ActiveRecord::Base.connection.table_exists?(:users)
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# Mostly pinched from http://github.com/ryanb/nifty-generators/tree/master
|
2
|
-
|
3
|
-
Rails::Generator::Commands::Base.class_eval do
|
4
|
-
def file_contains?(relative_destination, line)
|
5
|
-
File.read(destination_path(relative_destination)).include?(line)
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
Rails::Generator::Commands::Create.class_eval do
|
10
|
-
def insert_into(file, line)
|
11
|
-
logger.insert "#{line} into #{file}"
|
12
|
-
unless options[:pretend] || file_contains?(file, line)
|
13
|
-
gsub_file file, /^(class|module|.*Routes).*$/ do |match|
|
14
|
-
"#{match}\n #{line}"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
Rails::Generator::Commands::Destroy.class_eval do
|
21
|
-
def insert_into(file, line)
|
22
|
-
logger.remove "#{line} from #{file}"
|
23
|
-
unless options[:pretend]
|
24
|
-
gsub_file file, "\n #{line}", ''
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
Rails::Generator::Commands::List.class_eval do
|
30
|
-
def insert_into(file, line)
|
31
|
-
logger.insert "#{line} into #{file}"
|
32
|
-
end
|
33
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
Rails::Generator::Commands::Create.class_eval do
|
2
|
-
def rake_db_migrate
|
3
|
-
logger.rake "db:migrate"
|
4
|
-
unless system("rake db:migrate")
|
5
|
-
logger.rake "db:migrate failed. Rolling back"
|
6
|
-
command(:destroy).invoke!
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
Rails::Generator::Commands::Destroy.class_eval do
|
12
|
-
def rake_db_migrate
|
13
|
-
logger.rake "db:rollback"
|
14
|
-
system "rake db:rollback"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
Rails::Generator::Commands::List.class_eval do
|
19
|
-
def rake_db_migrate
|
20
|
-
logger.rake "db:migrate"
|
21
|
-
end
|
22
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
script/generate clearance_features
|
@@ -1,19 +0,0 @@
|
|
1
|
-
class ClearanceFeaturesGenerator < Rails::Generator::Base
|
2
|
-
|
3
|
-
def manifest
|
4
|
-
record do |m|
|
5
|
-
m.directory File.join("features", "step_definitions")
|
6
|
-
m.directory File.join("features", "support")
|
7
|
-
|
8
|
-
["features/step_definitions/clearance_steps.rb",
|
9
|
-
"features/support/paths.rb",
|
10
|
-
"features/sign_in.feature",
|
11
|
-
"features/sign_out.feature",
|
12
|
-
"features/sign_up.feature",
|
13
|
-
"features/password_reset.feature"].each do |file|
|
14
|
-
m.file file, file
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module NavigationHelpers
|
2
|
-
def path_to(page_name)
|
3
|
-
case page_name
|
4
|
-
|
5
|
-
when /the home\s?page/
|
6
|
-
'/'
|
7
|
-
when /the sign up page/i
|
8
|
-
sign_up_path
|
9
|
-
when /the sign in page/i
|
10
|
-
sign_in_path
|
11
|
-
when /the password reset request page/i
|
12
|
-
new_password_path
|
13
|
-
|
14
|
-
# Add more page name => path mappings here
|
15
|
-
|
16
|
-
else
|
17
|
-
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
18
|
-
"Now, go and add a mapping in #{__FILE__}"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
World(NavigationHelpers)
|
File without changes
|
@@ -1,27 +0,0 @@
|
|
1
|
-
class ClearanceViewsGenerator < Rails::Generator::Base
|
2
|
-
|
3
|
-
def manifest
|
4
|
-
record do |m|
|
5
|
-
strategy = "formtastic"
|
6
|
-
template_strategy = "erb"
|
7
|
-
|
8
|
-
m.directory File.join("app", "views", "users")
|
9
|
-
m.file "#{strategy}/users/new.html.#{template_strategy}",
|
10
|
-
"app/views/users/new.html.#{template_strategy}"
|
11
|
-
m.file "#{strategy}/users/_inputs.html.#{template_strategy}",
|
12
|
-
"app/views/users/_inputs.html.#{template_strategy}"
|
13
|
-
|
14
|
-
m.directory File.join("app", "views", "sessions")
|
15
|
-
m.file "#{strategy}/sessions/new.html.#{template_strategy}",
|
16
|
-
"app/views/sessions/new.html.#{template_strategy}"
|
17
|
-
|
18
|
-
m.directory File.join("app", "views", "passwords")
|
19
|
-
m.file "#{strategy}/passwords/new.html.#{template_strategy}",
|
20
|
-
"app/views/passwords/new.html.#{template_strategy}"
|
21
|
-
m.file "#{strategy}/passwords/edit.html.#{template_strategy}",
|
22
|
-
"app/views/passwords/edit.html.#{template_strategy}"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
|
data/lib/clearance/routes.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
module Clearance
|
2
|
-
class Routes
|
3
|
-
|
4
|
-
# In your application's config/routes.rb, draw Clearance's routes:
|
5
|
-
#
|
6
|
-
# @example
|
7
|
-
# map.resources :posts
|
8
|
-
# Clearance::Routes.draw(map)
|
9
|
-
#
|
10
|
-
# If you need to override a Clearance route, invoke your app route
|
11
|
-
# earlier in the file so Rails' router short-circuits when it finds
|
12
|
-
# your route:
|
13
|
-
#
|
14
|
-
# @example
|
15
|
-
# map.resources :users, :only => [:new, :create]
|
16
|
-
# Clearance::Routes.draw(map)
|
17
|
-
def self.draw(map)
|
18
|
-
map.resources :passwords,
|
19
|
-
:controller => 'clearance/passwords',
|
20
|
-
:only => [:new, :create]
|
21
|
-
|
22
|
-
map.resource :session,
|
23
|
-
:controller => 'clearance/sessions',
|
24
|
-
:only => [:new, :create, :destroy]
|
25
|
-
|
26
|
-
map.resources :users, :controller => 'clearance/users' do |users|
|
27
|
-
users.resource :password,
|
28
|
-
:controller => 'clearance/passwords',
|
29
|
-
:only => [:create, :edit, :update]
|
30
|
-
|
31
|
-
users.resource :confirmation,
|
32
|
-
:controller => 'clearance/confirmations',
|
33
|
-
:only => [:new, :create]
|
34
|
-
end
|
35
|
-
|
36
|
-
map.sign_up 'sign_up',
|
37
|
-
:controller => 'clearance/users',
|
38
|
-
:action => 'new'
|
39
|
-
map.sign_in 'sign_in',
|
40
|
-
:controller => 'clearance/sessions',
|
41
|
-
:action => 'new'
|
42
|
-
map.sign_out 'sign_out',
|
43
|
-
:controller => 'clearance/sessions',
|
44
|
-
:action => 'destroy',
|
45
|
-
:method => :delete
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
end
|