thoughtbot-clearance 0.2.2 → 0.2.3
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/README.textile +41 -21
- data/Rakefile +0 -1
- data/TODO.textile +2 -1
- data/generators/clearance/clearance_generator.rb +13 -9
- data/generators/clearance/templates/test/factories.rb +9 -0
- data/lib/clearance/version.rb +1 -1
- metadata +2 -1
data/README.textile
CHANGED
@@ -92,27 +92,47 @@ In app/controllers/application_controller.rb:
|
|
92
92
|
include Clearance::ApplicationController
|
93
93
|
end
|
94
94
|
|
95
|
-
h2.
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
95
|
+
h2. Migration
|
96
|
+
|
97
|
+
Your users table needs a few columns.
|
98
|
+
|
99
|
+
create_table(:users) do |t|
|
100
|
+
t.string :email
|
101
|
+
t.string :crypted_password, :limit => 40
|
102
|
+
t.string :salt, :limit => 40
|
103
|
+
t.string :remember_token
|
104
|
+
t.datetime :remember_token_expires_at
|
105
|
+
t.boolean :confirmed, :default => false, :null => false
|
106
|
+
end
|
107
|
+
|
108
|
+
add_index :users, [:email, :crypted_password]
|
109
|
+
|
110
|
+
h2. Routes
|
111
|
+
|
112
|
+
ActionController::Routing::Routes.draw do |map|
|
113
|
+
|
114
|
+
map.resources :users
|
115
|
+
map.resource :session
|
116
|
+
|
117
|
+
map.resources :users, :has_one => :password
|
118
|
+
map.resources :users, :has_one => :confirmation
|
119
|
+
|
120
|
+
map.resources :passwords
|
121
|
+
|
122
|
+
map.root :controller => 'sessions', :action => 'new'
|
123
|
+
|
124
|
+
map.with_options :controller => 'sessions' do |m|
|
125
|
+
m.login '/login', :action => 'new'
|
126
|
+
m.logout '/logout', :action => 'destroy'
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
|
131
|
+
h2. Environments
|
132
|
+
|
133
|
+
In config/environments/test.rb and config/environments/development.rb:
|
134
|
+
|
135
|
+
HOST = "localhost"
|
116
136
|
|
117
137
|
h2. Authors
|
118
138
|
|
data/Rakefile
CHANGED
data/TODO.textile
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
(this is in order of highest priority first)
|
2
2
|
|
3
|
-
#
|
3
|
+
# force email confirmation by default
|
4
4
|
# sessions controller test is missing some tests
|
5
5
|
# mailers should not hardcode example.com as from address
|
6
6
|
# check to make sure attr_accessible doesn't override and w/ attr_protected
|
7
7
|
# helpers and tests shouldn't depend on login/logout routes
|
8
8
|
# move shoulda macros in test_helper to shoulda_macros folder
|
9
|
+
# add shoulda and factory girl dependencies to gemspec
|
9
10
|
# refactor Mailer default_url_options[:host] to something cleaner
|
10
11
|
|
11
12
|
ideas stolen from merb-auth:
|
@@ -2,7 +2,7 @@ class ClearanceGenerator < Rails::Generator::Base
|
|
2
2
|
|
3
3
|
def manifest
|
4
4
|
record do |m|
|
5
|
-
|
5
|
+
m.directory File.join("app", "controllers")
|
6
6
|
["app/controllers/confirmations_controller.rb",
|
7
7
|
"app/controllers/passwords_controller.rb",
|
8
8
|
"app/controllers/sessions_controller.rb",
|
@@ -10,43 +10,43 @@ class ClearanceGenerator < Rails::Generator::Base
|
|
10
10
|
m.file file, file
|
11
11
|
end
|
12
12
|
|
13
|
-
|
13
|
+
m.directory File.join("app", "models")
|
14
14
|
["app/models/user.rb",
|
15
15
|
"app/models/user_mailer.rb"].each do |file|
|
16
16
|
m.file file, file
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
m.directory File.join("app", "views")
|
20
20
|
system `mkdir app/views/confirmations`
|
21
21
|
["app/views/confirmations/new.html.erb"].each do |file|
|
22
22
|
m.file file, file
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
m.directory File.join("app", "views", "passwords")
|
26
26
|
["app/views/passwords/new.html.erb",
|
27
27
|
"app/views/passwords/edit.html.erb"].each do |file|
|
28
28
|
m.file file, file
|
29
29
|
end
|
30
30
|
|
31
|
-
|
31
|
+
m.directory File.join("app", "views", "sessions")
|
32
32
|
["app/views/sessions/new.html.erb"].each do |file|
|
33
33
|
m.file file, file
|
34
34
|
end
|
35
35
|
|
36
|
-
|
36
|
+
m.directory File.join("app", "views", "user_mailer")
|
37
37
|
["app/views/user_mailer/change_password.html.erb",
|
38
38
|
"app/views/user_mailer/confirmation.html.erb"].each do |file|
|
39
39
|
m.file file, file
|
40
40
|
end
|
41
41
|
|
42
|
-
|
42
|
+
m.directory File.join("app", "views", "users")
|
43
43
|
["app/views/users/_form.html.erb",
|
44
44
|
"app/views/users/edit.html.erb",
|
45
45
|
"app/views/users/new.html.erb"].each do |file|
|
46
46
|
m.file file, file
|
47
47
|
end
|
48
48
|
|
49
|
-
|
49
|
+
m.directory File.join("test", "functional")
|
50
50
|
["test/functional/confirmations_controller_test.rb",
|
51
51
|
"test/functional/passwords_controller_test.rb",
|
52
52
|
"test/functional/sessions_controller_test.rb",
|
@@ -54,11 +54,15 @@ class ClearanceGenerator < Rails::Generator::Base
|
|
54
54
|
m.file file, file
|
55
55
|
end
|
56
56
|
|
57
|
-
|
57
|
+
m.directory File.join("test", "unit")
|
58
58
|
["test/unit/user_mailer_test.rb",
|
59
59
|
"test/unit/user_test.rb"].each do |file|
|
60
60
|
m.file file, file
|
61
61
|
end
|
62
|
+
|
63
|
+
["test/factories.rb"].each do |file|
|
64
|
+
m.file file, file
|
65
|
+
end
|
62
66
|
end
|
63
67
|
end
|
64
68
|
|
data/lib/clearance/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thoughtbot-clearance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thoughtbot, inc.
|
@@ -58,6 +58,7 @@ files:
|
|
58
58
|
- generators/clearance/templates/app/views/users/edit.html.erb
|
59
59
|
- generators/clearance/templates/app/views/users/new.html.erb
|
60
60
|
- generators/clearance/templates/test
|
61
|
+
- generators/clearance/templates/test/factories.rb
|
61
62
|
- generators/clearance/templates/test/functional
|
62
63
|
- generators/clearance/templates/test/functional/confirmations_controller_test.rb
|
63
64
|
- generators/clearance/templates/test/functional/passwords_controller_test.rb
|