minerva-nifty-generators 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +105 -0
- data/LICENSE +20 -0
- data/Manifest +100 -0
- data/README.rdoc +106 -0
- data/Rakefile +15 -0
- data/TODO +7 -0
- data/lib/nifty_generators.rb +3 -0
- data/nifty-generators.gemspec +31 -0
- data/rails_generators/nifty_authentication/USAGE +50 -0
- data/rails_generators/nifty_authentication/lib/insert_commands.rb +74 -0
- data/rails_generators/nifty_authentication/nifty_authentication_generator.rb +128 -0
- data/rails_generators/nifty_authentication/templates/authentication.rb +61 -0
- data/rails_generators/nifty_authentication/templates/authlogic_session.rb +2 -0
- data/rails_generators/nifty_authentication/templates/fixtures.yml +24 -0
- data/rails_generators/nifty_authentication/templates/migration.rb +20 -0
- data/rails_generators/nifty_authentication/templates/sessions_controller.rb +45 -0
- data/rails_generators/nifty_authentication/templates/sessions_helper.rb +2 -0
- data/rails_generators/nifty_authentication/templates/tests/rspec/sessions_controller.rb +39 -0
- data/rails_generators/nifty_authentication/templates/tests/rspec/user.rb +83 -0
- data/rails_generators/nifty_authentication/templates/tests/rspec/users_controller.rb +26 -0
- data/rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb +40 -0
- data/rails_generators/nifty_authentication/templates/tests/shoulda/user.rb +85 -0
- data/rails_generators/nifty_authentication/templates/tests/shoulda/users_controller.rb +27 -0
- data/rails_generators/nifty_authentication/templates/tests/testunit/sessions_controller.rb +36 -0
- data/rails_generators/nifty_authentication/templates/tests/testunit/user.rb +88 -0
- data/rails_generators/nifty_authentication/templates/tests/testunit/users_controller.rb +23 -0
- data/rails_generators/nifty_authentication/templates/user.rb +42 -0
- data/rails_generators/nifty_authentication/templates/users_controller.rb +18 -0
- data/rails_generators/nifty_authentication/templates/users_helper.rb +2 -0
- data/rails_generators/nifty_authentication/templates/views/erb/login.html.erb +30 -0
- data/rails_generators/nifty_authentication/templates/views/erb/signup.html.erb +24 -0
- data/rails_generators/nifty_authentication/templates/views/haml/login.html.haml +30 -0
- data/rails_generators/nifty_authentication/templates/views/haml/signup.html.haml +24 -0
- data/rails_generators/nifty_config/USAGE +23 -0
- data/rails_generators/nifty_config/nifty_config_generator.rb +32 -0
- data/rails_generators/nifty_config/templates/config.yml +8 -0
- data/rails_generators/nifty_config/templates/load_config.rb +2 -0
- data/rails_generators/nifty_layout/USAGE +25 -0
- data/rails_generators/nifty_layout/nifty_layout_generator.rb +44 -0
- data/rails_generators/nifty_layout/templates/helper.rb +22 -0
- data/rails_generators/nifty_layout/templates/layout.html.erb +22 -0
- data/rails_generators/nifty_layout/templates/layout.html.haml +19 -0
- data/rails_generators/nifty_layout/templates/stylesheet.css +81 -0
- data/rails_generators/nifty_layout/templates/stylesheet.sass +67 -0
- data/rails_generators/nifty_scaffold/USAGE +51 -0
- data/rails_generators/nifty_scaffold/nifty_scaffold_generator.rb +232 -0
- data/rails_generators/nifty_scaffold/templates/actions/create.rb +9 -0
- data/rails_generators/nifty_scaffold/templates/actions/destroy.rb +6 -0
- data/rails_generators/nifty_scaffold/templates/actions/edit.rb +3 -0
- data/rails_generators/nifty_scaffold/templates/actions/index.rb +3 -0
- data/rails_generators/nifty_scaffold/templates/actions/new.rb +3 -0
- data/rails_generators/nifty_scaffold/templates/actions/show.rb +3 -0
- data/rails_generators/nifty_scaffold/templates/actions/update.rb +9 -0
- data/rails_generators/nifty_scaffold/templates/controller.rb +3 -0
- data/rails_generators/nifty_scaffold/templates/fixtures.yml +9 -0
- data/rails_generators/nifty_scaffold/templates/helper.rb +2 -0
- data/rails_generators/nifty_scaffold/templates/migration.rb +16 -0
- data/rails_generators/nifty_scaffold/templates/model.rb +3 -0
- data/rails_generators/nifty_scaffold/templates/tests/rspec/actions/create.rb +11 -0
- data/rails_generators/nifty_scaffold/templates/tests/rspec/actions/destroy.rb +6 -0
- data/rails_generators/nifty_scaffold/templates/tests/rspec/actions/edit.rb +4 -0
- data/rails_generators/nifty_scaffold/templates/tests/rspec/actions/index.rb +4 -0
- data/rails_generators/nifty_scaffold/templates/tests/rspec/actions/new.rb +4 -0
- data/rails_generators/nifty_scaffold/templates/tests/rspec/actions/show.rb +4 -0
- data/rails_generators/nifty_scaffold/templates/tests/rspec/actions/update.rb +11 -0
- data/rails_generators/nifty_scaffold/templates/tests/rspec/controller.rb +8 -0
- data/rails_generators/nifty_scaffold/templates/tests/rspec/model.rb +7 -0
- data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/create.rb +13 -0
- data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/destroy.rb +8 -0
- data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/edit.rb +6 -0
- data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/index.rb +6 -0
- data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/new.rb +6 -0
- data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/show.rb +6 -0
- data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/update.rb +13 -0
- data/rails_generators/nifty_scaffold/templates/tests/shoulda/controller.rb +5 -0
- data/rails_generators/nifty_scaffold/templates/tests/shoulda/model.rb +7 -0
- data/rails_generators/nifty_scaffold/templates/tests/testunit/actions/create.rb +11 -0
- data/rails_generators/nifty_scaffold/templates/tests/testunit/actions/destroy.rb +6 -0
- data/rails_generators/nifty_scaffold/templates/tests/testunit/actions/edit.rb +4 -0
- data/rails_generators/nifty_scaffold/templates/tests/testunit/actions/index.rb +4 -0
- data/rails_generators/nifty_scaffold/templates/tests/testunit/actions/new.rb +4 -0
- data/rails_generators/nifty_scaffold/templates/tests/testunit/actions/show.rb +4 -0
- data/rails_generators/nifty_scaffold/templates/tests/testunit/actions/update.rb +11 -0
- data/rails_generators/nifty_scaffold/templates/tests/testunit/controller.rb +5 -0
- data/rails_generators/nifty_scaffold/templates/tests/testunit/model.rb +7 -0
- data/rails_generators/nifty_scaffold/templates/views/erb/_form.html.erb +10 -0
- data/rails_generators/nifty_scaffold/templates/views/erb/edit.html.erb +14 -0
- data/rails_generators/nifty_scaffold/templates/views/erb/index.html.erb +29 -0
- data/rails_generators/nifty_scaffold/templates/views/erb/new.html.erb +7 -0
- data/rails_generators/nifty_scaffold/templates/views/erb/show.html.erb +20 -0
- data/rails_generators/nifty_scaffold/templates/views/haml/_form.html.haml +10 -0
- data/rails_generators/nifty_scaffold/templates/views/haml/edit.html.haml +14 -0
- data/rails_generators/nifty_scaffold/templates/views/haml/index.html.haml +25 -0
- data/rails_generators/nifty_scaffold/templates/views/haml/new.html.haml +7 -0
- data/rails_generators/nifty_scaffold/templates/views/haml/show.html.haml +20 -0
- data/tasks/deployment.rake +2 -0
- data/test/test_helper.rb +117 -0
- data/test/test_nifty_authentication_generator.rb +236 -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 +169 -0
data/CHANGELOG
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
0.3.0 (August 15th, 2009)
|
2
|
+
|
3
|
+
* adding attr_accessible to models in nifty_scaffold
|
4
|
+
|
5
|
+
* adding authlogic support with --authlogic option in nifty_authentication
|
6
|
+
|
7
|
+
* pluralize second argument for controller in nifty_authentication
|
8
|
+
|
9
|
+
* don't convert javascript/stylesheet arguments to strings in nifty_layout
|
10
|
+
|
11
|
+
* store request location and redirect to it when logging in under nifty_authentication
|
12
|
+
|
13
|
+
|
14
|
+
0.2.4 (May 5th, 2009)
|
15
|
+
|
16
|
+
* using root_url when no index action in nifty_scaffold
|
17
|
+
|
18
|
+
* making password editable in user model in nifty_authentication
|
19
|
+
|
20
|
+
* adding filter_parameter_logging :password in nifty_authentication
|
21
|
+
|
22
|
+
|
23
|
+
0.2.3 (February 20th, 2009)
|
24
|
+
|
25
|
+
* fixing nifty_authentication to work with Rails 2.3 application_controller.rb
|
26
|
+
|
27
|
+
* fixing password field in HAML signup page in nifty_authentication
|
28
|
+
|
29
|
+
|
30
|
+
0.2.2 (November 11th, 2008)
|
31
|
+
|
32
|
+
* fixing sessions_path reference in nifty_authentication
|
33
|
+
|
34
|
+
* adding more validations to user model in nifty_authentication
|
35
|
+
|
36
|
+
* cleaning up nifty_layout stylesheet
|
37
|
+
|
38
|
+
|
39
|
+
0.2.1 (November 10th, 2008)
|
40
|
+
|
41
|
+
* adding missing nifty_authentication files
|
42
|
+
|
43
|
+
|
44
|
+
0.2.0 (November 4th, 2008)
|
45
|
+
|
46
|
+
* adding nifty_authentication
|
47
|
+
|
48
|
+
|
49
|
+
0.1.8 (October 3rd, 2008)
|
50
|
+
|
51
|
+
* compatibility with RubyGems 1.3
|
52
|
+
|
53
|
+
* using f.error_messages instead of error_messages_for (thanks Zach Langley)
|
54
|
+
|
55
|
+
|
56
|
+
0.1.7 (August 15th, 2008)
|
57
|
+
|
58
|
+
* fixing shoulda tests
|
59
|
+
|
60
|
+
|
61
|
+
0.1.6 (August 7th, 2008)
|
62
|
+
|
63
|
+
* adding option to specify Shoulda as testing framework in nifty_scaffold generator
|
64
|
+
|
65
|
+
* adding options to manually specify rspec or testunit framework in nifty_scaffold generator
|
66
|
+
|
67
|
+
|
68
|
+
0.1.5 (August 7th, 2008)
|
69
|
+
|
70
|
+
* adding option to nifty layout to generate HAML views and SASS stylesheets
|
71
|
+
|
72
|
+
* adding option to nifty scaffold to generate HAML views
|
73
|
+
|
74
|
+
|
75
|
+
0.1.4 (July 21st, 2008)
|
76
|
+
|
77
|
+
* using same logic as model spec in model test for scaffold
|
78
|
+
|
79
|
+
* simplifying model spec generated by scaffold
|
80
|
+
|
81
|
+
* adding error_messages_for to form partial
|
82
|
+
|
83
|
+
|
84
|
+
0.1.3 (June 20th, 2008)
|
85
|
+
|
86
|
+
* using _url in controllers instead of _path
|
87
|
+
|
88
|
+
* improving the nifty_config default example YAML file
|
89
|
+
|
90
|
+
|
91
|
+
0.1.2 (May 16th, 2008)
|
92
|
+
|
93
|
+
* mentioning nifty_layout in nifty_scaffold generator
|
94
|
+
|
95
|
+
* adding nifty_config generator
|
96
|
+
|
97
|
+
|
98
|
+
0.1.1 (May 9th, 2008)
|
99
|
+
|
100
|
+
* adding tests and specs to scaffold generator
|
101
|
+
|
102
|
+
|
103
|
+
0.1.0 (May 8th, 2008)
|
104
|
+
|
105
|
+
* initial release
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2008 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/Manifest
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
CHANGELOG
|
2
|
+
lib/nifty_generators.rb
|
3
|
+
LICENSE
|
4
|
+
Manifest
|
5
|
+
rails_generators/nifty_authentication/lib/insert_commands.rb
|
6
|
+
rails_generators/nifty_authentication/nifty_authentication_generator.rb
|
7
|
+
rails_generators/nifty_authentication/templates/authentication.rb
|
8
|
+
rails_generators/nifty_authentication/templates/authlogic_session.rb
|
9
|
+
rails_generators/nifty_authentication/templates/fixtures.yml
|
10
|
+
rails_generators/nifty_authentication/templates/migration.rb
|
11
|
+
rails_generators/nifty_authentication/templates/sessions_controller.rb
|
12
|
+
rails_generators/nifty_authentication/templates/sessions_helper.rb
|
13
|
+
rails_generators/nifty_authentication/templates/tests/rspec/sessions_controller.rb
|
14
|
+
rails_generators/nifty_authentication/templates/tests/rspec/user.rb
|
15
|
+
rails_generators/nifty_authentication/templates/tests/rspec/users_controller.rb
|
16
|
+
rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb
|
17
|
+
rails_generators/nifty_authentication/templates/tests/shoulda/user.rb
|
18
|
+
rails_generators/nifty_authentication/templates/tests/shoulda/users_controller.rb
|
19
|
+
rails_generators/nifty_authentication/templates/tests/testunit/sessions_controller.rb
|
20
|
+
rails_generators/nifty_authentication/templates/tests/testunit/user.rb
|
21
|
+
rails_generators/nifty_authentication/templates/tests/testunit/users_controller.rb
|
22
|
+
rails_generators/nifty_authentication/templates/user.rb
|
23
|
+
rails_generators/nifty_authentication/templates/users_controller.rb
|
24
|
+
rails_generators/nifty_authentication/templates/users_helper.rb
|
25
|
+
rails_generators/nifty_authentication/templates/views/erb/login.html.erb
|
26
|
+
rails_generators/nifty_authentication/templates/views/erb/signup.html.erb
|
27
|
+
rails_generators/nifty_authentication/templates/views/haml/login.html.haml
|
28
|
+
rails_generators/nifty_authentication/templates/views/haml/signup.html.haml
|
29
|
+
rails_generators/nifty_authentication/USAGE
|
30
|
+
rails_generators/nifty_config/nifty_config_generator.rb
|
31
|
+
rails_generators/nifty_config/templates/config.yml
|
32
|
+
rails_generators/nifty_config/templates/load_config.rb
|
33
|
+
rails_generators/nifty_config/USAGE
|
34
|
+
rails_generators/nifty_layout/nifty_layout_generator.rb
|
35
|
+
rails_generators/nifty_layout/templates/helper.rb
|
36
|
+
rails_generators/nifty_layout/templates/layout.html.erb
|
37
|
+
rails_generators/nifty_layout/templates/layout.html.haml
|
38
|
+
rails_generators/nifty_layout/templates/stylesheet.css
|
39
|
+
rails_generators/nifty_layout/templates/stylesheet.sass
|
40
|
+
rails_generators/nifty_layout/USAGE
|
41
|
+
rails_generators/nifty_scaffold/nifty_scaffold_generator.rb
|
42
|
+
rails_generators/nifty_scaffold/templates/actions/create.rb
|
43
|
+
rails_generators/nifty_scaffold/templates/actions/destroy.rb
|
44
|
+
rails_generators/nifty_scaffold/templates/actions/edit.rb
|
45
|
+
rails_generators/nifty_scaffold/templates/actions/index.rb
|
46
|
+
rails_generators/nifty_scaffold/templates/actions/new.rb
|
47
|
+
rails_generators/nifty_scaffold/templates/actions/show.rb
|
48
|
+
rails_generators/nifty_scaffold/templates/actions/update.rb
|
49
|
+
rails_generators/nifty_scaffold/templates/controller.rb
|
50
|
+
rails_generators/nifty_scaffold/templates/fixtures.yml
|
51
|
+
rails_generators/nifty_scaffold/templates/helper.rb
|
52
|
+
rails_generators/nifty_scaffold/templates/migration.rb
|
53
|
+
rails_generators/nifty_scaffold/templates/model.rb
|
54
|
+
rails_generators/nifty_scaffold/templates/tests/rspec/actions/create.rb
|
55
|
+
rails_generators/nifty_scaffold/templates/tests/rspec/actions/destroy.rb
|
56
|
+
rails_generators/nifty_scaffold/templates/tests/rspec/actions/edit.rb
|
57
|
+
rails_generators/nifty_scaffold/templates/tests/rspec/actions/index.rb
|
58
|
+
rails_generators/nifty_scaffold/templates/tests/rspec/actions/new.rb
|
59
|
+
rails_generators/nifty_scaffold/templates/tests/rspec/actions/show.rb
|
60
|
+
rails_generators/nifty_scaffold/templates/tests/rspec/actions/update.rb
|
61
|
+
rails_generators/nifty_scaffold/templates/tests/rspec/controller.rb
|
62
|
+
rails_generators/nifty_scaffold/templates/tests/rspec/model.rb
|
63
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/actions/create.rb
|
64
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/actions/destroy.rb
|
65
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/actions/edit.rb
|
66
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/actions/index.rb
|
67
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/actions/new.rb
|
68
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/actions/show.rb
|
69
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/actions/update.rb
|
70
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/controller.rb
|
71
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/model.rb
|
72
|
+
rails_generators/nifty_scaffold/templates/tests/testunit/actions/create.rb
|
73
|
+
rails_generators/nifty_scaffold/templates/tests/testunit/actions/destroy.rb
|
74
|
+
rails_generators/nifty_scaffold/templates/tests/testunit/actions/edit.rb
|
75
|
+
rails_generators/nifty_scaffold/templates/tests/testunit/actions/index.rb
|
76
|
+
rails_generators/nifty_scaffold/templates/tests/testunit/actions/new.rb
|
77
|
+
rails_generators/nifty_scaffold/templates/tests/testunit/actions/show.rb
|
78
|
+
rails_generators/nifty_scaffold/templates/tests/testunit/actions/update.rb
|
79
|
+
rails_generators/nifty_scaffold/templates/tests/testunit/controller.rb
|
80
|
+
rails_generators/nifty_scaffold/templates/tests/testunit/model.rb
|
81
|
+
rails_generators/nifty_scaffold/templates/views/erb/_form.html.erb
|
82
|
+
rails_generators/nifty_scaffold/templates/views/erb/edit.html.erb
|
83
|
+
rails_generators/nifty_scaffold/templates/views/erb/index.html.erb
|
84
|
+
rails_generators/nifty_scaffold/templates/views/erb/new.html.erb
|
85
|
+
rails_generators/nifty_scaffold/templates/views/erb/show.html.erb
|
86
|
+
rails_generators/nifty_scaffold/templates/views/haml/_form.html.haml
|
87
|
+
rails_generators/nifty_scaffold/templates/views/haml/edit.html.haml
|
88
|
+
rails_generators/nifty_scaffold/templates/views/haml/index.html.haml
|
89
|
+
rails_generators/nifty_scaffold/templates/views/haml/new.html.haml
|
90
|
+
rails_generators/nifty_scaffold/templates/views/haml/show.html.haml
|
91
|
+
rails_generators/nifty_scaffold/USAGE
|
92
|
+
Rakefile
|
93
|
+
README.rdoc
|
94
|
+
tasks/deployment.rake
|
95
|
+
test/test_helper.rb
|
96
|
+
test/test_nifty_authentication_generator.rb
|
97
|
+
test/test_nifty_config_generator.rb
|
98
|
+
test/test_nifty_layout_generator.rb
|
99
|
+
test/test_nifty_scaffold_generator.rb
|
100
|
+
TODO
|
data/README.rdoc
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
= Nifty Generators
|
2
|
+
|
3
|
+
A collection of useful Rails generator scripts.
|
4
|
+
|
5
|
+
|
6
|
+
== Install
|
7
|
+
|
8
|
+
gem install nifty-generators
|
9
|
+
|
10
|
+
You may need to uninstall the older version if it's installed.
|
11
|
+
|
12
|
+
gem uninstall ryanb-nifty-generators
|
13
|
+
|
14
|
+
|
15
|
+
== Usage
|
16
|
+
|
17
|
+
Once you install the gem, the generators will be available to all Rails
|
18
|
+
applications on your system. If you run script/generate without any
|
19
|
+
additional arguments you should see the available generators listed.
|
20
|
+
|
21
|
+
To run the generator, go to your rails project directory and call it
|
22
|
+
using the script/generate or script/destroy command.
|
23
|
+
|
24
|
+
script/generate nifty_scaffold Recipe name:string index new
|
25
|
+
|
26
|
+
|
27
|
+
== Included Generators
|
28
|
+
|
29
|
+
* nifty_layout: generates generic layout, stylesheet, and helper files.
|
30
|
+
* nifty_scaffold: generates a controller and optional model/migration.
|
31
|
+
* nifty_config: generates a config YAML file and loader.
|
32
|
+
* nifty_authentication: generates user model with sign up and log in.
|
33
|
+
|
34
|
+
To view the README for each generator, run it with the +--help+ option.
|
35
|
+
|
36
|
+
script/generate nifty_layout --help
|
37
|
+
|
38
|
+
|
39
|
+
== Troubleshooting and FAQs
|
40
|
+
|
41
|
+
<b>What is the difference between nifty_scaffold and built-in scaffold?</b>
|
42
|
+
|
43
|
+
One of the primary differences is that nifty_scaffold allows you to choose which
|
44
|
+
controller actions to generate.
|
45
|
+
|
46
|
+
script/generate nifty_scaffold post name:string index new edit
|
47
|
+
|
48
|
+
There are a few changes to the generated code as well, such as no XML format by default.
|
49
|
+
|
50
|
+
It also offers support for HAML, Shoulda, and RSpec.
|
51
|
+
|
52
|
+
|
53
|
+
<b>I get "undefined method 'title'" error.</b>
|
54
|
+
|
55
|
+
Try running nifty_layout, that will generate this helper method. Or
|
56
|
+
you can just change the templates to whatever approach you prefer for
|
57
|
+
setting the title.
|
58
|
+
|
59
|
+
|
60
|
+
<b>I can't set new attributes in my model.</b>
|
61
|
+
|
62
|
+
Add the attribute to the attr_accessible line in the model.
|
63
|
+
|
64
|
+
|
65
|
+
<b>I get "undefined method 'root_url'" error.</b>
|
66
|
+
|
67
|
+
Some generators default redirecting to the root_url. Set this in your
|
68
|
+
routes.rb file like this (substituting your controller name).
|
69
|
+
|
70
|
+
map.root :controller => 'foo'
|
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
|
81
|
+
change in the routing.
|
82
|
+
|
83
|
+
|
84
|
+
<b>The tests/specs don't work.</b>
|
85
|
+
|
86
|
+
Make sure you have mocha installed and require it in your spec/test helper.
|
87
|
+
|
88
|
+
gem install mocha
|
89
|
+
|
90
|
+
# in spec_helper.rb
|
91
|
+
config.mock_with :mocha
|
92
|
+
|
93
|
+
# in test_helper.rb
|
94
|
+
require 'mocha'
|
95
|
+
|
96
|
+
Also, make sure you're using Rails 2.1 or greater.
|
97
|
+
|
98
|
+
|
99
|
+
== Development
|
100
|
+
|
101
|
+
This project can be found on github at the following URL.
|
102
|
+
|
103
|
+
http://github.com/ryanb/nifty-generators/
|
104
|
+
|
105
|
+
If you wish the generators behaved differently, please consider
|
106
|
+
forking the project and modifying to your heart's content.
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'echoe'
|
4
|
+
|
5
|
+
Echoe.new('nifty-generators', '0.3.0') do |p|
|
6
|
+
p.project = "niftygenerators"
|
7
|
+
p.description = "A collection of useful generator scripts for Rails."
|
8
|
+
p.url = "http://github.com/ryanb/nifty-generators"
|
9
|
+
p.author = 'Ryan Bates'
|
10
|
+
p.email = "ryan (at) railscasts (dot) com"
|
11
|
+
p.ignore_pattern = ["script/*"]
|
12
|
+
p.development_dependencies = []
|
13
|
+
end
|
14
|
+
|
15
|
+
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
data/TODO
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{minerva-nifty-generators}
|
5
|
+
s.version = "0.3.0"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Ryan Bates"]
|
9
|
+
s.date = %q{2009-08-15}
|
10
|
+
s.description = %q{A collection of useful generator scripts for Rails.}
|
11
|
+
s.email = %q{ryan (at) railscasts (dot) com}
|
12
|
+
s.extra_rdoc_files = ["CHANGELOG", "lib/nifty_generators.rb", "LICENSE", "README.rdoc", "tasks/deployment.rake", "TODO"]
|
13
|
+
s.files = ["CHANGELOG", "lib/nifty_generators.rb", "LICENSE", "Manifest", "rails_generators/nifty_authentication/lib/insert_commands.rb", "rails_generators/nifty_authentication/nifty_authentication_generator.rb", "rails_generators/nifty_authentication/templates/authentication.rb", "rails_generators/nifty_authentication/templates/authlogic_session.rb", "rails_generators/nifty_authentication/templates/fixtures.yml", "rails_generators/nifty_authentication/templates/migration.rb", "rails_generators/nifty_authentication/templates/sessions_controller.rb", "rails_generators/nifty_authentication/templates/sessions_helper.rb", "rails_generators/nifty_authentication/templates/tests/rspec/sessions_controller.rb", "rails_generators/nifty_authentication/templates/tests/rspec/user.rb", "rails_generators/nifty_authentication/templates/tests/rspec/users_controller.rb", "rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb", "rails_generators/nifty_authentication/templates/tests/shoulda/user.rb", "rails_generators/nifty_authentication/templates/tests/shoulda/users_controller.rb", "rails_generators/nifty_authentication/templates/tests/testunit/sessions_controller.rb", "rails_generators/nifty_authentication/templates/tests/testunit/user.rb", "rails_generators/nifty_authentication/templates/tests/testunit/users_controller.rb", "rails_generators/nifty_authentication/templates/user.rb", "rails_generators/nifty_authentication/templates/users_controller.rb", "rails_generators/nifty_authentication/templates/users_helper.rb", "rails_generators/nifty_authentication/templates/views/erb/login.html.erb", "rails_generators/nifty_authentication/templates/views/erb/signup.html.erb", "rails_generators/nifty_authentication/templates/views/haml/login.html.haml", "rails_generators/nifty_authentication/templates/views/haml/signup.html.haml", "rails_generators/nifty_authentication/USAGE", "rails_generators/nifty_config/nifty_config_generator.rb", "rails_generators/nifty_config/templates/config.yml", "rails_generators/nifty_config/templates/load_config.rb", "rails_generators/nifty_config/USAGE", "rails_generators/nifty_layout/nifty_layout_generator.rb", "rails_generators/nifty_layout/templates/helper.rb", "rails_generators/nifty_layout/templates/layout.html.erb", "rails_generators/nifty_layout/templates/layout.html.haml", "rails_generators/nifty_layout/templates/stylesheet.css", "rails_generators/nifty_layout/templates/stylesheet.sass", "rails_generators/nifty_layout/USAGE", "rails_generators/nifty_scaffold/nifty_scaffold_generator.rb", "rails_generators/nifty_scaffold/templates/actions/create.rb", "rails_generators/nifty_scaffold/templates/actions/destroy.rb", "rails_generators/nifty_scaffold/templates/actions/edit.rb", "rails_generators/nifty_scaffold/templates/actions/index.rb", "rails_generators/nifty_scaffold/templates/actions/new.rb", "rails_generators/nifty_scaffold/templates/actions/show.rb", "rails_generators/nifty_scaffold/templates/actions/update.rb", "rails_generators/nifty_scaffold/templates/controller.rb", "rails_generators/nifty_scaffold/templates/fixtures.yml", "rails_generators/nifty_scaffold/templates/helper.rb", "rails_generators/nifty_scaffold/templates/migration.rb", "rails_generators/nifty_scaffold/templates/model.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/actions/create.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/actions/destroy.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/actions/edit.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/actions/index.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/actions/new.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/actions/show.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/actions/update.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/controller.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/model.rb", "rails_generators/nifty_scaffold/templates/tests/shoulda/actions/create.rb", "rails_generators/nifty_scaffold/templates/tests/shoulda/actions/destroy.rb", "rails_generators/nifty_scaffold/templates/tests/shoulda/actions/edit.rb", "rails_generators/nifty_scaffold/templates/tests/shoulda/actions/index.rb", "rails_generators/nifty_scaffold/templates/tests/shoulda/actions/new.rb", "rails_generators/nifty_scaffold/templates/tests/shoulda/actions/show.rb", "rails_generators/nifty_scaffold/templates/tests/shoulda/actions/update.rb", "rails_generators/nifty_scaffold/templates/tests/shoulda/controller.rb", "rails_generators/nifty_scaffold/templates/tests/shoulda/model.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/actions/create.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/actions/destroy.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/actions/edit.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/actions/index.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/actions/new.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/actions/show.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/actions/update.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/controller.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/model.rb", "rails_generators/nifty_scaffold/templates/views/erb/_form.html.erb", "rails_generators/nifty_scaffold/templates/views/erb/edit.html.erb", "rails_generators/nifty_scaffold/templates/views/erb/index.html.erb", "rails_generators/nifty_scaffold/templates/views/erb/new.html.erb", "rails_generators/nifty_scaffold/templates/views/erb/show.html.erb", "rails_generators/nifty_scaffold/templates/views/haml/_form.html.haml", "rails_generators/nifty_scaffold/templates/views/haml/edit.html.haml", "rails_generators/nifty_scaffold/templates/views/haml/index.html.haml", "rails_generators/nifty_scaffold/templates/views/haml/new.html.haml", "rails_generators/nifty_scaffold/templates/views/haml/show.html.haml", "rails_generators/nifty_scaffold/USAGE", "Rakefile", "README.rdoc", "tasks/deployment.rake", "test/test_helper.rb", "test/test_nifty_authentication_generator.rb", "test/test_nifty_config_generator.rb", "test/test_nifty_layout_generator.rb", "test/test_nifty_scaffold_generator.rb", "TODO", "nifty-generators.gemspec"]
|
14
|
+
s.homepage = %q{http://github.com/ryanb/nifty-generators}
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Nifty-generators", "--main", "README.rdoc"]
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubyforge_project = %q{niftygenerators}
|
18
|
+
s.rubygems_version = %q{1.3.5}
|
19
|
+
s.summary = %q{A collection of useful generator scripts for Rails.}
|
20
|
+
s.test_files = ["test/test_helper.rb", "test/test_nifty_authentication_generator.rb", "test/test_nifty_config_generator.rb", "test/test_nifty_layout_generator.rb", "test/test_nifty_scaffold_generator.rb"]
|
21
|
+
|
22
|
+
if s.respond_to? :specification_version then
|
23
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
|
+
s.specification_version = 2
|
25
|
+
|
26
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
27
|
+
else
|
28
|
+
end
|
29
|
+
else
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
Description:
|
2
|
+
Generates a user model, users controller, and sessions controller. The
|
3
|
+
users controller handles the registration and the sessions controller
|
4
|
+
handles authentication. This is similar to restful_authentication, but
|
5
|
+
simpler.
|
6
|
+
|
7
|
+
IMPORTANT: This generator uses the "title" helper method which is generated
|
8
|
+
by the nifty_layout generator. You may want to run that generator first.
|
9
|
+
|
10
|
+
Usage:
|
11
|
+
If you do not pass any arguments, the model name will default to "user", and
|
12
|
+
the authentication controller will default to "session". You can override
|
13
|
+
each of these respectively by passing one or two arguments. Either name can
|
14
|
+
be CamelCased or under_scored.
|
15
|
+
|
16
|
+
Make sure to setup the authlogic gem if you are using that option.
|
17
|
+
|
18
|
+
config.gem "authlogic"
|
19
|
+
|
20
|
+
Examples:
|
21
|
+
script/generate nifty_authentication
|
22
|
+
|
23
|
+
Creates user model, users_controller, and sessions_controller.
|
24
|
+
|
25
|
+
script/generate nifty_authentication account
|
26
|
+
|
27
|
+
Creates account model, accounts_controller, and sessions_controller.
|
28
|
+
|
29
|
+
script/generate nifty_authentication Account UserSession
|
30
|
+
|
31
|
+
Creates account model, accounts_controller, and user_sessions_controller.
|
32
|
+
|
33
|
+
Methods:
|
34
|
+
There are several methods generated which you can use in your application.
|
35
|
+
Here's a common example of what you might add to your layout.
|
36
|
+
|
37
|
+
<% if logged_in? %>
|
38
|
+
Welcome <%= current_user.username %>! Not you?
|
39
|
+
<%= link_to "Log out", logout_path %>
|
40
|
+
<% else %>
|
41
|
+
<%= link_to "Sign up", signup_path %> or
|
42
|
+
<%= link_to "log in", login_path %>.
|
43
|
+
<% end %>
|
44
|
+
|
45
|
+
You can also restrict unregistered users from accessing a controller using
|
46
|
+
a before filter. For example.
|
47
|
+
|
48
|
+
before_filter :login_required, :except => [:index, :show]
|
49
|
+
|
50
|
+
See the generated file lib/authentication.rb for details.
|