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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: fd4e782b975a13cfd5ef38f19650e2c9028dc006
4
- data.tar.gz: f8ba9eb9204a69d693bb6889ff11179f99fd5055
2
+ SHA256:
3
+ metadata.gz: b4da34126e0641393d4bf654e46be0072eb02886775c5b80763f18007aed9ec1
4
+ data.tar.gz: 70648786fe358e9a6960eb7e4e333a0019c5411a3a281bcedfde2d441a38de26
5
5
  SHA512:
6
- metadata.gz: 89b10fb1366277ed37d3022d109a94827105eecbfcb60e44adfb605b57beacd8620a1f647812deb83ab6d2a0d5e4ee4eebd99ef1fe91869b22593451d02da9a0
7
- data.tar.gz: eeb501849dc14d680c872c5ca98bc4fe4fc0c16071836e37810ae2d06afc2a0454db610c9807a017086078ed0cae16dbf7a074536b2749c8497f0c2f99a06196
6
+ metadata.gz: 3de6dfc19f2d5775fdfce03a3cc95d3e9e57082541a9dc424e13ec2c84542b1644cf757d0ff08182c6578248717d12992464f47e5f471f8accbc502b61192a45
7
+ data.tar.gz: ef57bc4f90de02bbc9d15adf82832f76e4ab67d9abd2deb082e3b40c9defd485a2c6fe7176c8ea1b1db99d6554169e2e2dcdba8dfe01ae0686efa62fa6411a0b
@@ -1,30 +1,23 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  cache: bundler
4
- before_install: "gem install bundler"
4
+ before_install:
5
+ - "gem update --system"
6
+ - "gem install bundler"
5
7
  rvm:
6
- - 2.4.1
7
- - 2.3.1
8
- - 2.2.5
9
- - 2.1
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/rails_5_0.gemfile
15
- - gemfiles/rails_4_2.gemfile
16
- - gemfiles/rails_4_1.gemfile
17
- - gemfiles/rails_4_0.gemfile
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.1
21
- gemfile: gemfiles/rails_5_0.gemfile
22
- - rvm: 2.0
23
- gemfile: gemfiles/rails_5_0.gemfile
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.9"
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
- $ rake haml:erb2haml
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.
@@ -5,6 +5,6 @@ source "https://rubygems.org"
5
5
  gem "rubysl", "~> 2.0", :platforms => :rbx
6
6
  gem "minitest", :platforms => :rbx
7
7
  gem "html2haml"
8
- gem "rails", "~> 4.0.1"
8
+ gem "rails", "~> 5.1.5"
9
9
 
10
10
  gemspec :path => "../"
@@ -5,6 +5,6 @@ source "https://rubygems.org"
5
5
  gem "rubysl", "~> 2.0", :platforms => :rbx
6
6
  gem "minitest", :platforms => :rbx
7
7
  gem "html2haml"
8
- gem "rails", "4.1"
8
+ gem "rails", "~> 5.2.0"
9
9
 
10
10
  gemspec :path => "../"
@@ -5,6 +5,6 @@ source "https://rubygems.org"
5
5
  gem "rubysl", "~> 2.0", :platforms => :rbx
6
6
  gem "minitest", :platforms => :rbx
7
7
  gem "html2haml"
8
- gem "rails", "4.2"
8
+ gem "rails", "6.0.0.beta1"
9
9
 
10
10
  gemspec :path => "../"
@@ -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 = ">= 1.3.6"
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", [">= 4.0.1"]
20
- s.add_dependency "actionpack", [">= 4.0.1"]
21
- s.add_dependency "railties", [">= 4.0.1"]
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", [">= 4.0.1"]
25
- s.add_development_dependency "bundler", "~> 1.7"
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 self.behavior == :invoke
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
 
@@ -1,3 +1,8 @@
1
+ !!!
1
2
  %html
3
+ %head
4
+ %meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}/
5
+ :css
6
+ /* Email styles need to be inline */
2
7
  %body
3
8
  = yield
@@ -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
- SourceAnnotationExtractor::Annotation.register_extensions('haml') do |tag|
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
@@ -1,5 +1,5 @@
1
1
  module Haml
2
2
  module Rails
3
- VERSION = "1.0.0"
3
+ VERSION = "2.0.0"
4
4
  end
5
5
  end
@@ -58,8 +58,12 @@ namespace :haml do
58
58
 
59
59
  puts '-'*80
60
60
  begin
61
- puts 'Would you like to delete the original .erb files? (This is not recommended unless you are under version control.) (y/n)'
62
- should_delete = STDIN.gets.chomp.downcase[0]
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 /\= yield/, view
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 /\= yield/, view
21
+ assert_match(/\= yield/, view)
23
22
  end
24
23
 
25
- assert_file "app/views/notifier/foo.html.haml" do |view|
26
- assert_match %r(app/views/notifier/foo\.html\.haml), view
27
- assert_match /\= @greeting/, view
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/notifier/bar.html.haml" do |view|
31
- assert_match %r(app/views/notifier/bar\.html\.haml), view
32
- assert_match /\= @greeting/, view
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
- assert_file "app/views/notifier/foo.text.haml" do |view|
37
- assert_match %r(app/views/notifier/foo\.text\.haml), view
38
- assert_match /\= @greeting/, view
39
- end
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
- assert_file "app/views/notifier/bar.text.haml" do |view|
42
- assert_match %r(app/views/notifier/bar\.text\.haml), view
43
- assert_match /\= @greeting/, view
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
@@ -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::Unit.after_tests do
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: 1.0.0
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: 2017-04-27 00:00:00.000000000 Z
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: 4.0.1
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: 4.0.1
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: 4.0.1
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: 4.0.1
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: 4.0.1
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: 4.0.1
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: 4.0.1
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: 4.0.1
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: '1.7'
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: '1.7'
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/rails_4_0.gemfile
163
- - gemfiles/rails_4_1.gemfile
164
- - gemfiles/rails_4_2.gemfile
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: '0'
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: 1.3.6
206
+ version: 3.0.0
208
207
  requirements: []
209
- rubyforge_project: haml-rails
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
@@ -1,10 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rubysl", "~> 2.0", :platforms => :rbx
6
- gem "minitest", :platforms => :rbx
7
- gem "html2haml"
8
- gem "rails", "5.0"
9
-
10
- gemspec :path => "../"