haml-rails 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +15 -22
- data/Appraisals +12 -0
- data/README.md +10 -7
- data/gemfiles/{rails_4_0.gemfile → rails_5_1.gemfile} +1 -1
- data/gemfiles/{rails_4_1.gemfile → rails_5_2.gemfile} +1 -1
- data/gemfiles/{rails_4_2.gemfile → rails_6.beta1.gemfile} +1 -1
- data/haml-rails.gemspec +7 -6
- data/lib/generators/haml/mailer/mailer_generator.rb +4 -4
- data/lib/generators/haml/mailer/templates/layout.html.haml +5 -0
- data/lib/haml-rails.rb +7 -1
- data/lib/haml-rails/version.rb +1 -1
- data/lib/tasks/erb2haml.rake +6 -2
- data/test/lib/generators/haml/mailer_generator_test.rb +38 -17
- data/test/test_helper.rb +1 -1
- metadata +18 -20
- data/gemfiles/rails_5_0.gemfile +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b4da34126e0641393d4bf654e46be0072eb02886775c5b80763f18007aed9ec1
|
4
|
+
data.tar.gz: 70648786fe358e9a6960eb7e4e333a0019c5411a3a281bcedfde2d441a38de26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3de6dfc19f2d5775fdfce03a3cc95d3e9e57082541a9dc424e13ec2c84542b1644cf757d0ff08182c6578248717d12992464f47e5f471f8accbc502b61192a45
|
7
|
+
data.tar.gz: ef57bc4f90de02bbc9d15adf82832f76e4ab67d9abd2deb082e3b40c9defd485a2c6fe7176c8ea1b1db99d6554169e2e2dcdba8dfe01ae0686efa62fa6411a0b
|
data/.travis.yml
CHANGED
@@ -1,30 +1,23 @@
|
|
1
1
|
sudo: false
|
2
2
|
language: ruby
|
3
3
|
cache: bundler
|
4
|
-
before_install:
|
4
|
+
before_install:
|
5
|
+
- "gem update --system"
|
6
|
+
- "gem install bundler"
|
5
7
|
rvm:
|
6
|
-
- 2.
|
7
|
-
- 2.3
|
8
|
-
- 2.
|
9
|
-
-
|
10
|
-
- 2.0
|
11
|
-
- 1.9.3
|
12
|
-
- jruby-19mode
|
8
|
+
- 2.5.0
|
9
|
+
- 2.4.3
|
10
|
+
- 2.3.6
|
11
|
+
- jruby
|
13
12
|
gemfile:
|
14
|
-
- gemfiles/
|
15
|
-
- gemfiles/
|
16
|
-
- gemfiles/
|
17
|
-
- gemfiles/
|
13
|
+
- gemfiles/rails_5_2.gemfile
|
14
|
+
- gemfiles/rails_5_1.gemfile
|
15
|
+
- gemfiles/rails_5_2.gemfile
|
16
|
+
- gemfiles/rails_6.beta1.gemfile
|
18
17
|
matrix:
|
19
18
|
exclude:
|
20
|
-
- rvm: 2.
|
21
|
-
gemfile: gemfiles/
|
22
|
-
- rvm: 2.
|
23
|
-
gemfile: gemfiles/
|
24
|
-
- rvm: 1.9.3
|
25
|
-
gemfile: gemfiles/rails_5_0.gemfile
|
26
|
-
- rvm: jruby-19mode
|
27
|
-
gemfile: gemfiles/rails_5_0.gemfile
|
28
|
-
- rvm: 1.9.3
|
29
|
-
gemfile: gemfiles/rails_4_1.gemfile
|
19
|
+
- rvm: 2.3.6
|
20
|
+
gemfile: gemfiles/rails_6.beta1.gemfile
|
21
|
+
- rvm: 2.4.3
|
22
|
+
gemfile: gemfiles/rails_6.beta1.gemfile
|
30
23
|
script: "bundle exec rake test"
|
data/Appraisals
CHANGED
@@ -13,3 +13,15 @@ end
|
|
13
13
|
appraise "rails_5_0" do
|
14
14
|
gem "rails", "5.0"
|
15
15
|
end
|
16
|
+
|
17
|
+
appraise "rails_5_1" do
|
18
|
+
gem "rails", "5.1"
|
19
|
+
end
|
20
|
+
|
21
|
+
appraise "rails_5_2" do
|
22
|
+
gem "rails", "5.2"
|
23
|
+
end
|
24
|
+
|
25
|
+
appraise "rails_6.beta1" do
|
26
|
+
gem "rails", "6.0.0.beta1"
|
27
|
+
end
|
data/README.md
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# Haml-rails
|
2
|
+
[![Build Status](https://travis-ci.org/indirect/haml-rails.svg)](https://travis-ci.org/indirect/haml-rails)
|
2
3
|
|
3
4
|
Haml-rails provides Haml generators for Rails 4. 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.
|
4
5
|
|
5
6
|
To use it, add this line to your Gemfile:
|
6
7
|
|
7
|
-
gem "haml-rails", "~> 0
|
8
|
+
gem "haml-rails", "~> 1.0"
|
8
9
|
|
9
10
|
This ensures that:
|
10
11
|
|
@@ -30,13 +31,19 @@ start using `app/views/layouts/application.html.haml` instead.
|
|
30
31
|
|
31
32
|
If you want to convert all of your .erb views into .haml, you can do so using the following command:
|
32
33
|
|
33
|
-
$
|
34
|
+
$ rails haml:erb2haml
|
34
35
|
|
35
36
|
If you already have .haml files for one or more of the .erb files, the rake task will give you the option of either
|
36
37
|
replacing these .haml files or leaving them in place.
|
37
38
|
|
38
39
|
Once the task is complete, you will have the option of deleting the original .erb files. Unless you are under
|
39
|
-
version control, it is recommended that you decline this option.
|
40
|
+
version control, it is recommended that you decline this option. If you are running in a script, you can use
|
41
|
+
an environment variable to answer this question.
|
42
|
+
|
43
|
+
$ HAML_RAILS_DELETE_ERB=true rails haml:erb2haml
|
44
|
+
|
45
|
+
Running the above will not prompt for the question and will delete the original .erb files. Setting this value to
|
46
|
+
false will also not prompt, however, will leave the .erb files intact.
|
40
47
|
|
41
48
|
### Older versions of Rails
|
42
49
|
|
@@ -50,10 +57,6 @@ Haml-rails version 0.4 is the last version to support Rails 3. To use it, add th
|
|
50
57
|
|
51
58
|
Haml generators originally from [rails3-generators](http://github.com/indirect/rails3-generators), and written by José Valim, André Arko, Paul Barry, Anuj Dutta, Louis T, and Chris Rhoden. Tests originally written by Louis T.
|
52
59
|
|
53
|
-
### Code Status
|
54
|
-
|
55
|
-
[![Build Status](https://travis-ci.org/indirect/haml-rails.svg)](https://travis-ci.org/indirect/haml-rails)
|
56
|
-
|
57
60
|
### License
|
58
61
|
|
59
62
|
Ruby license or MIT license, take your pick.
|
data/haml-rails.gemspec
CHANGED
@@ -13,16 +13,17 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.licenses = ["MIT"]
|
14
14
|
|
15
15
|
s.rubyforge_project = "haml-rails"
|
16
|
-
s.required_rubygems_version = ">=
|
16
|
+
s.required_rubygems_version = ">= 3.0.0"
|
17
|
+
s.required_ruby_version = ">= 2.3.0"
|
17
18
|
|
18
19
|
s.add_dependency "haml", [">= 4.0.6", "< 6.0"]
|
19
|
-
s.add_dependency "activesupport", [">=
|
20
|
-
s.add_dependency "actionpack", [">=
|
21
|
-
s.add_dependency "railties", [">=
|
20
|
+
s.add_dependency "activesupport", [">= 5.1"]
|
21
|
+
s.add_dependency "actionpack", [">= 5.1"]
|
22
|
+
s.add_dependency "railties", [">= 5.1"]
|
22
23
|
s.add_dependency "html2haml", [">= 1.0.1"]
|
23
24
|
|
24
|
-
s.add_development_dependency "rails", [">=
|
25
|
-
s.add_development_dependency "bundler", "~>
|
25
|
+
s.add_development_dependency "rails", [">= 5.1"]
|
26
|
+
s.add_development_dependency "bundler", "~> 2.0"
|
26
27
|
s.add_development_dependency "rake"
|
27
28
|
s.add_development_dependency 'appraisal', '~> 1.0'
|
28
29
|
|
@@ -7,13 +7,13 @@ module Haml
|
|
7
7
|
|
8
8
|
def copy_view_files
|
9
9
|
if ::Rails.version.to_s >= "4.2.0"
|
10
|
-
view_base_path = File.join("app/views", class_path, file_name)
|
10
|
+
view_base_path = File.join("app/views", class_path, file_name + "_mailer")
|
11
11
|
empty_directory view_base_path
|
12
12
|
|
13
|
-
if
|
13
|
+
if behavior == :invoke
|
14
14
|
formats.each do |format|
|
15
|
-
layout_path = File.join("app/views/layouts", filename_with_extensions("mailer", format))
|
16
|
-
template filename_with_extensions(:layout, format), layout_path
|
15
|
+
layout_path = File.join("app/views/layouts", class_path, filename_with_extensions("mailer", format))
|
16
|
+
template filename_with_extensions(:layout, format), layout_path unless File.exist?(layout_path)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
data/lib/haml-rails.rb
CHANGED
@@ -46,7 +46,13 @@ module Haml
|
|
46
46
|
# provided directly by railties 3.2..4.1 but was dropped in 4.2.
|
47
47
|
if Gem::Requirement.new(">= 4.2").satisfied_by?(Gem::Version.new(::Rails.version))
|
48
48
|
initializer 'haml_rails.configure_source_annotation' do
|
49
|
-
|
49
|
+
annotation_class = if ::Rails::VERSION::STRING >= '6.0'
|
50
|
+
require 'rails/source_annotation_extractor'
|
51
|
+
::Rails::SourceAnnotationExtractor::Annotation
|
52
|
+
else
|
53
|
+
::SourceAnnotationExtractor::Annotation
|
54
|
+
end
|
55
|
+
annotation_class.register_extensions('haml') do |tag|
|
50
56
|
/\s*-#\s*(#{tag}):?\s*(.*)/
|
51
57
|
end
|
52
58
|
end
|
data/lib/haml-rails/version.rb
CHANGED
data/lib/tasks/erb2haml.rake
CHANGED
@@ -58,8 +58,12 @@ namespace :haml do
|
|
58
58
|
|
59
59
|
puts '-'*80
|
60
60
|
begin
|
61
|
-
|
62
|
-
|
61
|
+
if ENV.has_key?("HAML_RAILS_DELETE_ERB")
|
62
|
+
should_delete = ENV["HAML_RAILS_DELETE_ERB"] == "true" ? "y" : "n"
|
63
|
+
else
|
64
|
+
puts 'Would you like to delete the original .erb files? (This is not recommended unless you are under version control.) (y/n)'
|
65
|
+
should_delete = STDIN.gets.chomp.downcase[0]
|
66
|
+
end
|
63
67
|
end until ['y', 'n'].include?(should_delete)
|
64
68
|
|
65
69
|
if should_delete == 'y'
|
@@ -13,34 +13,55 @@ class Haml::Generators::MailerGeneratorTest < Rails::Generators::TestCase
|
|
13
13
|
run_generator
|
14
14
|
|
15
15
|
if ::Rails.version.to_s >= '4.2'
|
16
|
-
|
17
16
|
assert_file "app/views/layouts/mailer.text.haml" do |view|
|
18
|
-
assert_match
|
17
|
+
assert_match(/\= yield/, view)
|
19
18
|
end
|
20
19
|
|
21
20
|
assert_file "app/views/layouts/mailer.html.haml" do |view|
|
22
|
-
assert_match
|
21
|
+
assert_match(/\= yield/, view)
|
23
22
|
end
|
24
23
|
|
25
|
-
assert_file "app/views/
|
26
|
-
assert_match %r(app/views/
|
27
|
-
assert_match
|
24
|
+
assert_file "app/views/notifier_mailer/foo.html.haml" do |view|
|
25
|
+
assert_match %r(app/views/notifier_mailer/foo\.html\.haml), view
|
26
|
+
assert_match(/\= @greeting/, view)
|
28
27
|
end
|
29
28
|
|
30
|
-
assert_file "app/views/
|
31
|
-
assert_match %r(app/views/
|
32
|
-
assert_match
|
29
|
+
assert_file "app/views/notifier_mailer/bar.html.haml" do |view|
|
30
|
+
assert_match %r(app/views/notifier_mailer/bar\.html\.haml), view
|
31
|
+
assert_match(/\= @greeting/, view)
|
33
32
|
end
|
34
|
-
end
|
35
33
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
34
|
+
assert_file "app/views/notifier_mailer/foo.text.haml" do |view|
|
35
|
+
assert_match %r(app/views/notifier_mailer/foo\.text\.haml), view
|
36
|
+
assert_match(/\= @greeting/, view)
|
37
|
+
end
|
38
|
+
|
39
|
+
assert_file "app/views/notifier_mailer/bar.text.haml" do |view|
|
40
|
+
assert_match %r(app/views/notifier_mailer/bar\.text\.haml), view
|
41
|
+
assert_match(/\= @greeting/, view)
|
42
|
+
end
|
43
|
+
else
|
44
|
+
if ::Rails.version.to_s >= '4.1'
|
45
|
+
assert_file "app/views/notifier/foo.html.haml" do |view|
|
46
|
+
assert_match %r(app/views/notifier/foo\.html\.haml), view
|
47
|
+
assert_match(/\= @greeting/, view)
|
48
|
+
end
|
40
49
|
|
41
|
-
|
42
|
-
|
43
|
-
|
50
|
+
assert_file "app/views/notifier/bar.html.haml" do |view|
|
51
|
+
assert_match %r(app/views/notifier/bar\.html\.haml), view
|
52
|
+
assert_match(/\= @greeting/, view)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
assert_file "app/views/notifier/foo.text.haml" do |view|
|
57
|
+
assert_match %r(app/views/notifier/foo\.text\.haml), view
|
58
|
+
assert_match(/\= @greeting/, view)
|
59
|
+
end
|
60
|
+
|
61
|
+
assert_file "app/views/notifier/bar.text.haml" do |view|
|
62
|
+
assert_match %r(app/views/notifier/bar\.text\.haml), view
|
63
|
+
assert_match(/\= @greeting/, view)
|
64
|
+
end
|
44
65
|
end
|
45
66
|
end
|
46
67
|
end
|
data/test/test_helper.rb
CHANGED
@@ -73,7 +73,7 @@ alias :require_generator :require_generators
|
|
73
73
|
require_generators generator_list
|
74
74
|
|
75
75
|
# Remove tmp directory when test suite is completed
|
76
|
-
MiniTest
|
76
|
+
MiniTest.after_run do
|
77
77
|
tmp_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'tmp'))
|
78
78
|
FileUtils.rm_r(tmp_dir)
|
79
79
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- André Arko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: haml
|
@@ -36,42 +36,42 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
39
|
+
version: '5.1'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
46
|
+
version: '5.1'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: actionpack
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: '5.1'
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
60
|
+
version: '5.1'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: railties
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
67
|
+
version: '5.1'
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
74
|
+
version: '5.1'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: html2haml
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,28 +92,28 @@ dependencies:
|
|
92
92
|
requirements:
|
93
93
|
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
95
|
+
version: '5.1'
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
102
|
+
version: '5.1'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: bundler
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
109
|
+
version: '2.0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: '
|
116
|
+
version: '2.0'
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
118
|
name: rake
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -159,10 +159,9 @@ files:
|
|
159
159
|
- LICENSE
|
160
160
|
- README.md
|
161
161
|
- Rakefile
|
162
|
-
- gemfiles/
|
163
|
-
- gemfiles/
|
164
|
-
- gemfiles/
|
165
|
-
- gemfiles/rails_5_0.gemfile
|
162
|
+
- gemfiles/rails_5_1.gemfile
|
163
|
+
- gemfiles/rails_5_2.gemfile
|
164
|
+
- gemfiles/rails_6.beta1.gemfile
|
166
165
|
- haml-rails.gemspec
|
167
166
|
- lib/generators/haml/controller/controller_generator.rb
|
168
167
|
- lib/generators/haml/controller/templates/view.html.haml
|
@@ -199,15 +198,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
199
198
|
requirements:
|
200
199
|
- - ">="
|
201
200
|
- !ruby/object:Gem::Version
|
202
|
-
version:
|
201
|
+
version: 2.3.0
|
203
202
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
203
|
requirements:
|
205
204
|
- - ">="
|
206
205
|
- !ruby/object:Gem::Version
|
207
|
-
version:
|
206
|
+
version: 3.0.0
|
208
207
|
requirements: []
|
209
|
-
|
210
|
-
rubygems_version: 2.6.11
|
208
|
+
rubygems_version: 3.0.2
|
211
209
|
signing_key:
|
212
210
|
specification_version: 4
|
213
211
|
summary: let your Gemfile do the configuring
|
data/gemfiles/rails_5_0.gemfile
DELETED