shoulda_machinist_generator 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (22) hide show
  1. data/VERSION +1 -1
  2. data/rails_generators/{shoulda_model → shoulda_machinist_model}/USAGE +4 -3
  3. data/rails_generators/{shoulda_model → shoulda_machinist_model}/shoulda_model_generator.rb +0 -0
  4. data/rails_generators/{shoulda_model → shoulda_machinist_model}/templates/blueprints.rb +0 -0
  5. data/rails_generators/{shoulda_model → shoulda_machinist_model}/templates/migration.rb +0 -0
  6. data/rails_generators/{shoulda_model → shoulda_machinist_model}/templates/model.rb +0 -0
  7. data/rails_generators/{shoulda_model → shoulda_machinist_model}/templates/unit_test.rb +0 -0
  8. data/rails_generators/{shoulda_scaffold → shoulda_machinist_scaffold}/USAGE +5 -4
  9. data/rails_generators/{shoulda_scaffold → shoulda_machinist_scaffold}/shoulda_scaffold_generator.rb +14 -13
  10. data/rails_generators/{shoulda_scaffold → shoulda_machinist_scaffold}/templates/blueprint/ie.css +0 -0
  11. data/rails_generators/{shoulda_scaffold → shoulda_machinist_scaffold}/templates/blueprint/print.css +0 -0
  12. data/rails_generators/{shoulda_scaffold → shoulda_machinist_scaffold}/templates/blueprint/screen.css +0 -0
  13. data/rails_generators/{shoulda_scaffold → shoulda_machinist_scaffold}/templates/controller.rb +0 -0
  14. data/rails_generators/{shoulda_scaffold → shoulda_machinist_scaffold}/templates/erb/_form.html.erb +0 -0
  15. data/rails_generators/{shoulda_scaffold → shoulda_machinist_scaffold}/templates/erb/edit.html.erb +0 -0
  16. data/rails_generators/{shoulda_scaffold → shoulda_machinist_scaffold}/templates/erb/index.html.erb +0 -0
  17. data/rails_generators/{shoulda_scaffold → shoulda_machinist_scaffold}/templates/erb/layout.html.erb +0 -0
  18. data/rails_generators/{shoulda_scaffold → shoulda_machinist_scaffold}/templates/erb/new.html.erb +0 -0
  19. data/rails_generators/{shoulda_scaffold → shoulda_machinist_scaffold}/templates/erb/show.html.erb +0 -0
  20. data/rails_generators/{shoulda_scaffold → shoulda_machinist_scaffold}/templates/functional_test/basic.rb +0 -0
  21. data/rails_generators/{shoulda_scaffold → shoulda_machinist_scaffold}/templates/helper.rb +0 -0
  22. metadata +21 -21
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.1.0
@@ -10,11 +10,11 @@ Description:
10
10
  sketch out a few so you can start working with the model immediately.
11
11
 
12
12
  This generates a model class in app/models, a unit test in test/unit,
13
- a test fixture in test/fixtures/singular_name.yml, and a migration in
13
+ adds a Machinist blueprint to test/blueprints.rb, and a migration in
14
14
  db/migrate.
15
15
 
16
16
  Examples:
17
- `./script/generate shoulda_model account`
17
+ `./script/generate shoulda_machinist_model account`
18
18
 
19
19
  creates an Account model, test, factory, and migration:
20
20
  Model: app/models/account.rb
@@ -22,6 +22,7 @@ Examples:
22
22
  Factory: test/factories/account_factory.rb
23
23
  Migration: db/migrate/XXX_add_accounts.rb
24
24
 
25
- `./script/generate shoulda_model post title:string body:text published:boolean`
25
+ `./script/generate shoulda_machinist_model post title:string body:text published:boolean`
26
26
 
27
27
  creates a Post model with a string title, text body, and published flag.
28
+
@@ -18,7 +18,7 @@ Description:
18
18
  the create/show/update/destroy, forms to create and edit your posts, and
19
19
  an index that lists them all, as well as a map.resources :posts
20
20
  declaration in config/routes.rb.
21
-
21
+
22
22
  You can override the default values for templating and
23
23
  functional\_test\_style by placing a .shoulda\_generator file in your home
24
24
  directory.
@@ -29,6 +29,7 @@ Description:
29
29
  :functional_test_syle: basic # supported options: should_be_restful|basic
30
30
 
31
31
  Examples:
32
- `./script/generate shoulda_scaffold post` # no attributes, view will be anemic
33
- `./script/generate shoulda_scaffold post title:string body:text published:boolean`
34
- `./script/generate shoulda_scaffold purchase order_id:integer amount:decimal`
32
+ `./script/generate shoulda_machinist_scaffold post` # no attributes, view will be anemic
33
+ `./script/generate shoulda_machinist_scaffold post title:string body:text published:boolean`
34
+ `./script/generate shoulda_machinist_scaffold purchase order_id:integer amount:decimal`
35
+
@@ -3,21 +3,21 @@
3
3
  # Thank you Chad Fowler, Rich Kilmer, Jim Weirich and others.
4
4
  #++
5
5
  class ShouldaScaffoldGeneratorConfig
6
-
6
+
7
7
  DEFAULT_TEMPLATING = 'erb'
8
8
  DEFAULT_FUNCTIONAL_TEST_STYLE = 'basic'
9
-
9
+
10
10
  def initialize()
11
11
  @config = load_file(config_file)
12
-
12
+
13
13
  @templating = @config[:templating] || DEFAULT_TEMPLATING
14
14
  @functional_test_style = @config[:functional_test_style] || DEFAULT_FUNCTIONAL_TEST_STYLE
15
15
  end
16
-
16
+
17
17
  attr_reader :templating, :functional_test_style
18
-
18
+
19
19
  private
20
-
20
+
21
21
  def load_file(filename)
22
22
  begin
23
23
  YAML.load(File.read(filename)) if filename and File.exist?(filename)
@@ -27,14 +27,14 @@ class ShouldaScaffoldGeneratorConfig
27
27
  warn "Failed to load #{config_file_name} due to permissions problem."
28
28
  end or {}
29
29
  end
30
-
30
+
31
31
  def config_file
32
32
  File.join(find_home, '.shoulda_generator')
33
33
  end
34
-
34
+
35
35
  ##
36
36
  # Finds the user's home directory.
37
-
37
+
38
38
  def find_home
39
39
  ['HOME', 'USERPROFILE'].each do |homekey|
40
40
  return ENV[homekey] if ENV[homekey]
@@ -73,9 +73,9 @@ class ShouldaScaffoldGenerator < Rails::Generator::NamedBase
73
73
 
74
74
  def initialize(runtime_args, runtime_options = {})
75
75
  super
76
-
76
+
77
77
  @configuration = ShouldaScaffoldGeneratorConfig.new
78
-
78
+
79
79
  @controller_name = @name.pluralize
80
80
 
81
81
  base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(@controller_name)
@@ -143,7 +143,7 @@ class ShouldaScaffoldGenerator < Rails::Generator::NamedBase
143
143
  protected
144
144
  # Override with your own usage banner.
145
145
  def banner
146
- "Usage: #{$0} scaffold ModelName [field:type, field:type]"
146
+ "Usage: #{$0} shoulda_machinist_scaffold ModelName [field:type, field:type]"
147
147
  end
148
148
 
149
149
  def add_options!(opt)
@@ -153,7 +153,7 @@ class ShouldaScaffoldGenerator < Rails::Generator::NamedBase
153
153
  "Don't add timestamps to the migration file for this model") { |v| options[:skip_timestamps] = v }
154
154
  opt.on("--skip-migration",
155
155
  "Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
156
-
156
+
157
157
  end
158
158
 
159
159
  def scaffold_views
@@ -164,3 +164,4 @@ class ShouldaScaffoldGenerator < Rails::Generator::NamedBase
164
164
  class_name.demodulize
165
165
  end
166
166
  end
167
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shoulda_machinist_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Hrycyszyn
@@ -28,26 +28,26 @@ files:
28
28
  - README.rdoc
29
29
  - Rakefile
30
30
  - VERSION
31
- - rails_generators/shoulda_model/USAGE
32
- - rails_generators/shoulda_model/shoulda_model_generator.rb
33
- - rails_generators/shoulda_model/templates/blueprints.rb
34
- - rails_generators/shoulda_model/templates/migration.rb
35
- - rails_generators/shoulda_model/templates/model.rb
36
- - rails_generators/shoulda_model/templates/unit_test.rb
37
- - rails_generators/shoulda_scaffold/USAGE
38
- - rails_generators/shoulda_scaffold/shoulda_scaffold_generator.rb
39
- - rails_generators/shoulda_scaffold/templates/blueprint/ie.css
40
- - rails_generators/shoulda_scaffold/templates/blueprint/print.css
41
- - rails_generators/shoulda_scaffold/templates/blueprint/screen.css
42
- - rails_generators/shoulda_scaffold/templates/controller.rb
43
- - rails_generators/shoulda_scaffold/templates/erb/_form.html.erb
44
- - rails_generators/shoulda_scaffold/templates/erb/edit.html.erb
45
- - rails_generators/shoulda_scaffold/templates/erb/index.html.erb
46
- - rails_generators/shoulda_scaffold/templates/erb/layout.html.erb
47
- - rails_generators/shoulda_scaffold/templates/erb/new.html.erb
48
- - rails_generators/shoulda_scaffold/templates/erb/show.html.erb
49
- - rails_generators/shoulda_scaffold/templates/functional_test/basic.rb
50
- - rails_generators/shoulda_scaffold/templates/helper.rb
31
+ - rails_generators/shoulda_machinist_model/USAGE
32
+ - rails_generators/shoulda_machinist_model/shoulda_model_generator.rb
33
+ - rails_generators/shoulda_machinist_model/templates/blueprints.rb
34
+ - rails_generators/shoulda_machinist_model/templates/migration.rb
35
+ - rails_generators/shoulda_machinist_model/templates/model.rb
36
+ - rails_generators/shoulda_machinist_model/templates/unit_test.rb
37
+ - rails_generators/shoulda_machinist_scaffold/USAGE
38
+ - rails_generators/shoulda_machinist_scaffold/shoulda_scaffold_generator.rb
39
+ - rails_generators/shoulda_machinist_scaffold/templates/blueprint/ie.css
40
+ - rails_generators/shoulda_machinist_scaffold/templates/blueprint/print.css
41
+ - rails_generators/shoulda_machinist_scaffold/templates/blueprint/screen.css
42
+ - rails_generators/shoulda_machinist_scaffold/templates/controller.rb
43
+ - rails_generators/shoulda_machinist_scaffold/templates/erb/_form.html.erb
44
+ - rails_generators/shoulda_machinist_scaffold/templates/erb/edit.html.erb
45
+ - rails_generators/shoulda_machinist_scaffold/templates/erb/index.html.erb
46
+ - rails_generators/shoulda_machinist_scaffold/templates/erb/layout.html.erb
47
+ - rails_generators/shoulda_machinist_scaffold/templates/erb/new.html.erb
48
+ - rails_generators/shoulda_machinist_scaffold/templates/erb/show.html.erb
49
+ - rails_generators/shoulda_machinist_scaffold/templates/functional_test/basic.rb
50
+ - rails_generators/shoulda_machinist_scaffold/templates/helper.rb
51
51
  - test/fixtures/about_yml_plugins/bad_about_yml/about.yml
52
52
  - test/fixtures/about_yml_plugins/bad_about_yml/init.rb
53
53
  - test/fixtures/about_yml_plugins/plugin_without_about_yml/init.rb