rails3-generators 0.12.1 → 0.13.0

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 (29) hide show
  1. data/.gitignore +1 -0
  2. data/CHANGELOG.rdoc +5 -0
  3. data/README.rdoc +7 -5
  4. data/Rakefile +3 -6
  5. data/VERSION +1 -1
  6. data/rails3-generators.gemspec +7 -35
  7. data/test/lib/generators/mustache/scaffold_generator_test.rb +18 -18
  8. data/test/test_helper.rb +4 -3
  9. metadata +8 -35
  10. data/.bundle/config +0 -2
  11. data/lib/generators/haml.rb +0 -9
  12. data/lib/generators/haml/controller/controller_generator.rb +0 -16
  13. data/lib/generators/haml/controller/templates/view.html.haml +0 -2
  14. data/lib/generators/haml/install/install_generator.rb +0 -14
  15. data/lib/generators/haml/install/templates/config/initializers/haml.rb.tt +0 -4
  16. data/lib/generators/haml/scaffold/scaffold_generator.rb +0 -43
  17. data/lib/generators/haml/scaffold/templates/_form.html.haml.erb +0 -15
  18. data/lib/generators/haml/scaffold/templates/edit.html.haml.erb +0 -7
  19. data/lib/generators/haml/scaffold/templates/index.html.haml.erb +0 -23
  20. data/lib/generators/haml/scaffold/templates/new.html.haml.erb +0 -5
  21. data/lib/generators/haml/scaffold/templates/show.html.haml.erb +0 -9
  22. data/lib/generators/jquery.rb +0 -9
  23. data/lib/generators/jquery/install/install_generator.rb +0 -32
  24. data/lib/generators/jquery/install/templates/README +0 -16
  25. data/test/lib/generators/haml/controller_generator_test.rb +0 -17
  26. data/test/lib/generators/haml/install_generator_test.rb +0 -16
  27. data/test/lib/generators/haml/scaffold_generator_test.rb +0 -31
  28. data/test/lib/generators/haml/testing_helper.rb +0 -1
  29. data/test/lib/generators/jquery/install_generator_test.rb +0 -23
data/.gitignore CHANGED
@@ -17,6 +17,7 @@ tmtags
17
17
  coverage
18
18
  rdoc
19
19
  pkg
20
+ .bundle
20
21
 
21
22
  ## PROJECT::SPECIFIC
22
23
  tmp/**/*
@@ -2,6 +2,11 @@
2
2
  * Grow Mustache up.(fix the TODOs and move the source to a mustache-rails like gem)
3
3
  * Write some documentation. (In both the github wiki and the source code)
4
4
 
5
+ == 0.13.0
6
+ * optimize
7
+ * The Haml generators have moved to {the haml-rails gem}[http://github.com/indirect/haml-rails].
8
+ * The jQuery generators have moved to {the jquery-rails gem}[http://github.com/indirect/jquery-rails].
9
+
5
10
  == 0.12.1
6
11
  * optimize
7
12
  * changed jqueryui option to --ui
@@ -1,6 +1,6 @@
1
1
  = rails3-generators
2
2
 
3
- Generators for DataMapper, Haml, Factory-girl, Authlogic, Mongomapper, Shoulda, Formtastic and SimpleForm
3
+ Generators for DataMapper, Factory-girl, Authlogic, Mongomapper, Shoulda, Formtastic and SimpleForm
4
4
 
5
5
  == install
6
6
 
@@ -12,6 +12,10 @@ and add the following to your project's Gemfile
12
12
 
13
13
  == notes
14
14
 
15
+ The Haml generators have moved to {the haml-rails gem}[http://github.com/indirect/haml-rails].
16
+
17
+ The jQuery generators have moved to {the jquery-rails gem}[http://github.com/indirect/jquery-rails].
18
+
15
19
  To avoid overriding the rails built-in Erb template generators this project uses the namespace Erubis for *.erb templates
16
20
 
17
21
  config.generators do |g|
@@ -19,7 +23,7 @@ To avoid overriding the rails built-in Erb template generators this project uses
19
23
  end
20
24
 
21
25
  == Note on Patches/Pull Requests
22
-
26
+
23
27
  * Fork the project.
24
28
  * Make your feature addition or bug fix.
25
29
  * Add tests for it. This is important so I don't break it in a
@@ -30,9 +34,7 @@ To avoid overriding the rails built-in Erb template generators this project uses
30
34
 
31
35
  == Contributors
32
36
 
33
- DataMapper generators: Jose Valim
34
-
35
- Haml: Paul Barry, Anuj Dutta, Louis T, Chris Rhoden
37
+ DataMapper: José Valim
36
38
 
37
39
  Factory Girl: Paul Barry
38
40
 
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ begin
9
9
 
10
10
  gem.name = "rails3-generators"
11
11
  gem.summary = %Q{Rails 3 compatible generators}
12
- gem.description = %Q{Rails 3 compatible generators for DataMapper, Haml, Factory-girl, Authlogic, Mongomapper, Mongoid, Shoulda, Formtastic and SimpleForm}
12
+ gem.description = %Q{Rails 3 compatible generators for DataMapper, Factory-girl, Authlogic, Mongomapper, Mongoid, Shoulda, Formtastic and SimpleForm}
13
13
  gem.email = "andre@arko.net"
14
14
  gem.homepage = "http://github.com/indirect/rails3-generators"
15
15
  gem.authors = ["Jose Valim", "Anuj Dutta", "Paul Berry", "Jeff Tucker", "Louis T.", "Jai-Gouk Kim", "Darcy Laycock", "Peter Haza", "Peter Gumeson", "Kristian Mandrup"]
@@ -20,11 +20,8 @@ rails3-generators-#{version}
20
20
  Be sure to check out the wiki, http://wiki.github.com/indirect/rails3-generators/,
21
21
  for information about recent changes to this project.
22
22
 
23
- note: ORM :datamapper has been renamed to :data_mapper
24
- note: ORM :mongomapper has been renamed to :mongo_mapper
25
-
26
- note: if you use erb templates add the follow to your generators block to take full advantage of this gem.
27
- g.template_engine :erubis
23
+ The Haml generators have moved to {the haml-rails gem}[http://github.com/indirect/haml-rails].
24
+ The jQuery generators have moved to {the jquery-rails gem}[http://github.com/indirect/jquery-rails].
28
25
 
29
26
  }
30
27
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.12.1
1
+ 0.13.0
@@ -5,19 +5,18 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rails3-generators}
8
- s.version = "0.12.1"
8
+ s.version = "0.13.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jose Valim", "Anuj Dutta", "Paul Berry", "Jeff Tucker", "Louis T.", "Jai-Gouk Kim", "Darcy Laycock", "Peter Haza", "Peter Gumeson", "Kristian Mandrup"]
12
- s.date = %q{2010-08-04}
13
- s.description = %q{Rails 3 compatible generators for DataMapper, Haml, Factory-girl, Authlogic, Mongomapper, Mongoid, Shoulda, Formtastic and SimpleForm}
12
+ s.date = %q{2010-08-26}
13
+ s.description = %q{Rails 3 compatible generators for DataMapper, Factory-girl, Authlogic, Mongomapper, Mongoid, Shoulda, Formtastic and SimpleForm}
14
14
  s.email = %q{andre@arko.net}
15
15
  s.extra_rdoc_files = [
16
16
  "README.rdoc"
17
17
  ]
18
18
  s.files = [
19
- ".bundle/config",
20
- ".gitignore",
19
+ ".gitignore",
21
20
  "CHANGELOG.rdoc",
22
21
  "Gemfile",
23
22
  "README.rdoc",
@@ -50,22 +49,8 @@ Gem::Specification.new do |s|
50
49
  "lib/generators/formtastic/scaffold/scaffold_generator.rb",
51
50
  "lib/generators/formtastic/scaffold/templates/_form.html.erb.erb",
52
51
  "lib/generators/formtastic/scaffold/templates/_form.html.haml.erb",
53
- "lib/generators/haml.rb",
54
- "lib/generators/haml/controller/controller_generator.rb",
55
- "lib/generators/haml/controller/templates/view.html.haml",
56
- "lib/generators/haml/install/install_generator.rb",
57
- "lib/generators/haml/install/templates/config/initializers/haml.rb.tt",
58
- "lib/generators/haml/scaffold/scaffold_generator.rb",
59
- "lib/generators/haml/scaffold/templates/_form.html.haml.erb",
60
- "lib/generators/haml/scaffold/templates/edit.html.haml.erb",
61
- "lib/generators/haml/scaffold/templates/index.html.haml.erb",
62
- "lib/generators/haml/scaffold/templates/new.html.haml.erb",
63
- "lib/generators/haml/scaffold/templates/show.html.haml.erb",
64
52
  "lib/generators/helpers/migration_helper.rb",
65
53
  "lib/generators/helpers/model_helper.rb",
66
- "lib/generators/jquery.rb",
67
- "lib/generators/jquery/install/install_generator.rb",
68
- "lib/generators/jquery/install/templates/README",
69
54
  "lib/generators/koala.rb",
70
55
  "lib/generators/koala/install/install_generator.rb",
71
56
  "lib/generators/koala/install/templates/app/helpers/facebook_helper.rb.tt",
@@ -128,11 +113,6 @@ Gem::Specification.new do |s|
128
113
  "test/lib/generators/erubis/scaffold_generator_test.rb",
129
114
  "test/lib/generators/factory_girl/model_generator_test.rb",
130
115
  "test/lib/generators/formtastic/scaffold_generators_test.rb",
131
- "test/lib/generators/haml/controller_generator_test.rb",
132
- "test/lib/generators/haml/install_generator_test.rb",
133
- "test/lib/generators/haml/scaffold_generator_test.rb",
134
- "test/lib/generators/haml/testing_helper.rb",
135
- "test/lib/generators/jquery/install_generator_test.rb",
136
116
  "test/lib/generators/koala/install_generator_test.rb",
137
117
  "test/lib/generators/machinist/model_generator_test.rb",
138
118
  "test/lib/generators/mongo_mapper/install_generator_test.rb",
@@ -151,16 +131,13 @@ Gem::Specification.new do |s|
151
131
  ]
152
132
  s.homepage = %q{http://github.com/indirect/rails3-generators}
153
133
  s.post_install_message = %q{
154
- rails3-generators-0.12.1
134
+ rails3-generators-0.13.0
155
135
 
156
136
  Be sure to check out the wiki, http://wiki.github.com/indirect/rails3-generators/,
157
137
  for information about recent changes to this project.
158
138
 
159
- note: ORM :datamapper has been renamed to :data_mapper
160
- note: ORM :mongomapper has been renamed to :mongo_mapper
161
-
162
- note: if you use erb templates add the follow to your generators block to take full advantage of this gem.
163
- g.template_engine :erubis
139
+ The Haml generators have moved to {the haml-rails gem}[http://github.com/indirect/haml-rails].
140
+ The jQuery generators have moved to {the jquery-rails gem}[http://github.com/indirect/jquery-rails].
164
141
 
165
142
  }
166
143
  s.rdoc_options = ["--charset=UTF-8"]
@@ -177,11 +154,6 @@ g.template_engine :erubis
177
154
  "test/lib/generators/erubis/scaffold_generator_test.rb",
178
155
  "test/lib/generators/factory_girl/model_generator_test.rb",
179
156
  "test/lib/generators/formtastic/scaffold_generators_test.rb",
180
- "test/lib/generators/haml/controller_generator_test.rb",
181
- "test/lib/generators/haml/install_generator_test.rb",
182
- "test/lib/generators/haml/scaffold_generator_test.rb",
183
- "test/lib/generators/haml/testing_helper.rb",
184
- "test/lib/generators/jquery/install_generator_test.rb",
185
157
  "test/lib/generators/koala/install_generator_test.rb",
186
158
  "test/lib/generators/machinist/model_generator_test.rb",
187
159
  "test/lib/generators/mongo_mapper/install_generator_test.rb",
@@ -45,17 +45,17 @@ class Mustache::Generators::ScaffoldGeneratorTest < Rails::Generators::TestCase
45
45
  test "should place attribute tags in the mustache template for show action" do
46
46
  run_generator
47
47
  assert_file "app/templates/product_lines/show.html.mustache",
48
- %r({{title}})
48
+ %r(\{\{title\}\})
49
49
  assert_file "app/templates/product_lines/show.html.mustache",
50
- %r({{price}})
50
+ %r(\{\{price\}\})
51
51
  end
52
52
 
53
53
  test "should place tags for edit path and index path in the mustache template for show action" do
54
54
  run_generator
55
55
  assert_file "app/templates/product_lines/show.html.mustache",
56
- %r({{edit_path}})
56
+ %r(\{\{edit_path\}\})
57
57
  assert_file "app/templates/product_lines/show.html.mustache",
58
- %r({{index_path}})
58
+ %r(\{\{index_path\}\})
59
59
  end
60
60
 
61
61
  ### INDEX
@@ -75,29 +75,29 @@ class Mustache::Generators::ScaffoldGeneratorTest < Rails::Generators::TestCase
75
75
  test "should place 'listing' loop tags in the mustache template for index action" do
76
76
  run_generator
77
77
  assert_file "app/templates/product_lines/index.html.mustache",
78
- %r({{#listing}})
78
+ %r(\{\{#listing\}\})
79
79
  assert_file "app/templates/product_lines/index.html.mustache",
80
- %r({{/listing}})
80
+ %r(\{\{/listing\}\})
81
81
  end
82
82
 
83
83
  test "should place a tag for each attribute in the mustache template for index action" do
84
84
  run_generator
85
85
  assert_file "app/templates/product_lines/index.html.mustache",
86
- %r({{title}})
86
+ %r(\{\{title\}\})
87
87
  assert_file "app/templates/product_lines/index.html.mustache",
88
- %r({{price}})
88
+ %r(\{\{price\}\})
89
89
  end
90
90
 
91
91
  test "should place a tag for the item's show link the mustache template for index action" do
92
92
  run_generator
93
93
  assert_file "app/templates/product_lines/index.html.mustache",
94
- %r({{show_path}})
94
+ %r(\{\{show_path\}\})
95
95
  end
96
96
 
97
97
  test "should place a tag for a new index link the mustache template for index action" do
98
98
  run_generator
99
99
  assert_file "app/templates/product_lines/index.html.mustache",
100
- %r({{new_path}})
100
+ %r(\{\{new_path\}\})
101
101
  end
102
102
 
103
103
 
@@ -106,13 +106,13 @@ class Mustache::Generators::ScaffoldGeneratorTest < Rails::Generators::TestCase
106
106
  test "should place attribute tags in the mustache template for form partial" do
107
107
  run_generator
108
108
  assert_file "app/templates/product_lines/_form.html.mustache",
109
- %r({{title_label}})
109
+ %r(\{\{title_label\}\})
110
110
  assert_file "app/templates/product_lines/_form.html.mustache",
111
- %r({{title_text_field}})
111
+ %r(\{\{title_text_field\}\})
112
112
  assert_file "app/templates/product_lines/_form.html.mustache",
113
- %r({{price_text_field}})
113
+ %r(\{\{price_text_field\}\})
114
114
  assert_file "app/templates/product_lines/_form.html.mustache",
115
- %r({{price_label}})
115
+ %r(\{\{price_label\}\})
116
116
  end
117
117
 
118
118
 
@@ -148,13 +148,13 @@ class Mustache::Generators::ScaffoldGeneratorTest < Rails::Generators::TestCase
148
148
  test "should place a new form tag in the mustache template for new action" do
149
149
  run_generator
150
150
  assert_file "app/templates/product_lines/new.html.mustache",
151
- %r({{product_line_form_tag}})
151
+ %r(\{\{product_line_form_tag\}\})
152
152
  end
153
153
 
154
154
  test "should place tags for index path in the mustache template for new action" do
155
155
  run_generator
156
156
  assert_file "app/templates/product_lines/new.html.mustache",
157
- %r({{index_path}})
157
+ %r(\{\{index_path\}\})
158
158
  end
159
159
 
160
160
 
@@ -190,13 +190,13 @@ class Mustache::Generators::ScaffoldGeneratorTest < Rails::Generators::TestCase
190
190
  test "should place a form tag in the mustache template for edit action" do
191
191
  run_generator
192
192
  assert_file "app/templates/product_lines/edit.html.mustache",
193
- %r({{product_line_form_tag}})
193
+ %r(\{\{product_line_form_tag\}\})
194
194
  end
195
195
 
196
196
  test "should place tags for show path in the mustache template for edit action" do
197
197
  run_generator
198
198
  assert_file "app/templates/product_lines/edit.html.mustache",
199
- %r({{show_path}})
199
+ %r(\{\{show_path\}\})
200
200
  end
201
201
 
202
202
  end
@@ -1,4 +1,5 @@
1
1
  require 'rubygems'
2
+ gem 'test-unit'
2
3
  require 'test/unit'
3
4
  require 'rails/all'
4
5
  require 'rails/generators'
@@ -53,7 +54,7 @@ def generator_list
53
54
  :machinist => ['model'],
54
55
  :authlogic => ['session'],
55
56
  :jquery => ['install'],
56
- :koala => ['install'],
57
+ :koala => ['install'],
57
58
  :shoulda => ['controller']
58
59
  }
59
60
  end
@@ -63,7 +64,7 @@ def path_prefix(name)
63
64
  when :rails
64
65
  'rails/generators'
65
66
  else
66
- 'generators'
67
+ 'generators'
67
68
  end
68
69
  end
69
70
 
@@ -71,7 +72,7 @@ def require_generators(generator_list)
71
72
  generator_list.each do |name, generators|
72
73
  generators.each do |generator_name|
73
74
  require File.join(path_prefix(name), name.to_s, generator_name.to_s, "#{generator_name}_generator")
74
- end
75
+ end
75
76
  end
76
77
  end
77
78
  alias :require_generator :require_generators
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 12
8
- - 1
9
- version: 0.12.1
7
+ - 13
8
+ - 0
9
+ version: 0.13.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jose Valim
@@ -23,11 +23,11 @@ autorequire:
23
23
  bindir: bin
24
24
  cert_chain: []
25
25
 
26
- date: 2010-08-04 00:00:00 -04:00
26
+ date: 2010-08-26 00:00:00 -04:00
27
27
  default_executable:
28
28
  dependencies: []
29
29
 
30
- description: Rails 3 compatible generators for DataMapper, Haml, Factory-girl, Authlogic, Mongomapper, Mongoid, Shoulda, Formtastic and SimpleForm
30
+ description: Rails 3 compatible generators for DataMapper, Factory-girl, Authlogic, Mongomapper, Mongoid, Shoulda, Formtastic and SimpleForm
31
31
  email: andre@arko.net
32
32
  executables: []
33
33
 
@@ -36,7 +36,6 @@ extensions: []
36
36
  extra_rdoc_files:
37
37
  - README.rdoc
38
38
  files:
39
- - .bundle/config
40
39
  - .gitignore
41
40
  - CHANGELOG.rdoc
42
41
  - Gemfile
@@ -70,22 +69,8 @@ files:
70
69
  - lib/generators/formtastic/scaffold/scaffold_generator.rb
71
70
  - lib/generators/formtastic/scaffold/templates/_form.html.erb.erb
72
71
  - lib/generators/formtastic/scaffold/templates/_form.html.haml.erb
73
- - lib/generators/haml.rb
74
- - lib/generators/haml/controller/controller_generator.rb
75
- - lib/generators/haml/controller/templates/view.html.haml
76
- - lib/generators/haml/install/install_generator.rb
77
- - lib/generators/haml/install/templates/config/initializers/haml.rb.tt
78
- - lib/generators/haml/scaffold/scaffold_generator.rb
79
- - lib/generators/haml/scaffold/templates/_form.html.haml.erb
80
- - lib/generators/haml/scaffold/templates/edit.html.haml.erb
81
- - lib/generators/haml/scaffold/templates/index.html.haml.erb
82
- - lib/generators/haml/scaffold/templates/new.html.haml.erb
83
- - lib/generators/haml/scaffold/templates/show.html.haml.erb
84
72
  - lib/generators/helpers/migration_helper.rb
85
73
  - lib/generators/helpers/model_helper.rb
86
- - lib/generators/jquery.rb
87
- - lib/generators/jquery/install/install_generator.rb
88
- - lib/generators/jquery/install/templates/README
89
74
  - lib/generators/koala.rb
90
75
  - lib/generators/koala/install/install_generator.rb
91
76
  - lib/generators/koala/install/templates/app/helpers/facebook_helper.rb.tt
@@ -148,11 +133,6 @@ files:
148
133
  - test/lib/generators/erubis/scaffold_generator_test.rb
149
134
  - test/lib/generators/factory_girl/model_generator_test.rb
150
135
  - test/lib/generators/formtastic/scaffold_generators_test.rb
151
- - test/lib/generators/haml/controller_generator_test.rb
152
- - test/lib/generators/haml/install_generator_test.rb
153
- - test/lib/generators/haml/scaffold_generator_test.rb
154
- - test/lib/generators/haml/testing_helper.rb
155
- - test/lib/generators/jquery/install_generator_test.rb
156
136
  - test/lib/generators/koala/install_generator_test.rb
157
137
  - test/lib/generators/machinist/model_generator_test.rb
158
138
  - test/lib/generators/mongo_mapper/install_generator_test.rb
@@ -173,13 +153,11 @@ homepage: http://github.com/indirect/rails3-generators
173
153
  licenses: []
174
154
 
175
155
  post_install_message: "\n\
176
- rails3-generators-0.12.1\n\n\
156
+ rails3-generators-0.13.0\n\n\
177
157
  Be sure to check out the wiki, http://wiki.github.com/indirect/rails3-generators/,\n\
178
158
  for information about recent changes to this project.\n \n\
179
- note: ORM :datamapper has been renamed to :data_mapper\n\
180
- note: ORM :mongomapper has been renamed to :mongo_mapper\n\n\
181
- note: if you use erb templates add the follow to your generators block to take full advantage of this gem.\n\
182
- g.template_engine :erubis\n\n"
159
+ The Haml generators have moved to {the haml-rails gem}[http://github.com/indirect/haml-rails].\n\
160
+ The jQuery generators have moved to {the jquery-rails gem}[http://github.com/indirect/jquery-rails].\n\n"
183
161
  rdoc_options:
184
162
  - --charset=UTF-8
185
163
  require_paths:
@@ -217,11 +195,6 @@ test_files:
217
195
  - test/lib/generators/erubis/scaffold_generator_test.rb
218
196
  - test/lib/generators/factory_girl/model_generator_test.rb
219
197
  - test/lib/generators/formtastic/scaffold_generators_test.rb
220
- - test/lib/generators/haml/controller_generator_test.rb
221
- - test/lib/generators/haml/install_generator_test.rb
222
- - test/lib/generators/haml/scaffold_generator_test.rb
223
- - test/lib/generators/haml/testing_helper.rb
224
- - test/lib/generators/jquery/install_generator_test.rb
225
198
  - test/lib/generators/koala/install_generator_test.rb
226
199
  - test/lib/generators/machinist/model_generator_test.rb
227
200
  - test/lib/generators/mongo_mapper/install_generator_test.rb
@@ -1,2 +0,0 @@
1
- ---
2
- BUNDLE_WITHOUT: ""
@@ -1,9 +0,0 @@
1
- module Haml
2
- module Generators
3
- module TemplatePath
4
- def source_root
5
- @_haml_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'haml', generator_name, 'templates'))
6
- end
7
- end
8
- end
9
- end
@@ -1,16 +0,0 @@
1
- require 'generators/haml'
2
- require 'rails/generators/erb/controller/controller_generator'
3
-
4
- module Haml
5
- module Generators
6
- class ControllerGenerator < Erb::Generators::ControllerGenerator
7
- extend TemplatePath
8
-
9
- protected
10
-
11
- def handler
12
- :haml
13
- end
14
- end
15
- end
16
- end
@@ -1,2 +0,0 @@
1
- %h1 <%= class_name %>#<%= @action %>
2
- %p Find me in <%= @path %>
@@ -1,14 +0,0 @@
1
- require 'generators/haml'
2
-
3
- module Haml
4
- module Generators
5
- class InstallGenerator < Rails::Generators::Base
6
- extend TemplatePath
7
-
8
- def copy_initializer_files
9
- template "config/initializers/haml.rb.tt", "config/initializers/haml.rb"
10
- end
11
-
12
- end
13
- end
14
- end
@@ -1,4 +0,0 @@
1
- # Load Haml and Sass.
2
- Haml.init_rails(binding) if defined?(Haml)
3
-
4
- Haml::Template.options[:format] = :html5
@@ -1,43 +0,0 @@
1
- require 'generators/haml'
2
- require 'rails/generators/erb/scaffold/scaffold_generator'
3
-
4
- module Haml
5
- module Generators
6
- class ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
7
- extend TemplatePath
8
-
9
- def copy_view_files
10
- views = available_views
11
- views.delete("index") if options[:singleton]
12
-
13
- views.each do |view|
14
- filename = filename_with_extensions(view)
15
- template template_filename_with_extensions(view), File.join("app/views", controller_file_path, filename)
16
- end
17
- end
18
-
19
- hook_for :form_builder, :as => :scaffold
20
-
21
- def copy_form_file
22
- if options[:form_builder].nil?
23
- filename = filename_with_extensions("_form")
24
- template template_filename_with_extensions("_form"), File.join("app/views", controller_file_path, filename)
25
- end
26
- end
27
-
28
- protected
29
-
30
- def available_views
31
- %w(index edit show new)
32
- end
33
-
34
- def handler
35
- :haml
36
- end
37
-
38
- def template_filename_with_extensions(name)
39
- [name, format, handler, :erb].compact.join(".")
40
- end
41
- end
42
- end
43
- end
@@ -1,15 +0,0 @@
1
- = form_for @<%= singular_name %> do |f|
2
- -if @<%= singular_name %>.errors.any?
3
- #errorExplanation
4
- %h2= "#{pluralize(@<%= singular_name %>.errors.count, "error")} prohibited this <%= singular_name %> from being saved:"
5
- %ul
6
- - @<%= singular_name %>.errors.full_messages.each do |msg|
7
- %li= msg
8
-
9
- <% for attribute in attributes -%>
10
- .field
11
- = f.label :<%= attribute.name %>
12
- = f.<%= attribute.field_type %> :<%= attribute.name %>
13
- <% end -%>
14
- .actions
15
- = f.submit 'Save'
@@ -1,7 +0,0 @@
1
- %h1 Editing <%= singular_name %>
2
-
3
- = render 'form'
4
-
5
- = link_to 'Show', @<%= singular_name %>
6
- \|
7
- = link_to 'Back', <%= plural_name %>_path
@@ -1,23 +0,0 @@
1
- %h1 Listing <%= plural_name %>
2
-
3
- %table
4
- %tr
5
- <% for attribute in attributes -%>
6
- %th <%= attribute.human_name %>
7
- <% end -%>
8
- %th
9
- %th
10
- %th
11
-
12
- - @<%= plural_name %>.each do |<%= singular_name %>|
13
- %tr
14
- <% for attribute in attributes -%>
15
- %td= <%= singular_name %>.<%= attribute.name %>
16
- <% end -%>
17
- %td= link_to 'Show', <%= singular_name %>
18
- %td= link_to 'Edit', edit_<%= singular_name %>_path(<%= singular_name %>)
19
- %td= link_to 'Destroy', <%= singular_name %>, :confirm => 'Are you sure?', :method => :delete
20
-
21
- %br
22
-
23
- = link_to 'New <%= singular_name %>', new_<%= singular_name %>_path
@@ -1,5 +0,0 @@
1
- %h1 New <%= singular_name %>
2
-
3
- = render 'form'
4
-
5
- = link_to 'Back', <%= plural_name %>_path
@@ -1,9 +0,0 @@
1
- <% for attribute in attributes -%>
2
- %p
3
- %b <%= attribute.human_name %>:
4
- = @<%= singular_name %>.<%= attribute.name %>
5
- <% end -%>
6
-
7
- = link_to 'Edit', edit_<%= singular_name %>_path(@<%= singular_name %>)
8
- \|
9
- = link_to 'Back', <%= plural_name %>_path
@@ -1,9 +0,0 @@
1
- module Jquery
2
- module Generators
3
- module TemplatePath
4
- def source_root
5
- @_jquery_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'jquery', generator_name, 'templates'))
6
- end
7
- end
8
- end
9
- end
@@ -1,32 +0,0 @@
1
- require 'generators/jquery'
2
-
3
- module Jquery
4
- module Generators
5
- class InstallGenerator < Rails::Generators::Base
6
- extend TemplatePath
7
-
8
- class_option :ui, :type => :boolean, :default => false, :desc => "Indicates when to Include JQueryUI (minified version; source: Google Libraries API)"
9
-
10
- def download_jquery_files
11
- %w(controls.js dragdrop.js effects.js prototype.js rails.js).each do |js|
12
- remove_file "public/javascripts/#{js}"
13
- end
14
-
15
- # Downloading latest jQuery.min
16
- get "http://code.jquery.com/jquery-latest.min.js", "public/javascripts/jquery.js"
17
-
18
- # Downloading latest jQuery drivers
19
- get "http://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js"
20
- end
21
-
22
- def download_jqueryui_files
23
- # Downloading latest jQueryUI minified
24
- get "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js", "public/javascripts/jqueryui.js" if options.ui?
25
- end
26
-
27
- def show_readme
28
- readme "README"
29
- end
30
- end
31
- end
32
- end
@@ -1,16 +0,0 @@
1
-
2
- ===============================================================================
3
-
4
- Some manual steps you have to do
5
-
6
- 1. Uncomment or add the following to you application.rb file:
7
-
8
- config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
9
-
10
- or if you used included jquery ui
11
-
12
- config.action_view.javascript_expansions[:defaults] = %w(jquery jqueryui rails)
13
-
14
- 2. Rerun the generator to update the javascript files
15
-
16
- ===============================================================================
@@ -1,17 +0,0 @@
1
- require 'test_helper'
2
- require 'lib/generators/haml/testing_helper'
3
-
4
- class Haml::Generators::ControllerGeneratorTest < Rails::Generators::TestCase
5
- destination File.join(Rails.root)
6
- tests Rails::Generators::ControllerGenerator
7
- arguments %w(Account foo bar --template-engine haml)
8
-
9
- setup :prepare_destination
10
- setup :copy_routes
11
-
12
- test "should invoke template engine" do
13
- run_generator
14
- assert_file "app/views/account/foo.html.haml", %r(app/views/account/foo\.html\.haml)
15
- assert_file "app/views/account/bar.html.haml", %r(app/views/account/bar\.html\.haml)
16
- end
17
- end
@@ -1,16 +0,0 @@
1
- require 'test_helper'
2
- require 'lib/generators/haml/testing_helper'
3
-
4
- class Haml::Generators::InstallGeneratorTest < Rails::Generators::TestCase
5
- destination File.join(Rails.root)
6
- tests Haml::Generators::InstallGenerator
7
- arguments []
8
-
9
- setup :prepare_destination
10
-
11
- test 'haml is installed' do
12
- run_generator
13
-
14
- assert_file "config/initializers/haml.rb"
15
- end
16
- end
@@ -1,31 +0,0 @@
1
- require 'test_helper'
2
- require 'lib/generators/haml/testing_helper'
3
-
4
- class Haml::Generators::ScaffoldGeneratorTest < Rails::Generators::TestCase
5
- destination File.join(Rails.root)
6
- tests Rails::Generators::ScaffoldGenerator
7
- arguments %w(product_line title:string price:integer --template-engine haml)
8
-
9
- setup :prepare_destination
10
- setup :copy_routes
11
-
12
- test "should invoke template engine" do
13
- run_generator
14
-
15
- %w(index edit new show _form).each { |view| assert_file "app/views/product_lines/#{view}.html.haml" }
16
- assert_no_file "app/views/layouts/product_lines.html.haml"
17
- end
18
-
19
- test "should revoke template engine" do
20
- run_generator
21
- run_generator ["product_line"], :behavior => :revoke
22
-
23
- assert_no_file "app/views/product_lines"
24
- assert_no_file "app/views/layouts/product_lines.html.haml"
25
- end
26
-
27
- test "should invoke form builder" do
28
- run_generator %w(product_line title:string price:integer --template-engine haml --form-builder some-form-builder)
29
- assert_no_file "app/views/product_lines/_form.html.haml"
30
- end
31
- end
@@ -1 +0,0 @@
1
- require_generators :haml => ['scaffold', 'controller', 'install']
@@ -1,23 +0,0 @@
1
- require 'test_helper'
2
-
3
- class Jquery::Generators::InstallGeneratorTest < Rails::Generators::TestCase
4
- destination File.join(Rails.root)
5
- tests Jquery::Generators::InstallGenerator
6
- arguments []
7
-
8
- setup :prepare_destination
9
-
10
- test 'jquery is installed' do
11
- run_generator
12
-
13
- %w(jquery.js rails.js).each { |js| assert_file "public/javascripts/#{js}" }
14
- %w(controls.js dragdrop.js effects.js prototype.js).each { |js| assert_no_file "public/javascripts/#{js}" }
15
- end
16
-
17
- test 'jquery is installed with jqueyui' do
18
- run_generator %w(--ui)
19
-
20
- %w(jquery.js jqueryui.js rails.js).each { |js| assert_file "public/javascripts/#{js}" }
21
- %w(controls.js dragdrop.js effects.js prototype.js).each { |js| assert_no_file "public/javascripts/#{js}" }
22
- end
23
- end