haml-rails 0.1 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/ruby.yml +64 -0
  3. data/.gitignore +7 -0
  4. data/Appraisals +19 -0
  5. data/Gemfile +6 -0
  6. data/LICENSE +21 -0
  7. data/README.md +64 -1
  8. data/Rakefile +12 -0
  9. data/gemfiles/rails_5_1.gemfile +8 -0
  10. data/gemfiles/rails_5_2.gemfile +8 -0
  11. data/gemfiles/rails_6_0.gemfile +8 -0
  12. data/gemfiles/rails_6_1.gemfile +8 -0
  13. data/gemfiles/rails_7_0.gemfile +8 -0
  14. data/haml-rails.gemspec +32 -0
  15. data/lib/generators/haml/controller/controller_generator.rb +5 -6
  16. data/lib/generators/haml/controller/templates/view.html.haml +1 -1
  17. data/lib/generators/haml/mailer/mailer_generator.rb +15 -0
  18. data/lib/generators/haml/mailer/templates/layout.html.haml +8 -0
  19. data/lib/generators/haml/mailer/templates/layout.text.haml +1 -0
  20. data/lib/generators/haml/mailer/templates/view.html.haml +4 -0
  21. data/lib/generators/haml/mailer/templates/view.text.haml +3 -0
  22. data/lib/generators/haml/scaffold/scaffold_generator.rb +11 -19
  23. data/lib/generators/haml/scaffold/templates/_form.html.haml +15 -0
  24. data/lib/generators/haml/scaffold/templates/edit.html.haml +7 -0
  25. data/lib/generators/haml/scaffold/templates/index.html.haml +25 -0
  26. data/lib/generators/haml/scaffold/templates/new.html.haml +5 -0
  27. data/lib/generators/haml/scaffold/templates/show.html.haml +11 -0
  28. data/lib/haml-rails/version.rb +5 -0
  29. data/lib/haml-rails.rb +58 -1
  30. data/lib/rails/generators/haml/application_layout/application_layout_generator.rb +32 -0
  31. data/lib/tasks/erb2haml.rake +83 -0
  32. data/test/fixtures/routes.rb +58 -0
  33. data/test/lib/generators/haml/controller_generator_test.rb +19 -0
  34. data/test/lib/generators/haml/mailer_generator_test.rb +87 -0
  35. data/test/lib/generators/haml/scaffold_generator_test.rb +32 -0
  36. data/test/test_helper.rb +47 -0
  37. metadata +187 -56
  38. data/lib/generators/haml/install/install_generator.rb +0 -14
  39. data/lib/generators/haml/install/templates/config/initializers/haml.rb.tt +0 -4
  40. data/lib/generators/haml/scaffold/templates/_form.html.haml.erb +0 -15
  41. data/lib/generators/haml/scaffold/templates/edit.html.haml.erb +0 -7
  42. data/lib/generators/haml/scaffold/templates/index.html.haml.erb +0 -23
  43. data/lib/generators/haml/scaffold/templates/new.html.haml.erb +0 -5
  44. data/lib/generators/haml/scaffold/templates/show.html.haml.erb +0 -9
  45. data/lib/generators/haml.rb +0 -9
@@ -0,0 +1,83 @@
1
+ namespace :haml do
2
+ desc 'Convert html.erb to html.haml each file in app/views'
3
+ task :erb2haml do
4
+
5
+ erb_files = Dir.glob('app/views/**/*.erb').select { |f| File.file? f}
6
+ haml_files = Dir.glob('app/views/**/*.haml').select { |f| File.file? f}
7
+
8
+ if erb_files.empty?
9
+ puts "No .erb files found. Task will now exit."
10
+ exit
11
+ end
12
+
13
+ erb_files_to_convert = erb_files.dup
14
+
15
+ haml_files_w_out_ext = haml_files.map { |f| f.gsub(/\.haml\z/, '') }
16
+
17
+ # Get a list of all those erb files that already seem to have .haml equivalents
18
+
19
+ already_existing = erb_files.select { |f| short = f.gsub(/\.erb\z/, ''); haml_files_w_out_ext.include?(short) }
20
+
21
+ puts '-'*80
22
+
23
+ if already_existing.any?
24
+ puts "Some of your .html.erb files seem to already have .haml equivalents:"
25
+ already_existing.map { |f| puts "\t#{f}" }
26
+
27
+ if ENV.has_key?("HAML_RAILS_OVERWRITE_HAML") && (ENV["HAML_RAILS_OVERWRITE_HAML"] == "false")
28
+ should_overwrite = 'n'
29
+ else
30
+ # Ask the user whether he/she would like to overwrite them.
31
+ begin
32
+ puts "Would you like to overwrite these .haml files? (y/n)"
33
+ should_overwrite = STDIN.gets.chomp.downcase[0]
34
+ end until ['y', 'n'].include?(should_overwrite)
35
+ end
36
+ puts '-'*80
37
+
38
+ # If we are not overwriting, remove each already_existing from our erb_files list
39
+ if should_overwrite == 'n'
40
+ erb_files_to_convert = erb_files - already_existing
41
+
42
+ if erb_files_to_convert.empty?
43
+ # It is possible no .erb files remain, after we remove already_existing
44
+ puts "No .erb files to convert"
45
+ end
46
+ else
47
+ # Delete the current .haml
48
+ already_existing.each { |f| File.delete(f.gsub(/\.erb\z/, '.haml')) }
49
+ end
50
+ end
51
+
52
+ erb_files_to_convert.each do |file|
53
+ puts "Generating HAML for #{file}..."
54
+ `html2haml #{file} #{file.gsub(/\.erb\z/, '.haml')}`
55
+ end
56
+
57
+ puts '-'*80
58
+
59
+ puts "HAML generated for the following files:"
60
+ erb_files_to_convert.each do |file|
61
+ puts "\t#{file}"
62
+ end
63
+
64
+ puts '-'*80
65
+ if ENV.has_key?("HAML_RAILS_DELETE_ERB") && (ENV["HAML_RAILS_DELETE_ERB"] == "true")
66
+ should_delete = 'y'
67
+ else
68
+ begin
69
+ puts 'Would you like to delete the original .erb files? (This is not recommended unless you are under version control.) (y/n)'
70
+ should_delete = STDIN.gets.chomp.downcase[0]
71
+ end until ['y', 'n'].include?(should_delete)
72
+ end
73
+ if should_delete == 'y'
74
+ puts "Deleting original .erb files."
75
+ File.delete(*erb_files)
76
+ else
77
+ puts "Please remember to delete your .erb files once you have ensured they were translated correctly."
78
+ end
79
+
80
+ puts '-'*80
81
+ puts "Task complete!"
82
+ end
83
+ end
@@ -0,0 +1,58 @@
1
+ TestApp.routes.draw do |map|
2
+ # The priority is based upon order of creation:
3
+ # first created -> highest priority.
4
+
5
+ # Sample of regular route:
6
+ # match 'products/:id' => 'catalog#view'
7
+ # Keep in mind you can assign values other than :controller and :action
8
+
9
+ # Sample of named route:
10
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
11
+ # This route can be invoked with purchase_url(:id => product.id)
12
+
13
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
14
+ # resources :products
15
+
16
+ # Sample resource route with options:
17
+ # resources :products do
18
+ # member do
19
+ # get :short
20
+ # post :toggle
21
+ # end
22
+ #
23
+ # collection do
24
+ # get :sold
25
+ # end
26
+ # end
27
+
28
+ # Sample resource route with sub-resources:
29
+ # resources :products do
30
+ # resources :comments, :sales
31
+ # resource :seller
32
+ # end
33
+
34
+ # Sample resource route with more complex sub-resources
35
+ # resources :products do
36
+ # resources :comments
37
+ # resources :sales do
38
+ # get :recent, :on => :collection
39
+ # end
40
+ # end
41
+
42
+ # Sample resource route within a namespace:
43
+ # namespace :admin do
44
+ # # Directs /admin/products/* to Admin::ProductsController
45
+ # # (app/controllers/admin/products_controller.rb)
46
+ # resources :products
47
+ # end
48
+
49
+ # You can have the root of your site routed with "root"
50
+ # just remember to delete public/index.html.
51
+ # root :to => "welcome#index"
52
+
53
+ # See how all your routes lay out with "rake routes"
54
+
55
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
56
+ # Note: This route will make all actions in every controller accessible via GET requests.
57
+ # match ':controller(/:action(/:id(.:format)))'
58
+ end
@@ -0,0 +1,19 @@
1
+ require 'test_helper'
2
+ require 'rails/generators/rails/controller/controller_generator'
3
+ require 'generators/haml/controller/controller_generator'
4
+
5
+ class Haml::Generators::ControllerGeneratorTest < Rails::Generators::TestCase
6
+ destination Rails.root
7
+ tests Rails::Generators::ControllerGenerator
8
+
9
+ setup :prepare_destination
10
+ setup :copy_routes
11
+
12
+ arguments %w(Account foo bar --template-engine haml)
13
+
14
+ test "should invoke haml engine" do
15
+ run_generator
16
+ assert_file "app/views/account/foo.html.haml"
17
+ assert_file "app/views/account/bar.html.haml"
18
+ end
19
+ end
@@ -0,0 +1,87 @@
1
+ require 'test_helper'
2
+ require 'rails/generators/mailer/mailer_generator'
3
+ require 'generators/haml/mailer/mailer_generator'
4
+
5
+ class Haml::Generators::MailerGeneratorTest < Rails::Generators::TestCase
6
+ destination File.join(Rails.root)
7
+ tests Rails::Generators::MailerGenerator
8
+ arguments %w(notifier foo bar --template-engine haml)
9
+
10
+ setup :prepare_destination
11
+ setup :copy_routes
12
+
13
+ test "should invoke template engine" do
14
+ run_generator
15
+
16
+ if ::Rails.version.to_s >= '4.2'
17
+ assert_file "app/views/layouts/mailer.text.haml" do |view|
18
+ assert_match(/\= yield/, view)
19
+ end
20
+
21
+ assert_file "app/views/layouts/mailer.html.haml" do |view|
22
+ assert_match(/\= yield/, view)
23
+ end
24
+
25
+ assert_file "app/views/notifier_mailer/foo.html.haml" do |view|
26
+ assert_match %r(app/views/notifier_mailer/foo\.html\.haml), view
27
+ assert_match(/\= @greeting/, view)
28
+ end
29
+
30
+ assert_file "app/views/notifier_mailer/bar.html.haml" do |view|
31
+ assert_match %r(app/views/notifier_mailer/bar\.html\.haml), view
32
+ assert_match(/\= @greeting/, view)
33
+ end
34
+
35
+ assert_file "app/views/notifier_mailer/foo.text.haml" do |view|
36
+ assert_match %r(app/views/notifier_mailer/foo\.text\.haml), view
37
+ assert_match(/\= @greeting/, view)
38
+ end
39
+
40
+ assert_file "app/views/notifier_mailer/bar.text.haml" do |view|
41
+ assert_match %r(app/views/notifier_mailer/bar\.text\.haml), view
42
+ assert_match(/\= @greeting/, view)
43
+ end
44
+ else
45
+ if ::Rails.version.to_s >= '4.1'
46
+ assert_file "app/views/notifier/foo.html.haml" do |view|
47
+ assert_match %r(app/views/notifier/foo\.html\.haml), view
48
+ assert_match(/\= @greeting/, view)
49
+ end
50
+
51
+ assert_file "app/views/notifier/bar.html.haml" do |view|
52
+ assert_match %r(app/views/notifier/bar\.html\.haml), view
53
+ assert_match(/\= @greeting/, view)
54
+ end
55
+ end
56
+
57
+ assert_file "app/views/notifier/foo.text.haml" do |view|
58
+ assert_match %r(app/views/notifier/foo\.text\.haml), view
59
+ assert_match(/\= @greeting/, view)
60
+ end
61
+
62
+ assert_file "app/views/notifier/bar.text.haml" do |view|
63
+ assert_match %r(app/views/notifier/bar\.text\.haml), view
64
+ assert_match(/\= @greeting/, view)
65
+ end
66
+ end
67
+ end
68
+
69
+ test 'suffix is not duplicated' do
70
+ if ::Rails.version.to_s >= '4.2'
71
+ run_generator ['notifier_mailer', 'foo', 'bar', '--template-engine', 'haml']
72
+
73
+ assert_no_file 'app/views/notifier_mailer_mailer/'
74
+ assert_file 'app/views/notifier_mailer/'
75
+
76
+ assert_no_file 'app/views/notifier_mailer_mailer/foo.text.haml'
77
+ assert_file 'app/views/notifier_mailer/foo.text.haml'
78
+ assert_no_file 'app/views/notifier_mailer_mailer/foo.html.haml'
79
+ assert_file 'app/views/notifier_mailer/foo.html.haml'
80
+
81
+ assert_no_file 'app/views/notifier_mailer_mailer/bar.text.haml'
82
+ assert_file 'app/views/notifier_mailer/bar.text.haml'
83
+ assert_no_file 'app/views/notifier_mailer_mailer/bar.html.haml'
84
+ assert_file 'app/views/notifier_mailer/bar.html.haml'
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,32 @@
1
+ require 'test_helper'
2
+ require 'rails/generators/rails/scaffold/scaffold_generator'
3
+ require 'generators/haml/scaffold/scaffold_generator'
4
+
5
+ class Haml::Generators::ScaffoldGeneratorTest < Rails::Generators::TestCase
6
+ destination File.join(Rails.root)
7
+ tests Rails::Generators::ScaffoldGenerator
8
+ arguments %w(product_line title:string price:integer --template-engine haml)
9
+
10
+ setup :prepare_destination
11
+ setup :copy_routes
12
+
13
+ test "should invoke template engine" do
14
+ run_generator
15
+
16
+ %w(index edit new show _form).each { |view| assert_file "app/views/product_lines/#{view}.html.haml" }
17
+ assert_no_file "app/views/layouts/product_lines.html.haml"
18
+ end
19
+
20
+ test "should revoke template engine" do
21
+ run_generator
22
+ run_generator ["product_line"], :behavior => :revoke
23
+
24
+ assert_no_file "app/views/product_lines"
25
+ assert_no_file "app/views/layouts/product_lines.html.haml"
26
+ end
27
+
28
+ test "should invoke form builder" do
29
+ run_generator %w(product_line title:string price:integer --template-engine haml --form-builder some-form-builder)
30
+ assert_no_file "app/views/product_lines/_form.html.haml"
31
+ end
32
+ end
@@ -0,0 +1,47 @@
1
+ require 'rubygems'
2
+ require 'minitest/autorun'
3
+ require 'action_pack'
4
+ require 'action_controller'
5
+ require 'action_view'
6
+ require 'rails'
7
+ require 'rails/generators'
8
+ require 'rails/generators/test_case'
9
+ Bundler.require(:default)
10
+
11
+ class TestApp < Rails::Application
12
+ config.root = File.dirname(__FILE__)
13
+ config.eager_load = false
14
+ end
15
+
16
+ module Rails
17
+ def self.root
18
+ @root ||= Pathname.new(File.expand_path(File.join(File.dirname(__FILE__), '..', 'tmp', 'rails')))
19
+ end
20
+ end
21
+
22
+ TestApp.initialize!
23
+
24
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
25
+
26
+ module Haml
27
+ module Rails
28
+ module GeneratorTestHelpers
29
+ private
30
+
31
+ def copy_routes
32
+ routes = File.join(File.dirname(__FILE__), 'fixtures', 'routes.rb')
33
+ destination = File.join(::Rails.root, "config")
34
+ FileUtils.mkdir_p(destination)
35
+ FileUtils.cp File.expand_path(routes), File.expand_path(destination)
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ ::Rails::Generators::TestCase.include Haml::Rails::GeneratorTestHelpers
42
+
43
+ # Remove tmp directory when test suite is completed
44
+ MiniTest.after_run do
45
+ tmp_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'tmp'))
46
+ FileUtils.rm_r(tmp_dir)
47
+ end
metadata CHANGED
@@ -1,76 +1,207 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: haml-rails
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- version: "0.1"
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.1.0
9
5
  platform: ruby
10
- authors:
11
- - "Andr\xC3\xA9 Arko"
12
- autorequire:
6
+ authors:
7
+ - André Arko
8
+ autorequire:
13
9
  bindir: bin
14
10
  cert_chain: []
15
-
16
- date: 2010-08-13 00:00:00 -07:00
17
- default_executable:
18
- dependencies: []
19
-
20
- description: Haml-rails provides Haml generators for Rails 3. It also enables Haml as the templating engine for you, so you don't have to screw around in your own application.rb when your Gemfile already clearly indicated what templating engine you have installed. Hurrah.
21
- email:
11
+ date: 2022-09-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: haml
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 4.0.6
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 4.0.6
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '5.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '5.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: actionpack
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '5.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '5.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: railties
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '5.1'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '5.1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: html2haml
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 1.0.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 1.0.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '5.1'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '5.1'
97
+ - !ruby/object:Gem::Dependency
98
+ name: bundler
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rake
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: appraisal
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description: Haml-rails provides Haml generators for Rails 5. It also enables Haml
140
+ as the templating engine for you, so you don't have to screw around in your own
141
+ application.rb when your Gemfile already clearly indicated what templating engine
142
+ you have installed. Hurrah.
143
+ email:
22
144
  - andre@arko.net
23
145
  executables: []
24
-
25
146
  extensions: []
26
-
27
147
  extra_rdoc_files: []
28
-
29
- files:
148
+ files:
149
+ - ".github/workflows/ruby.yml"
150
+ - ".gitignore"
151
+ - Appraisals
152
+ - Gemfile
153
+ - LICENSE
30
154
  - README.md
31
- - lib/generators/haml.rb
155
+ - Rakefile
156
+ - gemfiles/rails_5_1.gemfile
157
+ - gemfiles/rails_5_2.gemfile
158
+ - gemfiles/rails_6_0.gemfile
159
+ - gemfiles/rails_6_1.gemfile
160
+ - gemfiles/rails_7_0.gemfile
161
+ - haml-rails.gemspec
32
162
  - lib/generators/haml/controller/controller_generator.rb
33
163
  - lib/generators/haml/controller/templates/view.html.haml
34
- - lib/generators/haml/install/install_generator.rb
35
- - lib/generators/haml/install/templates/config/initializers/haml.rb.tt
164
+ - lib/generators/haml/mailer/mailer_generator.rb
165
+ - lib/generators/haml/mailer/templates/layout.html.haml
166
+ - lib/generators/haml/mailer/templates/layout.text.haml
167
+ - lib/generators/haml/mailer/templates/view.html.haml
168
+ - lib/generators/haml/mailer/templates/view.text.haml
36
169
  - lib/generators/haml/scaffold/scaffold_generator.rb
37
- - lib/generators/haml/scaffold/templates/_form.html.haml.erb
38
- - lib/generators/haml/scaffold/templates/edit.html.haml.erb
39
- - lib/generators/haml/scaffold/templates/index.html.haml.erb
40
- - lib/generators/haml/scaffold/templates/new.html.haml.erb
41
- - lib/generators/haml/scaffold/templates/show.html.haml.erb
170
+ - lib/generators/haml/scaffold/templates/_form.html.haml
171
+ - lib/generators/haml/scaffold/templates/edit.html.haml
172
+ - lib/generators/haml/scaffold/templates/index.html.haml
173
+ - lib/generators/haml/scaffold/templates/new.html.haml
174
+ - lib/generators/haml/scaffold/templates/show.html.haml
42
175
  - lib/haml-rails.rb
43
- has_rdoc: true
44
- homepage: http://github.com/indirect/haml-rails
45
- licenses: []
46
-
47
- post_install_message:
176
+ - lib/haml-rails/version.rb
177
+ - lib/rails/generators/haml/application_layout/application_layout_generator.rb
178
+ - lib/tasks/erb2haml.rake
179
+ - test/fixtures/routes.rb
180
+ - test/lib/generators/haml/controller_generator_test.rb
181
+ - test/lib/generators/haml/mailer_generator_test.rb
182
+ - test/lib/generators/haml/scaffold_generator_test.rb
183
+ - test/test_helper.rb
184
+ homepage: https://github.com/haml/haml-rails
185
+ licenses:
186
+ - MIT
187
+ metadata: {}
188
+ post_install_message:
48
189
  rdoc_options: []
49
-
50
- require_paths:
190
+ require_paths:
51
191
  - lib
52
- required_ruby_version: !ruby/object:Gem::Requirement
53
- requirements:
192
+ required_ruby_version: !ruby/object:Gem::Requirement
193
+ requirements:
54
194
  - - ">="
55
- - !ruby/object:Gem::Version
56
- segments:
57
- - 0
58
- version: "0"
59
- required_rubygems_version: !ruby/object:Gem::Requirement
60
- requirements:
195
+ - !ruby/object:Gem::Version
196
+ version: 2.3.0
197
+ required_rubygems_version: !ruby/object:Gem::Requirement
198
+ requirements:
61
199
  - - ">="
62
- - !ruby/object:Gem::Version
63
- segments:
64
- - 1
65
- - 3
66
- - 6
67
- version: 1.3.6
200
+ - !ruby/object:Gem::Version
201
+ version: 2.0.0
68
202
  requirements: []
69
-
70
- rubyforge_project: haml-rails
71
- rubygems_version: 1.3.6
72
- signing_key:
73
- specification_version: 3
203
+ rubygems_version: 3.4.0.dev
204
+ signing_key:
205
+ specification_version: 4
74
206
  summary: let your Gemfile do the configuring
75
207
  test_files: []
76
-
@@ -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,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