nifty-generators-improved 0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +198 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +111 -0
- data/LICENSE +20 -0
- data/README.rdoc +109 -0
- data/Rakefile +10 -0
- data/features/nifty_authentication.feature +80 -0
- data/features/nifty_config.feature +17 -0
- data/features/nifty_layout.feature +20 -0
- data/features/nifty_scaffold.feature +80 -0
- data/features/step_definitions/common_steps.rb +62 -0
- data/features/step_definitions/rails_setup_steps.rb +6 -0
- data/features/support/env.rb +6 -0
- data/features/support/matchers.rb +7 -0
- data/lib/generators/nifty.rb +28 -0
- data/lib/generators/nifty/authentication/USAGE +50 -0
- data/lib/generators/nifty/authentication/authentication_generator.rb +154 -0
- data/lib/generators/nifty/authentication/templates/authlogic_session.rb +2 -0
- data/lib/generators/nifty/authentication/templates/controller_authentication.rb +60 -0
- data/lib/generators/nifty/authentication/templates/fixtures.yml +24 -0
- data/lib/generators/nifty/authentication/templates/migration.rb +20 -0
- data/lib/generators/nifty/authentication/templates/sessions_controller.rb +41 -0
- data/lib/generators/nifty/authentication/templates/sessions_helper.rb +2 -0
- data/lib/generators/nifty/authentication/templates/tests/rspec/sessions_controller.rb +39 -0
- data/lib/generators/nifty/authentication/templates/tests/rspec/user.rb +83 -0
- data/lib/generators/nifty/authentication/templates/tests/rspec/users_controller.rb +56 -0
- data/lib/generators/nifty/authentication/templates/tests/shoulda/sessions_controller.rb +40 -0
- data/lib/generators/nifty/authentication/templates/tests/shoulda/user.rb +85 -0
- data/lib/generators/nifty/authentication/templates/tests/shoulda/users_controller.rb +61 -0
- data/lib/generators/nifty/authentication/templates/tests/testunit/sessions_controller.rb +36 -0
- data/lib/generators/nifty/authentication/templates/tests/testunit/user.rb +88 -0
- data/lib/generators/nifty/authentication/templates/tests/testunit/users_controller.rb +53 -0
- data/lib/generators/nifty/authentication/templates/user.rb +38 -0
- data/lib/generators/nifty/authentication/templates/users_controller.rb +32 -0
- data/lib/generators/nifty/authentication/templates/users_helper.rb +2 -0
- data/lib/generators/nifty/authentication/templates/views/erb/_form.html.erb +20 -0
- data/lib/generators/nifty/authentication/templates/views/erb/edit.html.erb +3 -0
- data/lib/generators/nifty/authentication/templates/views/erb/login.html.erb +30 -0
- data/lib/generators/nifty/authentication/templates/views/erb/signup.html.erb +5 -0
- data/lib/generators/nifty/authentication/templates/views/haml/_form.html.haml +16 -0
- data/lib/generators/nifty/authentication/templates/views/haml/edit.html.haml +3 -0
- data/lib/generators/nifty/authentication/templates/views/haml/login.html.haml +26 -0
- data/lib/generators/nifty/authentication/templates/views/haml/signup.html.haml +5 -0
- data/lib/generators/nifty/config/USAGE +23 -0
- data/lib/generators/nifty/config/config_generator.rb +24 -0
- data/lib/generators/nifty/config/templates/config.yml +8 -0
- data/lib/generators/nifty/config/templates/load_config.rb +2 -0
- data/lib/generators/nifty/layout/USAGE +25 -0
- data/lib/generators/nifty/layout/layout_generator.rb +29 -0
- data/lib/generators/nifty/layout/templates/error_messages_helper.rb +23 -0
- data/lib/generators/nifty/layout/templates/layout.html.erb +19 -0
- data/lib/generators/nifty/layout/templates/layout.html.haml +17 -0
- data/lib/generators/nifty/layout/templates/layout_helper.rb +17 -0
- data/lib/generators/nifty/layout/templates/stylesheet.css +83 -0
- data/lib/generators/nifty/layout/templates/stylesheet.css.scss +88 -0
- data/lib/generators/nifty/scaffold/USAGE +51 -0
- data/lib/generators/nifty/scaffold/scaffold_generator.rb +318 -0
- data/lib/generators/nifty/scaffold/templates/actions/create.rb +8 -0
- data/lib/generators/nifty/scaffold/templates/actions/destroy.rb +5 -0
- data/lib/generators/nifty/scaffold/templates/actions/edit.rb +3 -0
- data/lib/generators/nifty/scaffold/templates/actions/index.rb +3 -0
- data/lib/generators/nifty/scaffold/templates/actions/new.rb +3 -0
- data/lib/generators/nifty/scaffold/templates/actions/show.rb +3 -0
- data/lib/generators/nifty/scaffold/templates/actions/update.rb +8 -0
- data/lib/generators/nifty/scaffold/templates/controller.rb +3 -0
- data/lib/generators/nifty/scaffold/templates/fixtures.yml +9 -0
- data/lib/generators/nifty/scaffold/templates/helper.rb +2 -0
- data/lib/generators/nifty/scaffold/templates/migration.rb +16 -0
- data/lib/generators/nifty/scaffold/templates/model.rb +4 -0
- data/lib/generators/nifty/scaffold/templates/tests/rspec/actions/create.rb +11 -0
- data/lib/generators/nifty/scaffold/templates/tests/rspec/actions/destroy.rb +6 -0
- data/lib/generators/nifty/scaffold/templates/tests/rspec/actions/edit.rb +4 -0
- data/lib/generators/nifty/scaffold/templates/tests/rspec/actions/index.rb +4 -0
- data/lib/generators/nifty/scaffold/templates/tests/rspec/actions/new.rb +4 -0
- data/lib/generators/nifty/scaffold/templates/tests/rspec/actions/show.rb +4 -0
- data/lib/generators/nifty/scaffold/templates/tests/rspec/actions/update.rb +11 -0
- data/lib/generators/nifty/scaffold/templates/tests/rspec/controller.rb +8 -0
- data/lib/generators/nifty/scaffold/templates/tests/rspec/model.rb +7 -0
- data/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/create.rb +13 -0
- data/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/destroy.rb +8 -0
- data/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/edit.rb +6 -0
- data/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/index.rb +6 -0
- data/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/new.rb +6 -0
- data/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/show.rb +6 -0
- data/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/update.rb +13 -0
- data/lib/generators/nifty/scaffold/templates/tests/shoulda/controller.rb +5 -0
- data/lib/generators/nifty/scaffold/templates/tests/shoulda/model.rb +7 -0
- data/lib/generators/nifty/scaffold/templates/tests/testunit/actions/create.rb +11 -0
- data/lib/generators/nifty/scaffold/templates/tests/testunit/actions/destroy.rb +6 -0
- data/lib/generators/nifty/scaffold/templates/tests/testunit/actions/edit.rb +4 -0
- data/lib/generators/nifty/scaffold/templates/tests/testunit/actions/index.rb +4 -0
- data/lib/generators/nifty/scaffold/templates/tests/testunit/actions/new.rb +4 -0
- data/lib/generators/nifty/scaffold/templates/tests/testunit/actions/show.rb +4 -0
- data/lib/generators/nifty/scaffold/templates/tests/testunit/actions/update.rb +11 -0
- data/lib/generators/nifty/scaffold/templates/tests/testunit/controller.rb +5 -0
- data/lib/generators/nifty/scaffold/templates/tests/testunit/model.rb +7 -0
- data/lib/generators/nifty/scaffold/templates/views/erb/_form.html.erb +10 -0
- data/lib/generators/nifty/scaffold/templates/views/erb/edit.html.erb +14 -0
- data/lib/generators/nifty/scaffold/templates/views/erb/index.html.erb +29 -0
- data/lib/generators/nifty/scaffold/templates/views/erb/new.html.erb +7 -0
- data/lib/generators/nifty/scaffold/templates/views/erb/show.html.erb +20 -0
- data/lib/generators/nifty/scaffold/templates/views/haml/_form.html.haml +9 -0
- data/lib/generators/nifty/scaffold/templates/views/haml/edit.html.haml +14 -0
- data/lib/generators/nifty/scaffold/templates/views/haml/index.html.haml +25 -0
- data/lib/generators/nifty/scaffold/templates/views/haml/new.html.haml +7 -0
- data/lib/generators/nifty/scaffold/templates/views/haml/show.html.haml +20 -0
- data/test/test_helper.rb +119 -0
- data/test/test_nifty_authentication_generator.rb +274 -0
- data/test/test_nifty_config_generator.rb +37 -0
- data/test/test_nifty_layout_generator.rb +42 -0
- data/test/test_nifty_scaffold_generator.rb +534 -0
- metadata +231 -0
data/CHANGELOG
ADDED
@@ -0,0 +1,198 @@
|
|
1
|
+
0.4.6 (March 26, 2011)
|
2
|
+
|
3
|
+
* fixing form block in HAML (thanks apocalyptiq)
|
4
|
+
|
5
|
+
* fixing instance variable setting in HAML (thanks nhocki)
|
6
|
+
|
7
|
+
|
8
|
+
0.4.5 (February 14, 2011)
|
9
|
+
|
10
|
+
* fixing user validation tests in nifty:authentication (thanks apocalyptiq) - issue #87
|
11
|
+
|
12
|
+
* fixing form generation when only new action exists for nifty scaffold (thanks gouravtiwari) - issue #83
|
13
|
+
|
14
|
+
* fixing spacing issue in nifty:scaffold model
|
15
|
+
|
16
|
+
* fixing instance instance variable in haml form for nifty:scaffold - issue #81
|
17
|
+
|
18
|
+
* improving redirect implementation in nifty authentication
|
19
|
+
|
20
|
+
* adding i18n to error_messages_for in nifty:layout (thanks nhocki)
|
21
|
+
|
22
|
+
|
23
|
+
0.4.4 (January 17, 2011)
|
24
|
+
|
25
|
+
* adding namespaces to nifty:scaffold (thanks DouglasMeyer) - issue #63
|
26
|
+
|
27
|
+
* adding .rvmrc file
|
28
|
+
|
29
|
+
|
30
|
+
0.4.3 (December 28, 2010)
|
31
|
+
|
32
|
+
* display usage documentation when given an invalid model name with nifty:scaffold - issue #76
|
33
|
+
|
34
|
+
* add newline when necessary to Gemfile before adding gem - issue #64
|
35
|
+
|
36
|
+
* remove extra whitespace between controller methods in nifty:scaffold - issue #62
|
37
|
+
|
38
|
+
* renaming edit_user route to edit_current_user - issue #59
|
39
|
+
|
40
|
+
* HAML template improvements (thanks IamNaN) - issue #71
|
41
|
+
|
42
|
+
|
43
|
+
0.4.2 (October 15, 2010)
|
44
|
+
|
45
|
+
* adding mocha to Gemfile automatically if it's not there already
|
46
|
+
|
47
|
+
* switching to BCrypt for user password encryption on nifty:authentication - issue #53
|
48
|
+
|
49
|
+
* adding Gemfile, now just run "bunde" and "rake" to get cucumber features running - issue #56
|
50
|
+
|
51
|
+
* renaming Authentication module to ControllerAuthentication to avoid conflicts in nifty:authentication - issue #57
|
52
|
+
|
53
|
+
* automatically use RSpec when there's a spec directory - issue #50
|
54
|
+
|
55
|
+
* escaping page title in layout helper (thanks cbmeeks) - issue #52
|
56
|
+
|
57
|
+
* adding edit profile page to nifty:authentication - closes #54
|
58
|
+
|
59
|
+
|
60
|
+
0.4.1 (September 23rd, 2010)
|
61
|
+
|
62
|
+
* fixing frozen hash error when not passing additional arguments to nifty:scaffold - issue #35
|
63
|
+
|
64
|
+
* fixing rendering of default title in nifty:layout - issue #36
|
65
|
+
|
66
|
+
* fixing integrate_views error in nifty:scaffold specs - issue #43
|
67
|
+
|
68
|
+
* updating SASS syntax (thanks semaperepelitsa) - issue #46
|
69
|
+
|
70
|
+
|
71
|
+
0.4.0 (April 19th, 2010)
|
72
|
+
|
73
|
+
* adding error_messages_for and f.error_messages helper for Rails 3 nifty:layout
|
74
|
+
|
75
|
+
* adding initial Rails 3 support (thanks Henrik Hodne)
|
76
|
+
|
77
|
+
* adding xmlns to <head> element in nifty_layout
|
78
|
+
|
79
|
+
|
80
|
+
0.3.2 (February 16th, 2010)
|
81
|
+
|
82
|
+
* Including all files in gem, was missing files in rails_generator directory
|
83
|
+
|
84
|
+
|
85
|
+
0.3.1 (February 16th, 2010)
|
86
|
+
|
87
|
+
* improving documentation
|
88
|
+
|
89
|
+
* fixing name of generated session model for authlogic in nifty_authorization
|
90
|
+
|
91
|
+
* use "username" instead of "login" for authlogic haml form template in nifty_authorization
|
92
|
+
|
93
|
+
|
94
|
+
0.3.0 (August 15th, 2009)
|
95
|
+
|
96
|
+
* adding attr_accessible to models in nifty_scaffold
|
97
|
+
|
98
|
+
* adding authlogic support with --authlogic option in nifty_authentication
|
99
|
+
|
100
|
+
* pluralize second argument for controller in nifty_authentication
|
101
|
+
|
102
|
+
* don't convert javascript/stylesheet arguments to strings in nifty_layout
|
103
|
+
|
104
|
+
* store request location and redirect to it when logging in under nifty_authentication
|
105
|
+
|
106
|
+
|
107
|
+
0.2.4 (May 5th, 2009)
|
108
|
+
|
109
|
+
* using root_url when no index action in nifty_scaffold
|
110
|
+
|
111
|
+
* making password editable in user model in nifty_authentication
|
112
|
+
|
113
|
+
* adding filter_parameter_logging :password in nifty_authentication
|
114
|
+
|
115
|
+
|
116
|
+
0.2.3 (February 20th, 2009)
|
117
|
+
|
118
|
+
* fixing nifty_authentication to work with Rails 2.3 application_controller.rb
|
119
|
+
|
120
|
+
* fixing password field in HAML signup page in nifty_authentication
|
121
|
+
|
122
|
+
|
123
|
+
0.2.2 (November 11th, 2008)
|
124
|
+
|
125
|
+
* fixing sessions_path reference in nifty_authentication
|
126
|
+
|
127
|
+
* adding more validations to user model in nifty_authentication
|
128
|
+
|
129
|
+
* cleaning up nifty_layout stylesheet
|
130
|
+
|
131
|
+
|
132
|
+
0.2.1 (November 10th, 2008)
|
133
|
+
|
134
|
+
* adding missing nifty_authentication files
|
135
|
+
|
136
|
+
|
137
|
+
0.2.0 (November 4th, 2008)
|
138
|
+
|
139
|
+
* adding nifty_authentication
|
140
|
+
|
141
|
+
|
142
|
+
0.1.8 (October 3rd, 2008)
|
143
|
+
|
144
|
+
* compatibility with RubyGems 1.3
|
145
|
+
|
146
|
+
* using f.error_messages instead of error_messages_for (thanks Zach Langley)
|
147
|
+
|
148
|
+
|
149
|
+
0.1.7 (August 15th, 2008)
|
150
|
+
|
151
|
+
* fixing shoulda tests
|
152
|
+
|
153
|
+
|
154
|
+
0.1.6 (August 7th, 2008)
|
155
|
+
|
156
|
+
* adding option to specify Shoulda as testing framework in nifty_scaffold generator
|
157
|
+
|
158
|
+
* adding options to manually specify rspec or testunit framework in nifty_scaffold generator
|
159
|
+
|
160
|
+
|
161
|
+
0.1.5 (August 7th, 2008)
|
162
|
+
|
163
|
+
* adding option to nifty layout to generate HAML views and SASS stylesheets
|
164
|
+
|
165
|
+
* adding option to nifty scaffold to generate HAML views
|
166
|
+
|
167
|
+
|
168
|
+
0.1.4 (July 21st, 2008)
|
169
|
+
|
170
|
+
* using same logic as model spec in model test for scaffold
|
171
|
+
|
172
|
+
* simplifying model spec generated by scaffold
|
173
|
+
|
174
|
+
* adding error_messages_for to form partial
|
175
|
+
|
176
|
+
|
177
|
+
0.1.3 (June 20th, 2008)
|
178
|
+
|
179
|
+
* using _url in controllers instead of _path
|
180
|
+
|
181
|
+
* improving the nifty_config default example YAML file
|
182
|
+
|
183
|
+
|
184
|
+
0.1.2 (May 16th, 2008)
|
185
|
+
|
186
|
+
* mentioning nifty_layout in nifty_scaffold generator
|
187
|
+
|
188
|
+
* adding nifty_config generator
|
189
|
+
|
190
|
+
|
191
|
+
0.1.1 (May 9th, 2008)
|
192
|
+
|
193
|
+
* adding tests and specs to scaffold generator
|
194
|
+
|
195
|
+
|
196
|
+
0.1.0 (May 8th, 2008)
|
197
|
+
|
198
|
+
* initial release
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
nifty-generators (0.4.6)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
abstract (1.0.0)
|
10
|
+
actionmailer (3.0.8)
|
11
|
+
actionpack (= 3.0.8)
|
12
|
+
mail (~> 2.2.19)
|
13
|
+
actionpack (3.0.8)
|
14
|
+
activemodel (= 3.0.8)
|
15
|
+
activesupport (= 3.0.8)
|
16
|
+
builder (~> 2.1.2)
|
17
|
+
erubis (~> 2.6.6)
|
18
|
+
i18n (~> 0.5.0)
|
19
|
+
rack (~> 1.2.1)
|
20
|
+
rack-mount (~> 0.6.14)
|
21
|
+
rack-test (~> 0.5.7)
|
22
|
+
tzinfo (~> 0.3.23)
|
23
|
+
activemodel (3.0.8)
|
24
|
+
activesupport (= 3.0.8)
|
25
|
+
builder (~> 2.1.2)
|
26
|
+
i18n (~> 0.5.0)
|
27
|
+
activerecord (3.0.8)
|
28
|
+
activemodel (= 3.0.8)
|
29
|
+
activesupport (= 3.0.8)
|
30
|
+
arel (~> 2.0.10)
|
31
|
+
tzinfo (~> 0.3.23)
|
32
|
+
activeresource (3.0.8)
|
33
|
+
activemodel (= 3.0.8)
|
34
|
+
activesupport (= 3.0.8)
|
35
|
+
activesupport (3.0.8)
|
36
|
+
arel (2.0.10)
|
37
|
+
bcrypt-ruby (2.1.4)
|
38
|
+
builder (2.1.2)
|
39
|
+
cucumber (0.9.4)
|
40
|
+
builder (~> 2.1.2)
|
41
|
+
diff-lcs (~> 1.1.2)
|
42
|
+
gherkin (~> 2.2.9)
|
43
|
+
json (~> 1.4.6)
|
44
|
+
term-ansicolor (~> 1.0.5)
|
45
|
+
diff-lcs (1.1.2)
|
46
|
+
erubis (2.6.6)
|
47
|
+
abstract (>= 1.0.0)
|
48
|
+
gherkin (2.2.9)
|
49
|
+
json (~> 1.4.6)
|
50
|
+
term-ansicolor (~> 1.0.5)
|
51
|
+
i18n (0.5.0)
|
52
|
+
json (1.4.6)
|
53
|
+
mail (2.2.19)
|
54
|
+
activesupport (>= 2.3.6)
|
55
|
+
i18n (>= 0.4.0)
|
56
|
+
mime-types (~> 1.16)
|
57
|
+
treetop (~> 1.4.8)
|
58
|
+
mime-types (1.16)
|
59
|
+
mocha (0.9.12)
|
60
|
+
polyglot (0.3.1)
|
61
|
+
rack (1.2.3)
|
62
|
+
rack-mount (0.6.14)
|
63
|
+
rack (>= 1.0.0)
|
64
|
+
rack-test (0.5.7)
|
65
|
+
rack (>= 1.0)
|
66
|
+
rails (3.0.8)
|
67
|
+
actionmailer (= 3.0.8)
|
68
|
+
actionpack (= 3.0.8)
|
69
|
+
activerecord (= 3.0.8)
|
70
|
+
activeresource (= 3.0.8)
|
71
|
+
activesupport (= 3.0.8)
|
72
|
+
bundler (~> 1.0)
|
73
|
+
railties (= 3.0.8)
|
74
|
+
railties (3.0.8)
|
75
|
+
actionpack (= 3.0.8)
|
76
|
+
activesupport (= 3.0.8)
|
77
|
+
rake (>= 0.8.7)
|
78
|
+
thor (~> 0.14.4)
|
79
|
+
rake (0.9.2)
|
80
|
+
rspec (2.0.1)
|
81
|
+
rspec-core (~> 2.0.1)
|
82
|
+
rspec-expectations (~> 2.0.1)
|
83
|
+
rspec-mocks (~> 2.0.1)
|
84
|
+
rspec-core (2.0.1)
|
85
|
+
rspec-expectations (2.0.1)
|
86
|
+
diff-lcs (>= 1.1.2)
|
87
|
+
rspec-mocks (2.0.1)
|
88
|
+
rspec-core (~> 2.0.1)
|
89
|
+
rspec-expectations (~> 2.0.1)
|
90
|
+
rspec-rails (2.0.1)
|
91
|
+
rspec (~> 2.0.0)
|
92
|
+
sqlite3 (1.3.3)
|
93
|
+
sqlite3-ruby (1.3.3)
|
94
|
+
sqlite3 (>= 1.3.3)
|
95
|
+
term-ansicolor (1.0.5)
|
96
|
+
thor (0.14.6)
|
97
|
+
treetop (1.4.9)
|
98
|
+
polyglot (>= 0.3.1)
|
99
|
+
tzinfo (0.3.27)
|
100
|
+
|
101
|
+
PLATFORMS
|
102
|
+
ruby
|
103
|
+
|
104
|
+
DEPENDENCIES
|
105
|
+
bcrypt-ruby (~> 2.1.2)
|
106
|
+
cucumber (~> 0.9.2)
|
107
|
+
mocha (~> 0.9.8)
|
108
|
+
nifty-generators!
|
109
|
+
rails (~> 3.0.0)
|
110
|
+
rspec-rails (~> 2.0.1)
|
111
|
+
sqlite3-ruby (~> 1.3.1)
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Ryan Bates
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
= Nifty Generators
|
2
|
+
|
3
|
+
A collection of useful Rails generator scripts for scaffolding, layout files, authentication, and more.
|
4
|
+
|
5
|
+
|
6
|
+
== Setup
|
7
|
+
|
8
|
+
=== Rails 3
|
9
|
+
|
10
|
+
Add the gem to your Gemfile.
|
11
|
+
|
12
|
+
gem "nifty-generators", :group => :development
|
13
|
+
|
14
|
+
Then you can run any of the included generators.
|
15
|
+
|
16
|
+
rails g nifty:scaffold Recipe name:string index new
|
17
|
+
|
18
|
+
=== Rails 2
|
19
|
+
|
20
|
+
First install the gem.
|
21
|
+
|
22
|
+
gem install nifty-generators
|
23
|
+
|
24
|
+
The generators will be available in all Rails applications. To run the generator, go to your rails project directory and call it using the script/generate or script/destroy command.
|
25
|
+
|
26
|
+
script/generate nifty_scaffold Recipe name:string index new
|
27
|
+
|
28
|
+
Note an underscore is used instead of a colon for the Rails 2 generators.
|
29
|
+
|
30
|
+
|
31
|
+
== Included Generators
|
32
|
+
|
33
|
+
* nifty:layout: generates generic layout, stylesheet, and helper files.
|
34
|
+
* nifty:scaffold: generates a controller and optional model/migration.
|
35
|
+
* nifty:config: generates a config YAML file and loader.
|
36
|
+
* nifty:authentication: generates user model with sign up and log in.
|
37
|
+
|
38
|
+
To view the README for each generator, run it with the +help+ option.
|
39
|
+
|
40
|
+
rails g nifty:layout --help
|
41
|
+
|
42
|
+
|
43
|
+
== Troubleshooting and FAQs
|
44
|
+
|
45
|
+
<b>What is the difference between nifty:scaffold and built-in scaffold?</b>
|
46
|
+
|
47
|
+
One of the primary differences is that nifty:scaffold allows you to choose which controller actions to generate.
|
48
|
+
|
49
|
+
rails g nifty:scaffold post name:string index new edit
|
50
|
+
|
51
|
+
There are a few changes to the generated code as well, such as no XML format by default.
|
52
|
+
|
53
|
+
It also offers support for HAML, Shoulda, and RSpec.
|
54
|
+
|
55
|
+
|
56
|
+
<b>I get "undefined method 'title'" error.</b>
|
57
|
+
|
58
|
+
Try running nifty:layout, that will generate this helper method. Or you can just change the templates to whatever approach you prefer for setting the title.
|
59
|
+
|
60
|
+
|
61
|
+
<b>I can't set new attributes in my model.</b>
|
62
|
+
|
63
|
+
Add the attribute to the attr_accessible line in the model.
|
64
|
+
|
65
|
+
|
66
|
+
<b>I get "undefined method 'root_url'" error.</b>
|
67
|
+
|
68
|
+
Some generators default redirecting to the root_url. Set this in your routes.rb file like this (substituting your controller name).
|
69
|
+
|
70
|
+
root :to => "home#index"
|
71
|
+
|
72
|
+
|
73
|
+
<b>I get a missing database error.</b>
|
74
|
+
|
75
|
+
Run <tt>rake db:migrate</tt>.
|
76
|
+
|
77
|
+
|
78
|
+
<b>I get a routing error when I try to submit a form.</b>
|
79
|
+
|
80
|
+
Try restarting your development server. Sometimes it doesn't detect the change in the routing.
|
81
|
+
|
82
|
+
|
83
|
+
<b>The tests/specs don't work.</b>
|
84
|
+
|
85
|
+
Make sure you have mocha installed and require it in your spec/test helper.
|
86
|
+
|
87
|
+
gem install mocha
|
88
|
+
|
89
|
+
# in spec_helper.rb
|
90
|
+
config.mock_with :mocha
|
91
|
+
|
92
|
+
# in test_helper.rb
|
93
|
+
require 'mocha'
|
94
|
+
|
95
|
+
Also, make sure you're using Rails 2.1 or greater.
|
96
|
+
|
97
|
+
|
98
|
+
== Found a bug?
|
99
|
+
|
100
|
+
If you are having a problem with Nifty Generators, first look at the FAQs above. If you still cannot resolve it, please submit an issue here.
|
101
|
+
|
102
|
+
http://github.com/ryanb/nifty-generators/issues
|
103
|
+
|
104
|
+
|
105
|
+
== Development
|
106
|
+
|
107
|
+
If you want to contribute to this project, you can download the Git repository and get the Cucumber features running by calling +bundle+ then +rake+. I normally develop this using Ruby 1.9.2 however it should work with 1.8.7 as well.
|
108
|
+
|
109
|
+
The Rails 3 generators are located under <tt>lib/generators</tt> and are tested with Cucumber. The older Rails 2 generators are under <tt>rails_generators</tt> and are tested with Shoulda under the <tt>test</tt> directory.
|