haml-rails 0.9.0 → 1.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
2
  SHA1:
3
- metadata.gz: 8064aca7be819a48cb04b8190419e0af4e19fde6
4
- data.tar.gz: b62de0f2d026e5b30d81094df1d3516e526f88c6
3
+ metadata.gz: fd4e782b975a13cfd5ef38f19650e2c9028dc006
4
+ data.tar.gz: f8ba9eb9204a69d693bb6889ff11179f99fd5055
5
5
  SHA512:
6
- metadata.gz: 3ff054d70313f175385ed447a0a2518d9fbd7f78b54acdf68f5c9cbc80e6ca1b6bcd6e0f952240d4eabc18f67ae511c2c3efd5a7727fbc209f92431aac3b7568
7
- data.tar.gz: fcddf27870d2275f52f5653921fb558b89883815cce99351982e5f914fdb051e2ec2539b2b314b1fb8c6aef26261431222109da73c4e34097a7c4660b5b1369e
6
+ metadata.gz: 89b10fb1366277ed37d3022d109a94827105eecbfcb60e44adfb605b57beacd8620a1f647812deb83ab6d2a0d5e4ee4eebd99ef1fe91869b22593451d02da9a0
7
+ data.tar.gz: eeb501849dc14d680c872c5ca98bc4fe4fc0c16071836e37810ae2d06afc2a0454db610c9807a017086078ed0cae16dbf7a074536b2749c8497f0c2f99a06196
@@ -1,17 +1,30 @@
1
+ sudo: false
1
2
  language: ruby
3
+ cache: bundler
4
+ before_install: "gem install bundler"
2
5
  rvm:
6
+ - 2.4.1
7
+ - 2.3.1
8
+ - 2.2.5
9
+ - 2.1
10
+ - 2.0
3
11
  - 1.9.3
4
- - 2.0.0
5
- - 2.1.0
6
- - 2.2.0
7
12
  - jruby-19mode
8
- - rbx
9
13
  gemfile:
10
- - gemfiles/rails_4_0.gemfile
11
- - gemfiles/rails_4_1.gemfile
14
+ - gemfiles/rails_5_0.gemfile
12
15
  - gemfiles/rails_4_2.gemfile
16
+ - gemfiles/rails_4_1.gemfile
17
+ - gemfiles/rails_4_0.gemfile
13
18
  matrix:
14
19
  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
15
28
  - rvm: 1.9.3
16
29
  gemfile: gemfiles/rails_4_1.gemfile
17
- script: "bundle exec rake test"
30
+ script: "bundle exec rake test"
data/Appraisals CHANGED
@@ -8,4 +8,8 @@ end
8
8
 
9
9
  appraise "rails_4_2" do
10
10
  gem "rails", "4.2"
11
- end
11
+ end
12
+
13
+ appraise "rails_5_0" do
14
+ gem "rails", "5.0"
15
+ end
data/README.md CHANGED
@@ -52,7 +52,7 @@ Haml generators originally from [rails3-generators](http://github.com/indirect/r
52
52
 
53
53
  ### Code Status
54
54
 
55
- [![Build Status](https://travis-ci.org/indirect/haml-rails.png)](https://travis-ci.org/indirect/haml-rails)
55
+ [![Build Status](https://travis-ci.org/indirect/haml-rails.svg)](https://travis-ci.org/indirect/haml-rails)
56
56
 
57
57
  ### License
58
58
 
@@ -0,0 +1,10 @@
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 => "../"
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.rubyforge_project = "haml-rails"
16
16
  s.required_rubygems_version = ">= 1.3.6"
17
17
 
18
- s.add_dependency "haml", [">= 4.0.6", "< 5.0"]
18
+ s.add_dependency "haml", [">= 4.0.6", "< 6.0"]
19
19
  s.add_dependency "activesupport", [">= 4.0.1"]
20
20
  s.add_dependency "actionpack", [">= 4.0.1"]
21
21
  s.add_dependency "railties", [">= 4.0.1"]
@@ -6,31 +6,38 @@ module Haml
6
6
  source_root File.expand_path("../templates", __FILE__)
7
7
 
8
8
  def copy_view_files
9
- view_base_path = File.join("app/views", class_path, file_name)
10
- empty_directory view_base_path
9
+ if ::Rails.version.to_s >= "4.2.0"
10
+ view_base_path = File.join("app/views", class_path, file_name)
11
+ empty_directory view_base_path
11
12
 
12
- if self.behavior == :invoke
13
- formats.each do |format|
14
- layout_path = File.join("app/views/layouts", filename_with_extensions("mailer", format))
15
- template filename_with_extensions(:layout, format), layout_path
13
+ if self.behavior == :invoke
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
17
+ end
16
18
  end
17
- end
18
19
 
19
- actions.each do |action|
20
- @action = action
20
+ actions.each do |action|
21
+ @action = action
21
22
 
22
- formats.each do |format|
23
- @path = File.join(view_base_path, filename_with_extensions(action, format))
24
- template filename_with_extensions(:view, format), @path
23
+ formats.each do |format|
24
+ @path = File.join(view_base_path, filename_with_extensions(action, format))
25
+ template filename_with_extensions(:view, format), @path
26
+ end
25
27
  end
28
+ else
29
+ super
26
30
  end
27
31
  end
28
32
 
29
33
  protected
34
+ def format
35
+ :text
36
+ end
37
+
30
38
  def formats
31
39
  [:text, :html]
32
40
  end
33
-
34
41
  end
35
42
  end
36
43
  end
@@ -1,3 +1,3 @@
1
- %hmtl
1
+ %html
2
2
  %body
3
- = yield
3
+ = yield
@@ -1 +1 @@
1
- = yield
1
+ = yield
@@ -1,4 +1,4 @@
1
1
  %h1= class_name + "#" + @action
2
2
 
3
3
  %p
4
- = @greeting + ", find me in <%= @path %>"
4
+ = @greeting + ", find me in <%= @path %>"
@@ -3,8 +3,8 @@
3
3
  #error_explanation
4
4
  %h2= "#{pluralize(@<%= singular_table_name %>.errors.count, "error")} prohibited this <%= singular_table_name %> from being saved:"
5
5
  %ul
6
- - @<%= singular_table_name %>.errors.full_messages.each do |msg|
7
- %li= msg
6
+ - @<%= singular_table_name %>.errors.full_messages.each do |message|
7
+ %li= message
8
8
 
9
9
  <% for attribute in attributes -%>
10
10
  .field
@@ -18,7 +18,7 @@
18
18
  <% end -%>
19
19
  %td= link_to 'Show', <%= singular_table_name %>
20
20
  %td= link_to 'Edit', edit_<%= singular_table_name %>_path(<%= singular_table_name %>)
21
- %td= link_to 'Destroy', <%= singular_table_name %>, :method => :delete, :data => { :confirm => 'Are you sure?' }
21
+ %td= link_to 'Destroy', <%= singular_table_name %>, method: :delete, data: { confirm: 'Are you sure?' }
22
22
 
23
23
  %br
24
24
 
@@ -42,7 +42,7 @@ module Haml
42
42
  end
43
43
  end
44
44
 
45
- # Configure source annoatation on haml files (support for HAML was
45
+ # Configure source annotation on haml files (support for HAML was
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
@@ -54,7 +54,7 @@ module Haml
54
54
 
55
55
  rake_tasks do
56
56
  load 'tasks/erb2haml.rake'
57
- end
57
+ end
58
58
  end
59
59
  end
60
60
  end
@@ -1,5 +1,5 @@
1
1
  module Haml
2
2
  module Rails
3
- VERSION = "0.9.0"
3
+ VERSION = "1.0.0"
4
4
  end
5
- end
5
+ end
@@ -1,20 +1,24 @@
1
1
  require 'rails'
2
+ require 'shellwords'
2
3
 
3
4
  module Haml
4
5
  module Generators
5
6
  class ApplicationLayoutGenerator < ::Rails::Generators::Base
6
7
 
8
+ HTML_LAYOUT_PATH = 'app/views/layouts/application.html.erb'
9
+ HAML_LAYOUT_PATH = 'app/views/layouts/application.html.haml'
10
+
7
11
  # Converts existing application.html.erb to haml format,
8
12
  # and creates app/views/layouts/application.html.haml
9
13
  # with some error checking.
10
14
  def convert
11
- app_layout_from = ::Rails.root.join('app/views/layouts/application.html.erb')
12
- app_layout_to = ::Rails.root.join('app/views/layouts/application.html.haml')
15
+ app_layout_from = ::Rails.root.join(HTML_LAYOUT_PATH).to_s
16
+ app_layout_to = ::Rails.root.join(HAML_LAYOUT_PATH).to_s
13
17
 
14
18
  if File.exist?(app_layout_from)
15
19
 
16
20
  if !File.exist?(app_layout_to)
17
- `html2haml #{app_layout_from} #{app_layout_to}`
21
+ `html2haml #{app_layout_from.shellescape} #{app_layout_to.shellescape}`
18
22
  puts "Success! app/views/layouts/application.html.haml is created.\n" \
19
23
  "Please remove the erb file: app/views/layouts/application.html.erb"
20
24
  else
@@ -64,7 +64,7 @@ namespace :haml do
64
64
 
65
65
  if should_delete == 'y'
66
66
  puts "Deleting original .erb files."
67
- File.delete *erb_files
67
+ File.delete(*erb_files)
68
68
  else
69
69
  puts "Please remember to delete your .erb files once you have ensured they were translated correctly."
70
70
  end
@@ -72,4 +72,4 @@ namespace :haml do
72
72
  puts '-'*80
73
73
  puts "Task complete!"
74
74
  end
75
- end
75
+ end
@@ -12,12 +12,25 @@ class Haml::Generators::MailerGeneratorTest < Rails::Generators::TestCase
12
12
  test "should invoke template engine" do
13
13
  run_generator
14
14
 
15
- assert_file "app/views/layouts/mailer.text.haml" do |view|
16
- assert_match /\= yield/, view
17
- end
15
+ if ::Rails.version.to_s >= '4.2'
16
+
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
18
24
 
19
- assert_file "app/views/layouts/mailer.html.haml" do |view|
20
- assert_match /\= yield/, view
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
28
+ end
29
+
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
33
+ end
21
34
  end
22
35
 
23
36
  assert_file "app/views/notifier/foo.text.haml" do |view|
@@ -25,19 +38,9 @@ class Haml::Generators::MailerGeneratorTest < Rails::Generators::TestCase
25
38
  assert_match /\= @greeting/, view
26
39
  end
27
40
 
28
- assert_file "app/views/notifier/foo.html.haml" do |view|
29
- assert_match %r(app/views/notifier/foo\.html\.haml), view
30
- assert_match /\= @greeting/, view
31
- end
32
-
33
41
  assert_file "app/views/notifier/bar.text.haml" do |view|
34
42
  assert_match %r(app/views/notifier/bar\.text\.haml), view
35
43
  assert_match /\= @greeting/, view
36
44
  end
37
-
38
- assert_file "app/views/notifier/bar.html.haml" do |view|
39
- assert_match %r(app/views/notifier/bar\.html\.haml), view
40
- assert_match /\= @greeting/, view
41
- end
42
45
  end
43
46
  end
@@ -1 +1 @@
1
- require_generators :haml => ['scaffold', 'controller', 'mailer']
1
+ require_generators :haml => ['scaffold', 'controller', 'mailer']
@@ -70,4 +70,10 @@ def require_generators(generator_list)
70
70
  end
71
71
  alias :require_generator :require_generators
72
72
 
73
- require_generators generator_list
73
+ require_generators generator_list
74
+
75
+ # Remove tmp directory when test suite is completed
76
+ MiniTest::Unit.after_tests do
77
+ tmp_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'tmp'))
78
+ FileUtils.rm_r(tmp_dir)
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: 0.9.0
4
+ version: 1.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: 2015-03-11 00:00:00.000000000 Z
11
+ date: 2017-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: haml
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 4.0.6
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '5.0'
22
+ version: '6.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 4.0.6
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '5.0'
32
+ version: '6.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: activesupport
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -162,6 +162,7 @@ files:
162
162
  - gemfiles/rails_4_0.gemfile
163
163
  - gemfiles/rails_4_1.gemfile
164
164
  - gemfiles/rails_4_2.gemfile
165
+ - gemfiles/rails_5_0.gemfile
165
166
  - haml-rails.gemspec
166
167
  - lib/generators/haml/controller/controller_generator.rb
167
168
  - lib/generators/haml/controller/templates/view.html.haml
@@ -206,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
207
  version: 1.3.6
207
208
  requirements: []
208
209
  rubyforge_project: haml-rails
209
- rubygems_version: 2.4.5
210
+ rubygems_version: 2.6.11
210
211
  signing_key:
211
212
  specification_version: 4
212
213
  summary: let your Gemfile do the configuring