nifty-generators 0.1.7

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.
Files changed (76) hide show
  1. data/CHANGELOG +43 -0
  2. data/LICENSE +20 -0
  3. data/Manifest +74 -0
  4. data/README +75 -0
  5. data/Rakefile +16 -0
  6. data/TODO +7 -0
  7. data/lib/nifty_generators.rb +3 -0
  8. data/nifty-generators.gemspec +142 -0
  9. data/rails_generators/nifty_config/USAGE +23 -0
  10. data/rails_generators/nifty_config/nifty_config_generator.rb +32 -0
  11. data/rails_generators/nifty_config/templates/config.yml +8 -0
  12. data/rails_generators/nifty_config/templates/load_config.rb +2 -0
  13. data/rails_generators/nifty_layout/USAGE +25 -0
  14. data/rails_generators/nifty_layout/nifty_layout_generator.rb +44 -0
  15. data/rails_generators/nifty_layout/templates/helper.rb +23 -0
  16. data/rails_generators/nifty_layout/templates/layout.html.erb +22 -0
  17. data/rails_generators/nifty_layout/templates/layout.html.haml +19 -0
  18. data/rails_generators/nifty_layout/templates/stylesheet.css +80 -0
  19. data/rails_generators/nifty_layout/templates/stylesheet.sass +66 -0
  20. data/rails_generators/nifty_scaffold/USAGE +51 -0
  21. data/rails_generators/nifty_scaffold/nifty_scaffold_generator.rb +224 -0
  22. data/rails_generators/nifty_scaffold/templates/actions/create.rb +9 -0
  23. data/rails_generators/nifty_scaffold/templates/actions/destroy.rb +6 -0
  24. data/rails_generators/nifty_scaffold/templates/actions/edit.rb +3 -0
  25. data/rails_generators/nifty_scaffold/templates/actions/index.rb +3 -0
  26. data/rails_generators/nifty_scaffold/templates/actions/new.rb +3 -0
  27. data/rails_generators/nifty_scaffold/templates/actions/show.rb +3 -0
  28. data/rails_generators/nifty_scaffold/templates/actions/update.rb +9 -0
  29. data/rails_generators/nifty_scaffold/templates/controller.rb +3 -0
  30. data/rails_generators/nifty_scaffold/templates/fixtures.yml +9 -0
  31. data/rails_generators/nifty_scaffold/templates/helper.rb +2 -0
  32. data/rails_generators/nifty_scaffold/templates/migration.rb +16 -0
  33. data/rails_generators/nifty_scaffold/templates/model.rb +2 -0
  34. data/rails_generators/nifty_scaffold/templates/tests/rspec/actions/create.rb +11 -0
  35. data/rails_generators/nifty_scaffold/templates/tests/rspec/actions/destroy.rb +6 -0
  36. data/rails_generators/nifty_scaffold/templates/tests/rspec/actions/edit.rb +4 -0
  37. data/rails_generators/nifty_scaffold/templates/tests/rspec/actions/index.rb +4 -0
  38. data/rails_generators/nifty_scaffold/templates/tests/rspec/actions/new.rb +4 -0
  39. data/rails_generators/nifty_scaffold/templates/tests/rspec/actions/show.rb +4 -0
  40. data/rails_generators/nifty_scaffold/templates/tests/rspec/actions/update.rb +11 -0
  41. data/rails_generators/nifty_scaffold/templates/tests/rspec/controller.rb +8 -0
  42. data/rails_generators/nifty_scaffold/templates/tests/rspec/model.rb +7 -0
  43. data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/create.rb +13 -0
  44. data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/destroy.rb +8 -0
  45. data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/edit.rb +6 -0
  46. data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/index.rb +6 -0
  47. data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/new.rb +6 -0
  48. data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/show.rb +6 -0
  49. data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/update.rb +13 -0
  50. data/rails_generators/nifty_scaffold/templates/tests/shoulda/controller.rb +5 -0
  51. data/rails_generators/nifty_scaffold/templates/tests/shoulda/model.rb +7 -0
  52. data/rails_generators/nifty_scaffold/templates/tests/testunit/actions/create.rb +11 -0
  53. data/rails_generators/nifty_scaffold/templates/tests/testunit/actions/destroy.rb +6 -0
  54. data/rails_generators/nifty_scaffold/templates/tests/testunit/actions/edit.rb +4 -0
  55. data/rails_generators/nifty_scaffold/templates/tests/testunit/actions/index.rb +4 -0
  56. data/rails_generators/nifty_scaffold/templates/tests/testunit/actions/new.rb +4 -0
  57. data/rails_generators/nifty_scaffold/templates/tests/testunit/actions/show.rb +4 -0
  58. data/rails_generators/nifty_scaffold/templates/tests/testunit/actions/update.rb +11 -0
  59. data/rails_generators/nifty_scaffold/templates/tests/testunit/controller.rb +5 -0
  60. data/rails_generators/nifty_scaffold/templates/tests/testunit/model.rb +7 -0
  61. data/rails_generators/nifty_scaffold/templates/views/erb/_form.html.erb +10 -0
  62. data/rails_generators/nifty_scaffold/templates/views/erb/edit.html.erb +14 -0
  63. data/rails_generators/nifty_scaffold/templates/views/erb/index.html.erb +29 -0
  64. data/rails_generators/nifty_scaffold/templates/views/erb/new.html.erb +7 -0
  65. data/rails_generators/nifty_scaffold/templates/views/erb/show.html.erb +20 -0
  66. data/rails_generators/nifty_scaffold/templates/views/haml/_form.html.haml +11 -0
  67. data/rails_generators/nifty_scaffold/templates/views/haml/edit.html.haml +14 -0
  68. data/rails_generators/nifty_scaffold/templates/views/haml/index.html.haml +25 -0
  69. data/rails_generators/nifty_scaffold/templates/views/haml/new.html.haml +7 -0
  70. data/rails_generators/nifty_scaffold/templates/views/haml/show.html.haml +20 -0
  71. data/tasks/deployment.rake +2 -0
  72. data/test/test_helper.rb +117 -0
  73. data/test/test_nifty_config_generator.rb +37 -0
  74. data/test/test_nifty_layout_generator.rb +42 -0
  75. data/test/test_nifty_scaffold_generator.rb +532 -0
  76. metadata +140 -0
@@ -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.
@@ -0,0 +1,74 @@
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
+ Rakefile
68
+ README
69
+ tasks/deployment.rake
70
+ test/test_helper.rb
71
+ test/test_nifty_config_generator.rb
72
+ test/test_nifty_layout_generator.rb
73
+ test/test_nifty_scaffold_generator.rb
74
+ TODO
data/README ADDED
@@ -0,0 +1,75 @@
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
+
33
+ Run the command with the --help option to learn more.
34
+
35
+ script/generate nifty_layout --help
36
+
37
+
38
+ == Troubleshooting
39
+
40
+ *I get "undefined method 'title'" error for nifty_scaffold.*
41
+
42
+ Try running nifty_layout too, that will generate this helper method. Or
43
+ you can just change the templates to whatever approach you prefer for
44
+ setting the title.
45
+
46
+
47
+ *Forms don't work for nifty_scaffold.*
48
+
49
+ Try restarting your development server. Sometimes it doesn't detect the
50
+ change in the routing.
51
+
52
+
53
+ *The tests/specs don't work for nifty_scaffold.*
54
+
55
+ Make sure you have mocha installed and require it in your spec/test helper.
56
+
57
+ gem install mocha
58
+
59
+ # in spec_helper.rb
60
+ config.mock_with :mocha
61
+
62
+ # in test_helper.rb
63
+ require 'mocha'
64
+
65
+ Also, make sure you're using edge rails (or 2.1 when released) as some methods require that.
66
+
67
+
68
+ == Development
69
+
70
+ This project can be found on github at the following URL.
71
+
72
+ http://github.com/ryanb/nifty-generators/
73
+
74
+ If you wish the generators behaved differently, please consider
75
+ forking the project and modifying to your heart's content.
@@ -0,0 +1,16 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'echoe'
4
+
5
+ Echoe.new('nifty-generators', '0.1.7') do |p|
6
+ p.project = "niftygenerators"
7
+ p.summary = "A collection of useful generator scripts for Rails."
8
+ p.description = "A collection of useful generator scripts for Rails."
9
+ p.url = "http://github.com/ryanb/nifty-generators"
10
+ p.author = 'Ryan Bates'
11
+ p.email = "ryan (at) railscasts (dot) com"
12
+ p.ignore_pattern = ["script/*", "*.gemspec"]
13
+ p.development_dependencies = []
14
+ end
15
+
16
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
data/TODO ADDED
@@ -0,0 +1,7 @@
1
+
2
+ Nifty Scaffold Generator
3
+ - add some validation for attributes/action names
4
+ - refactor out long methods in scaffold generator
5
+
6
+ Nifty Config Generator
7
+ - make it easier to specify non environment specific configs
@@ -0,0 +1,3 @@
1
+ module NiftyGenerators
2
+ # nothing to see here, the real action is under rails_generators
3
+ end
@@ -0,0 +1,142 @@
1
+
2
+ # Gem::Specification for Nifty-generators-0.1.7
3
+ # Originally generated by Echoe
4
+
5
+ --- !ruby/object:Gem::Specification
6
+ name: nifty-generators
7
+ version: !ruby/object:Gem::Version
8
+ version: 0.1.7
9
+ platform: ruby
10
+ authors:
11
+ - Ryan Bates
12
+ autorequire:
13
+ bindir: bin
14
+
15
+ date: 2008-09-11 00:00:00 -07:00
16
+ default_executable:
17
+ dependencies: []
18
+
19
+ description: A collection of useful generator scripts for Rails.
20
+ email: ryan (at) railscasts (dot) com
21
+ executables: []
22
+
23
+ extensions: []
24
+
25
+ extra_rdoc_files:
26
+ - CHANGELOG
27
+ - lib/nifty_generators.rb
28
+ - LICENSE
29
+ - README
30
+ - tasks/deployment.rake
31
+ - TODO
32
+ files:
33
+ - CHANGELOG
34
+ - lib/nifty_generators.rb
35
+ - LICENSE
36
+ - Manifest
37
+ - rails_generators/nifty_config/nifty_config_generator.rb
38
+ - rails_generators/nifty_config/templates/config.yml
39
+ - rails_generators/nifty_config/templates/load_config.rb
40
+ - rails_generators/nifty_config/USAGE
41
+ - rails_generators/nifty_layout/nifty_layout_generator.rb
42
+ - rails_generators/nifty_layout/templates/helper.rb
43
+ - rails_generators/nifty_layout/templates/layout.html.erb
44
+ - rails_generators/nifty_layout/templates/layout.html.haml
45
+ - rails_generators/nifty_layout/templates/stylesheet.css
46
+ - rails_generators/nifty_layout/templates/stylesheet.sass
47
+ - rails_generators/nifty_layout/USAGE
48
+ - rails_generators/nifty_scaffold/nifty_scaffold_generator.rb
49
+ - rails_generators/nifty_scaffold/templates/actions/create.rb
50
+ - rails_generators/nifty_scaffold/templates/actions/destroy.rb
51
+ - rails_generators/nifty_scaffold/templates/actions/edit.rb
52
+ - rails_generators/nifty_scaffold/templates/actions/index.rb
53
+ - rails_generators/nifty_scaffold/templates/actions/new.rb
54
+ - rails_generators/nifty_scaffold/templates/actions/show.rb
55
+ - rails_generators/nifty_scaffold/templates/actions/update.rb
56
+ - rails_generators/nifty_scaffold/templates/controller.rb
57
+ - rails_generators/nifty_scaffold/templates/fixtures.yml
58
+ - rails_generators/nifty_scaffold/templates/helper.rb
59
+ - rails_generators/nifty_scaffold/templates/migration.rb
60
+ - rails_generators/nifty_scaffold/templates/model.rb
61
+ - rails_generators/nifty_scaffold/templates/tests/rspec/actions/create.rb
62
+ - rails_generators/nifty_scaffold/templates/tests/rspec/actions/destroy.rb
63
+ - rails_generators/nifty_scaffold/templates/tests/rspec/actions/edit.rb
64
+ - rails_generators/nifty_scaffold/templates/tests/rspec/actions/index.rb
65
+ - rails_generators/nifty_scaffold/templates/tests/rspec/actions/new.rb
66
+ - rails_generators/nifty_scaffold/templates/tests/rspec/actions/show.rb
67
+ - rails_generators/nifty_scaffold/templates/tests/rspec/actions/update.rb
68
+ - rails_generators/nifty_scaffold/templates/tests/rspec/controller.rb
69
+ - rails_generators/nifty_scaffold/templates/tests/rspec/model.rb
70
+ - rails_generators/nifty_scaffold/templates/tests/shoulda/actions/create.rb
71
+ - rails_generators/nifty_scaffold/templates/tests/shoulda/actions/destroy.rb
72
+ - rails_generators/nifty_scaffold/templates/tests/shoulda/actions/edit.rb
73
+ - rails_generators/nifty_scaffold/templates/tests/shoulda/actions/index.rb
74
+ - rails_generators/nifty_scaffold/templates/tests/shoulda/actions/new.rb
75
+ - rails_generators/nifty_scaffold/templates/tests/shoulda/actions/show.rb
76
+ - rails_generators/nifty_scaffold/templates/tests/shoulda/actions/update.rb
77
+ - rails_generators/nifty_scaffold/templates/tests/shoulda/controller.rb
78
+ - rails_generators/nifty_scaffold/templates/tests/shoulda/model.rb
79
+ - rails_generators/nifty_scaffold/templates/tests/testunit/actions/create.rb
80
+ - rails_generators/nifty_scaffold/templates/tests/testunit/actions/destroy.rb
81
+ - rails_generators/nifty_scaffold/templates/tests/testunit/actions/edit.rb
82
+ - rails_generators/nifty_scaffold/templates/tests/testunit/actions/index.rb
83
+ - rails_generators/nifty_scaffold/templates/tests/testunit/actions/new.rb
84
+ - rails_generators/nifty_scaffold/templates/tests/testunit/actions/show.rb
85
+ - rails_generators/nifty_scaffold/templates/tests/testunit/actions/update.rb
86
+ - rails_generators/nifty_scaffold/templates/tests/testunit/controller.rb
87
+ - rails_generators/nifty_scaffold/templates/tests/testunit/model.rb
88
+ - rails_generators/nifty_scaffold/templates/views/erb/_form.html.erb
89
+ - rails_generators/nifty_scaffold/templates/views/erb/edit.html.erb
90
+ - rails_generators/nifty_scaffold/templates/views/erb/index.html.erb
91
+ - rails_generators/nifty_scaffold/templates/views/erb/new.html.erb
92
+ - rails_generators/nifty_scaffold/templates/views/erb/show.html.erb
93
+ - rails_generators/nifty_scaffold/templates/views/haml/_form.html.haml
94
+ - rails_generators/nifty_scaffold/templates/views/haml/edit.html.haml
95
+ - rails_generators/nifty_scaffold/templates/views/haml/index.html.haml
96
+ - rails_generators/nifty_scaffold/templates/views/haml/new.html.haml
97
+ - rails_generators/nifty_scaffold/templates/views/haml/show.html.haml
98
+ - rails_generators/nifty_scaffold/USAGE
99
+ - Rakefile
100
+ - README
101
+ - tasks/deployment.rake
102
+ - test/test_helper.rb
103
+ - test/test_nifty_config_generator.rb
104
+ - test/test_nifty_layout_generator.rb
105
+ - test/test_nifty_scaffold_generator.rb
106
+ - TODO
107
+ - nifty-generators.gemspec
108
+ has_rdoc: true
109
+ homepage: http://github.com/ryanb/nifty-generators
110
+ post_install_message:
111
+ rdoc_options:
112
+ - --line-numbers
113
+ - --inline-source
114
+ - --title
115
+ - Nifty-generators
116
+ - --main
117
+ - README
118
+ require_paths:
119
+ - lib
120
+ required_ruby_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: "0"
125
+ version:
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "="
129
+ - !ruby/object:Gem::Version
130
+ version: "1.2"
131
+ version:
132
+ requirements: []
133
+
134
+ rubyforge_project: niftygenerators
135
+ rubygems_version: 1.2.0
136
+ specification_version: 2
137
+ summary: A collection of useful generator scripts for Rails.
138
+ test_files:
139
+ - test/test_helper.rb
140
+ - test/test_nifty_config_generator.rb
141
+ - test/test_nifty_layout_generator.rb
142
+ - test/test_nifty_scaffold_generator.rb
@@ -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