unittk-nifty-generators 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +43 -0
- data/LICENSE +20 -0
- data/Manifest +73 -0
- data/README +71 -0
- data/TODO +7 -0
- data/lib/nifty_generators.rb +3 -0
- data/nifty-generators.gemspec +51 -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 +23 -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 +80 -0
- data/rails_generators/nifty_layout/templates/stylesheet.sass +66 -0
- data/rails_generators/nifty_scaffold/USAGE +51 -0
- data/rails_generators/nifty_scaffold/nifty_scaffold_generator.rb +224 -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 +2 -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 +11 -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_config_generator.rb +37 -0
- data/test/test_nifty_layout_generator.rb +42 -0
- data/test/test_nifty_scaffold_generator.rb +532 -0
- metadata +140 -0
data/CHANGELOG
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
*0.1.7* (August 15th, 2008)
|
2
|
+
|
3
|
+
* fixing shoulda tests
|
4
|
+
|
5
|
+
*0.1.6* (August 7th, 2008)
|
6
|
+
|
7
|
+
* adding option to specify Shoulda as testing framework in nifty_scaffold generator
|
8
|
+
|
9
|
+
* adding options to manually specify rspec or testunit framework in nifty_scaffold generator
|
10
|
+
|
11
|
+
*0.1.5* (August 7th, 2008)
|
12
|
+
|
13
|
+
* adding option to nifty layout to generate HAML views and SASS stylesheets
|
14
|
+
|
15
|
+
* adding option to nifty scaffold to generate HAML views
|
16
|
+
|
17
|
+
*0.1.4* (July 21st, 2008)
|
18
|
+
|
19
|
+
* using same logic as model spec in model test for scaffold
|
20
|
+
|
21
|
+
* simplifying model spec generated by scaffold
|
22
|
+
|
23
|
+
* adding error_messages_for to form partial
|
24
|
+
|
25
|
+
*0.1.3* (June 20th, 2008)
|
26
|
+
|
27
|
+
* using _url in controllers instead of _path
|
28
|
+
|
29
|
+
* improving the nifty_config default example YAML file
|
30
|
+
|
31
|
+
*0.1.2* (May 16th, 2008)
|
32
|
+
|
33
|
+
* mentioning nifty_layout in nifty_scaffold generator
|
34
|
+
|
35
|
+
* adding nifty_config generator
|
36
|
+
|
37
|
+
*0.1.1* (May 9th, 2008)
|
38
|
+
|
39
|
+
* adding tests and specs to scaffold generator
|
40
|
+
|
41
|
+
*0.1.0* (May 8th, 2008)
|
42
|
+
|
43
|
+
* 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,73 @@
|
|
1
|
+
CHANGELOG
|
2
|
+
lib/nifty_generators.rb
|
3
|
+
LICENSE
|
4
|
+
Manifest
|
5
|
+
rails_generators/nifty_config/nifty_config_generator.rb
|
6
|
+
rails_generators/nifty_config/templates/config.yml
|
7
|
+
rails_generators/nifty_config/templates/load_config.rb
|
8
|
+
rails_generators/nifty_config/USAGE
|
9
|
+
rails_generators/nifty_layout/nifty_layout_generator.rb
|
10
|
+
rails_generators/nifty_layout/templates/helper.rb
|
11
|
+
rails_generators/nifty_layout/templates/layout.html.erb
|
12
|
+
rails_generators/nifty_layout/templates/layout.html.haml
|
13
|
+
rails_generators/nifty_layout/templates/stylesheet.css
|
14
|
+
rails_generators/nifty_layout/templates/stylesheet.sass
|
15
|
+
rails_generators/nifty_layout/USAGE
|
16
|
+
rails_generators/nifty_scaffold/nifty_scaffold_generator.rb
|
17
|
+
rails_generators/nifty_scaffold/templates/actions/create.rb
|
18
|
+
rails_generators/nifty_scaffold/templates/actions/destroy.rb
|
19
|
+
rails_generators/nifty_scaffold/templates/actions/edit.rb
|
20
|
+
rails_generators/nifty_scaffold/templates/actions/index.rb
|
21
|
+
rails_generators/nifty_scaffold/templates/actions/new.rb
|
22
|
+
rails_generators/nifty_scaffold/templates/actions/show.rb
|
23
|
+
rails_generators/nifty_scaffold/templates/actions/update.rb
|
24
|
+
rails_generators/nifty_scaffold/templates/controller.rb
|
25
|
+
rails_generators/nifty_scaffold/templates/fixtures.yml
|
26
|
+
rails_generators/nifty_scaffold/templates/helper.rb
|
27
|
+
rails_generators/nifty_scaffold/templates/migration.rb
|
28
|
+
rails_generators/nifty_scaffold/templates/model.rb
|
29
|
+
rails_generators/nifty_scaffold/templates/tests/rspec/actions/create.rb
|
30
|
+
rails_generators/nifty_scaffold/templates/tests/rspec/actions/destroy.rb
|
31
|
+
rails_generators/nifty_scaffold/templates/tests/rspec/actions/edit.rb
|
32
|
+
rails_generators/nifty_scaffold/templates/tests/rspec/actions/index.rb
|
33
|
+
rails_generators/nifty_scaffold/templates/tests/rspec/actions/new.rb
|
34
|
+
rails_generators/nifty_scaffold/templates/tests/rspec/actions/show.rb
|
35
|
+
rails_generators/nifty_scaffold/templates/tests/rspec/actions/update.rb
|
36
|
+
rails_generators/nifty_scaffold/templates/tests/rspec/controller.rb
|
37
|
+
rails_generators/nifty_scaffold/templates/tests/rspec/model.rb
|
38
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/actions/create.rb
|
39
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/actions/destroy.rb
|
40
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/actions/edit.rb
|
41
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/actions/index.rb
|
42
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/actions/new.rb
|
43
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/actions/show.rb
|
44
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/actions/update.rb
|
45
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/controller.rb
|
46
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/model.rb
|
47
|
+
rails_generators/nifty_scaffold/templates/tests/testunit/actions/create.rb
|
48
|
+
rails_generators/nifty_scaffold/templates/tests/testunit/actions/destroy.rb
|
49
|
+
rails_generators/nifty_scaffold/templates/tests/testunit/actions/edit.rb
|
50
|
+
rails_generators/nifty_scaffold/templates/tests/testunit/actions/index.rb
|
51
|
+
rails_generators/nifty_scaffold/templates/tests/testunit/actions/new.rb
|
52
|
+
rails_generators/nifty_scaffold/templates/tests/testunit/actions/show.rb
|
53
|
+
rails_generators/nifty_scaffold/templates/tests/testunit/actions/update.rb
|
54
|
+
rails_generators/nifty_scaffold/templates/tests/testunit/controller.rb
|
55
|
+
rails_generators/nifty_scaffold/templates/tests/testunit/model.rb
|
56
|
+
rails_generators/nifty_scaffold/templates/views/erb/_form.html.erb
|
57
|
+
rails_generators/nifty_scaffold/templates/views/erb/edit.html.erb
|
58
|
+
rails_generators/nifty_scaffold/templates/views/erb/index.html.erb
|
59
|
+
rails_generators/nifty_scaffold/templates/views/erb/new.html.erb
|
60
|
+
rails_generators/nifty_scaffold/templates/views/erb/show.html.erb
|
61
|
+
rails_generators/nifty_scaffold/templates/views/haml/_form.html.haml
|
62
|
+
rails_generators/nifty_scaffold/templates/views/haml/edit.html.haml
|
63
|
+
rails_generators/nifty_scaffold/templates/views/haml/index.html.haml
|
64
|
+
rails_generators/nifty_scaffold/templates/views/haml/new.html.haml
|
65
|
+
rails_generators/nifty_scaffold/templates/views/haml/show.html.haml
|
66
|
+
rails_generators/nifty_scaffold/USAGE
|
67
|
+
README
|
68
|
+
tasks/deployment.rake
|
69
|
+
test/test_helper.rb
|
70
|
+
test/test_nifty_config_generator.rb
|
71
|
+
test/test_nifty_layout_generator.rb
|
72
|
+
test/test_nifty_scaffold_generator.rb
|
73
|
+
TODO
|
data/README
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
= Nifty Generators
|
2
|
+
|
3
|
+
A collection of useful Rails generator scripts by Ryan Bates.
|
4
|
+
|
5
|
+
|
6
|
+
== Install
|
7
|
+
|
8
|
+
gem install ryanb-nifty-generators --source=http://gems.github.com
|
9
|
+
|
10
|
+
|
11
|
+
== Usage
|
12
|
+
|
13
|
+
Once you install the gem, the generators will be available to all Rails
|
14
|
+
applications on your system. If you run script/generate without any
|
15
|
+
additional arguments you should see the available generators listed.
|
16
|
+
|
17
|
+
To run the generator, go to your rails project directory and call it
|
18
|
+
using the script/generate or script/destroy command.
|
19
|
+
|
20
|
+
script/generate nifty_scaffold Recipe name:string index new
|
21
|
+
|
22
|
+
|
23
|
+
== Included Generators
|
24
|
+
|
25
|
+
* nifty_layout: generates generic layout, stylesheet, and helper files.
|
26
|
+
* nifty_scaffold: generates a controller and optional model/migration.
|
27
|
+
* nifty_config: generates a config YAML file and loader.
|
28
|
+
|
29
|
+
Run the command with the --help option to learn more.
|
30
|
+
|
31
|
+
script/generate nifty_layout --help
|
32
|
+
|
33
|
+
|
34
|
+
== Troubleshooting
|
35
|
+
|
36
|
+
*I get "undefined method 'title'" error for nifty_scaffold.*
|
37
|
+
|
38
|
+
Try running nifty_layout too, that will generate this helper method. Or
|
39
|
+
you can just change the templates to whatever approach you prefer for
|
40
|
+
setting the title.
|
41
|
+
|
42
|
+
|
43
|
+
*Forms don't work for nifty_scaffold.*
|
44
|
+
|
45
|
+
Try restarting your development server. Sometimes it doesn't detect the
|
46
|
+
change in the routing.
|
47
|
+
|
48
|
+
|
49
|
+
*The tests/specs don't work for nifty_scaffold.*
|
50
|
+
|
51
|
+
Make sure you have mocha installed and require it in your spec/test helper.
|
52
|
+
|
53
|
+
gem install mocha
|
54
|
+
|
55
|
+
# in spec_helper.rb
|
56
|
+
config.mock_with :mocha
|
57
|
+
|
58
|
+
# in test_helper.rb
|
59
|
+
require 'mocha'
|
60
|
+
|
61
|
+
Also, make sure you're using edge rails (or 2.1 when released) as some methods require that.
|
62
|
+
|
63
|
+
|
64
|
+
== Development
|
65
|
+
|
66
|
+
This project can be found on github at the following URL.
|
67
|
+
|
68
|
+
http://github.com/ryanb/nifty-generators/
|
69
|
+
|
70
|
+
If you wish the generators behaved differently, please consider
|
71
|
+
forking the project and modifying to your heart's content.
|
data/TODO
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# Gem::Specification for Nifty-generators-0.1.7
|
2
|
+
# Originally generated by Echoe
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = %q{nifty-generators}
|
6
|
+
s.version = "0.1.7"
|
7
|
+
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
|
+
s.authors = ["Ryan Bates", "Kenneth Unitt"]
|
10
|
+
s.date = %q{2008-09-06}
|
11
|
+
s.description = %q{A collection of useful generator scripts for Rails.}
|
12
|
+
s.email = %q{unittk (at) gmail (dot) com}
|
13
|
+
s.extra_rdoc_files = ["CHANGELOG", "lib/nifty_generators.rb", "LICENSE", "README", "tasks/deployment.rake", "TODO"]
|
14
|
+
s.files = ["CHANGELOG", "lib/nifty_generators.rb", "LICENSE", "Manifest", "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", "README", "tasks/deployment.rake", "test/test_helper.rb", "test/test_nifty_config_generator.rb", "test/test_nifty_layout_generator.rb", "test/test_nifty_scaffold_generator.rb", "TODO", "nifty-generators.gemspec"]
|
15
|
+
s.has_rdoc = true
|
16
|
+
s.homepage = %q{http://github.com/ryanb/nifty-generators}
|
17
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Nifty-generators", "--main", "README"]
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
s.rubyforge_project = %q{nifty-generators}
|
20
|
+
s.rubygems_version = %q{1.2.0}
|
21
|
+
s.summary = %q{A collection of useful generator scripts for Rails.}
|
22
|
+
s.test_files = ["test/test_helper.rb", "test/test_nifty_config_generator.rb", "test/test_nifty_layout_generator.rb", "test/test_nifty_scaffold_generator.rb"]
|
23
|
+
|
24
|
+
if s.respond_to? :specification_version then
|
25
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
26
|
+
s.specification_version = 2
|
27
|
+
|
28
|
+
if current_version >= 3 then
|
29
|
+
else
|
30
|
+
end
|
31
|
+
else
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
# # Original Rakefile source (requires the Echoe gem):
|
37
|
+
#
|
38
|
+
# require 'rubygems'
|
39
|
+
# require 'rake'
|
40
|
+
# require 'echoe'
|
41
|
+
#
|
42
|
+
# Echoe.new('nifty-generators', '0.1.7') do |p|
|
43
|
+
# p.summary = "A collection of useful generator scripts for Rails."
|
44
|
+
# p.description = "A collection of useful generator scripts for Rails."
|
45
|
+
# p.url = "http://github.com/ryanb/nifty-generators"
|
46
|
+
# p.author = 'Ryan Bates'
|
47
|
+
# p.email = "ryan (at) railscasts (dot) com"
|
48
|
+
# p.ignore_pattern = ["script/*", "*.gemspec"]
|
49
|
+
# end
|
50
|
+
#
|
51
|
+
# Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Description:
|
2
|
+
The nifty_config generator creates YAML file in your config
|
3
|
+
directory and an initializer to load this config. The config has a
|
4
|
+
separate section for each environment. This is a great place to put
|
5
|
+
any config settings you don't want in your app.
|
6
|
+
|
7
|
+
The config is loaded into a constant called APP_CONFIG by default,
|
8
|
+
this changes depending on the name you choose to pass the generator.
|
9
|
+
Use this constant to access the config settings like this.
|
10
|
+
|
11
|
+
APP_CONFIG[:some_setting]
|
12
|
+
|
13
|
+
|
14
|
+
Examples:
|
15
|
+
script/generate nifty_config
|
16
|
+
|
17
|
+
Config: config/app_config.yml
|
18
|
+
Initializer: config/initializers/load_app_config.rb
|
19
|
+
|
20
|
+
script/generate nifty_config passwords
|
21
|
+
|
22
|
+
Config: config/passwords_config.yml
|
23
|
+
Initializer: config/initializers/load_passwords_config.rb
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class NiftyConfigGenerator < Rails::Generator::Base
|
2
|
+
def initialize(runtime_args, runtime_options = {})
|
3
|
+
super
|
4
|
+
@name = @args.first || 'app'
|
5
|
+
end
|
6
|
+
|
7
|
+
def manifest
|
8
|
+
record do |m|
|
9
|
+
m.directory 'config/initializers'
|
10
|
+
|
11
|
+
m.template "load_config.rb", "config/initializers/load_#{file_name}_config.rb"
|
12
|
+
m.file "config.yml", "config/#{file_name}_config.yml"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def file_name
|
17
|
+
@name.underscore
|
18
|
+
end
|
19
|
+
|
20
|
+
def constant_name
|
21
|
+
@name.underscore.upcase
|
22
|
+
end
|
23
|
+
|
24
|
+
protected
|
25
|
+
def banner
|
26
|
+
<<-EOS
|
27
|
+
Creates config and loader files.
|
28
|
+
|
29
|
+
USAGE: #{$0} #{spec.name} [config_name]
|
30
|
+
EOS
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
Description:
|
2
|
+
The nifty_layout generator creates a basic layout, stylesheet and
|
3
|
+
helper which will give some structure to a starting Rails app.
|
4
|
+
|
5
|
+
The generator takes one argument which will be the name of the
|
6
|
+
layout and stylesheet files. If no argument is passed then it defaults
|
7
|
+
to "application".
|
8
|
+
|
9
|
+
The helper module includes some methods which can be called in any
|
10
|
+
template or partial to set variables to be used in the layout, such as
|
11
|
+
page title and javascript/stylesheet includes.
|
12
|
+
|
13
|
+
Examples:
|
14
|
+
script/generate nifty_layout
|
15
|
+
|
16
|
+
Layout: app/views/layouts/application.html.erb
|
17
|
+
Stylesheet: public/stylesheets/application.css
|
18
|
+
Helper: app/helpers/layout_helper.rb
|
19
|
+
|
20
|
+
|
21
|
+
script/generate nifty_layout admin
|
22
|
+
|
23
|
+
Layout: app/views/layouts/admin.html.erb
|
24
|
+
Stylesheet: public/stylesheets/admin.css
|
25
|
+
Helper: app/helpers/layout_helper.rb
|
@@ -0,0 +1,44 @@
|
|
1
|
+
class NiftyLayoutGenerator < Rails::Generator::Base
|
2
|
+
def initialize(runtime_args, runtime_options = {})
|
3
|
+
super
|
4
|
+
@name = @args.first || 'application'
|
5
|
+
end
|
6
|
+
|
7
|
+
def manifest
|
8
|
+
record do |m|
|
9
|
+
m.directory 'app/views/layouts'
|
10
|
+
m.directory 'public/stylesheets'
|
11
|
+
m.directory 'app/helpers'
|
12
|
+
|
13
|
+
if options[:haml]
|
14
|
+
m.directory 'public/stylesheets/sass'
|
15
|
+
m.template "layout.html.haml", "app/views/layouts/#{file_name}.html.haml"
|
16
|
+
m.file "stylesheet.sass", "public/stylesheets/sass/#{file_name}.sass"
|
17
|
+
else
|
18
|
+
m.template "layout.html.erb", "app/views/layouts/#{file_name}.html.erb"
|
19
|
+
m.file "stylesheet.css", "public/stylesheets/#{file_name}.css"
|
20
|
+
end
|
21
|
+
m.file "helper.rb", "app/helpers/layout_helper.rb"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def file_name
|
26
|
+
@name.underscore
|
27
|
+
end
|
28
|
+
|
29
|
+
protected
|
30
|
+
|
31
|
+
def add_options!(opt)
|
32
|
+
opt.separator ''
|
33
|
+
opt.separator 'Options:'
|
34
|
+
opt.on("--haml", "Generate HAML for view, and SASS for stylesheet.") { |v| options[:haml] = v }
|
35
|
+
end
|
36
|
+
|
37
|
+
def banner
|
38
|
+
<<-EOS
|
39
|
+
Creates generic layout, stylesheet, and helper files.
|
40
|
+
|
41
|
+
USAGE: #{$0} #{spec.name} [layout_name]
|
42
|
+
EOS
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# These helper methods can be called in your template to set variables to be used in the layout
|
2
|
+
# This module should be included in all views globally,
|
3
|
+
# to do so you may need to add this line to your ApplicationController
|
4
|
+
# helper :layout
|
5
|
+
module LayoutHelper
|
6
|
+
def title(page_title, show_title = true)
|
7
|
+
@content_for_title = page_title.to_s
|
8
|
+
@show_title = show_title
|
9
|
+
end
|
10
|
+
|
11
|
+
def show_title?
|
12
|
+
@show_title
|
13
|
+
end
|
14
|
+
|
15
|
+
def stylesheet(*args)
|
16
|
+
content_for(:head) { stylesheet_link_tag(*args.map(&:to_s)) }
|
17
|
+
end
|
18
|
+
|
19
|
+
def javascript(*args)
|
20
|
+
args = args.map { |arg| arg == :defaults ? arg : arg.to_s }
|
21
|
+
content_for(:head) { javascript_include_tag(*args) }
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title><%%= h(yield(:title) || "Untitled") %></title>
|
6
|
+
<%%= stylesheet_link_tag '<%= file_name %>' %>
|
7
|
+
<%%= yield(:head) %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<div id="container">
|
11
|
+
<%%- flash.each do |name, msg| -%>
|
12
|
+
<%%= content_tag :div, msg, :id => "flash_#{name}" %>
|
13
|
+
<%%- end -%>
|
14
|
+
|
15
|
+
<%%- if show_title? -%>
|
16
|
+
<h1><%%=h yield(:title) %></h1>
|
17
|
+
<%%- end -%>
|
18
|
+
|
19
|
+
<%%= yield %>
|
20
|
+
</div>
|
21
|
+
</body>
|
22
|
+
</html>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
!!! Strict
|
2
|
+
%html{html_attrs}
|
3
|
+
|
4
|
+
%head
|
5
|
+
%title
|
6
|
+
= h(yield(:title) || "Untitled")
|
7
|
+
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
|
8
|
+
= stylesheet_link_tag '<%= file_name %>'
|
9
|
+
= yield(:head)
|
10
|
+
|
11
|
+
%body
|
12
|
+
#container
|
13
|
+
- flash.each do |name, msg|
|
14
|
+
= content_tag :div, msg, :id => "flash_#{name}"
|
15
|
+
|
16
|
+
- if show_title?
|
17
|
+
%h1=h yield(:title)
|
18
|
+
|
19
|
+
= yield
|
@@ -0,0 +1,80 @@
|
|
1
|
+
body {
|
2
|
+
background-color: #4B7399;
|
3
|
+
font-family: Verdana, Helvetica, Arial;
|
4
|
+
font-size: 14px;
|
5
|
+
}
|
6
|
+
|
7
|
+
a img {
|
8
|
+
border: none;
|
9
|
+
}
|
10
|
+
|
11
|
+
a {
|
12
|
+
color: #0000FF;
|
13
|
+
}
|
14
|
+
|
15
|
+
.clear {
|
16
|
+
clear: both;
|
17
|
+
height: 0px;
|
18
|
+
overflow: hidden;
|
19
|
+
}
|
20
|
+
|
21
|
+
#container {
|
22
|
+
width: 75%;
|
23
|
+
margin: 0 auto;
|
24
|
+
background-color: #FFF;
|
25
|
+
padding: 20px 40px;
|
26
|
+
border: solid 1px black;
|
27
|
+
margin-top: 20px;
|
28
|
+
}
|
29
|
+
|
30
|
+
#flash_notice, #flash_error {
|
31
|
+
padding: 5px 8px;
|
32
|
+
margin: 10px 0;
|
33
|
+
}
|
34
|
+
|
35
|
+
#flash_notice {
|
36
|
+
background-color: #CFC;
|
37
|
+
border: solid 1px #6C6;
|
38
|
+
}
|
39
|
+
|
40
|
+
#flash_error {
|
41
|
+
background-color: #FCC;
|
42
|
+
border: solid 1px #C66;
|
43
|
+
}
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
.fieldWithErrors {
|
48
|
+
display: inline;
|
49
|
+
}
|
50
|
+
|
51
|
+
#errorExplanation {
|
52
|
+
width: 400px;
|
53
|
+
border: 2px solid #CF0000;
|
54
|
+
padding: 0px;
|
55
|
+
padding-bottom: 12px;
|
56
|
+
margin-bottom: 20px;
|
57
|
+
background-color: #f0f0f0;
|
58
|
+
}
|
59
|
+
|
60
|
+
#errorExplanation h2 {
|
61
|
+
text-align: left;
|
62
|
+
font-weight: bold;
|
63
|
+
padding: 5px 5px 5px 15px;
|
64
|
+
font-size: 12px;
|
65
|
+
margin: 0px;
|
66
|
+
background-color: #c00;
|
67
|
+
color: #fff;
|
68
|
+
}
|
69
|
+
#errorExplanation p {
|
70
|
+
color: #333;
|
71
|
+
margin-bottom: 0;
|
72
|
+
padding: 8px;
|
73
|
+
}
|
74
|
+
#errorExplanation ul {
|
75
|
+
margin: 2px 24px;
|
76
|
+
}
|
77
|
+
#errorExplanation ul li {
|
78
|
+
font-size: 12px;
|
79
|
+
list-style: disc;
|
80
|
+
}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
!primary_color = #4B7399
|
2
|
+
|
3
|
+
body
|
4
|
+
:background-color = !primary_color
|
5
|
+
:font
|
6
|
+
:family Verdana, Helvetica, Arial
|
7
|
+
:size 14px
|
8
|
+
|
9
|
+
ul li
|
10
|
+
:list-style none
|
11
|
+
|
12
|
+
a
|
13
|
+
:color #0000FF
|
14
|
+
img
|
15
|
+
:border none
|
16
|
+
|
17
|
+
.clear
|
18
|
+
:clear both
|
19
|
+
:height 0px
|
20
|
+
:overflow hidden
|
21
|
+
|
22
|
+
#container
|
23
|
+
:width 75%
|
24
|
+
:margin 0 auto
|
25
|
+
:background #fff
|
26
|
+
:padding 20px 40px
|
27
|
+
:border solid 1px black
|
28
|
+
:margin-top 20px
|
29
|
+
|
30
|
+
#flash_notice,
|
31
|
+
#flash_error
|
32
|
+
:padding 5px 8px
|
33
|
+
:margin 10px 0
|
34
|
+
|
35
|
+
#flash_notice
|
36
|
+
:background-color #CFC
|
37
|
+
:border solid 1px #6C6
|
38
|
+
|
39
|
+
#flash_error
|
40
|
+
:background-color #FCC
|
41
|
+
:border solid 1px #C66
|
42
|
+
|
43
|
+
#errorExplanation
|
44
|
+
:width 400px
|
45
|
+
:border 2px solid #CF0000
|
46
|
+
:padding 0px
|
47
|
+
:padding-bottom 12px
|
48
|
+
:margin-bottom 20px
|
49
|
+
:background-color #f0f0f0
|
50
|
+
h2
|
51
|
+
:text-align left
|
52
|
+
:font-weight bold
|
53
|
+
:padding 5px 5px 5px 15px
|
54
|
+
:font-size 12px
|
55
|
+
:margin 0px
|
56
|
+
:background-color #c00
|
57
|
+
:color #fff
|
58
|
+
p
|
59
|
+
:color #333
|
60
|
+
:margin-bottom 0
|
61
|
+
:padding 8px
|
62
|
+
ul
|
63
|
+
:margin 2px 24px
|
64
|
+
li
|
65
|
+
:font-size 12px
|
66
|
+
:list-style disc
|