haml-rails 0.8.2 → 0.9.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: 754bd59211dcca7161c1c20b59f9a5b3f3d0855b
4
- data.tar.gz: 990889fe237e677b7d8fa8c861ec9f6f3007b82a
3
+ metadata.gz: 8064aca7be819a48cb04b8190419e0af4e19fde6
4
+ data.tar.gz: b62de0f2d026e5b30d81094df1d3516e526f88c6
5
5
  SHA512:
6
- metadata.gz: a492400ff4971e33cdd203a861bcd5462d81b39538394bdae078c68b32595981459a642b9bbe3d96436a08c3591ee5520e38caf6d3975ab5ed0cc7995e634456
7
- data.tar.gz: 17de4af9850407b36ef6276f525f993c714b144a96a0fdbc29e0ea317b04c308f616cd4f5957be70daeaf1cae0acf2a406520971b108afe032e8607c1ee7b69a
6
+ metadata.gz: 3ff054d70313f175385ed447a0a2518d9fbd7f78b54acdf68f5c9cbc80e6ca1b6bcd6e0f952240d4eabc18f67ae511c2c3efd5a7727fbc209f92431aac3b7568
7
+ data.tar.gz: fcddf27870d2275f52f5653921fb558b89883815cce99351982e5f914fdb051e2ec2539b2b314b1fb8c6aef26261431222109da73c4e34097a7c4660b5b1369e
@@ -3,12 +3,15 @@ rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
5
  - 2.1.0
6
+ - 2.2.0
6
7
  - jruby-19mode
7
8
  - rbx
8
9
  gemfile:
9
10
  - gemfiles/rails_4_0.gemfile
10
11
  - gemfiles/rails_4_1.gemfile
12
+ - gemfiles/rails_4_2.gemfile
11
13
  matrix:
12
14
  exclude:
13
15
  - rvm: 1.9.3
14
16
  gemfile: gemfiles/rails_4_1.gemfile
17
+ script: "bundle exec rake test"
data/Appraisals CHANGED
@@ -1,13 +1,11 @@
1
1
  appraise "rails_4_0" do
2
2
  gem "rails", "~> 4.0.1"
3
-
4
- gem 'rubysl', '~> 2.0', platforms: :rbx
5
- gem 'minitest', platforms: :rbx
6
3
  end
7
4
 
8
5
  appraise "rails_4_1" do
9
- gem "rails", "4.1.0.beta1"
6
+ gem "rails", "4.1"
7
+ end
10
8
 
11
- gem 'rubysl', '~> 2.0', platforms: :rbx
12
- gem 'minitest', platforms: :rbx
9
+ appraise "rails_4_2" do
10
+ gem "rails", "4.2"
13
11
  end
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010 André Arko
1
+ Copyright (c) 2010-2015 André Arko
2
2
 
3
3
  MIT Licence
4
4
 
data/README.md CHANGED
@@ -4,10 +4,11 @@ Haml-rails provides Haml generators for Rails 4. It also enables Haml as the tem
4
4
 
5
5
  To use it, add this line to your Gemfile:
6
6
 
7
- gem "haml-rails"
7
+ gem "haml-rails", "~> 0.9"
8
8
 
9
9
  This ensures that:
10
- * Any time you generate a controller or scaffold, you'll get Haml templates (instead of ERB)
10
+
11
+ * Any time you generate a resource, view, or mailer, you'll get Haml templates (instead of ERB)
11
12
  * When your Rails application loads, Haml will be loaded and initialized automatically
12
13
  * Haml templates will be respected by the view template cache digestor
13
14
 
data/Rakefile CHANGED
@@ -1,11 +1,7 @@
1
+ require 'rubygems'
1
2
  require 'bundler'
2
3
  Bundler::GemHelper.install_tasks
3
4
 
4
- begin
5
- require 'appraisal'
6
- rescue LoadError
7
- end
8
-
9
5
  require 'rake/testtask'
10
6
  Rake::TestTask.new(:test) do |test|
11
7
  test.libs << 'lib' << 'test'
@@ -2,9 +2,9 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
+ gem "rubysl", "~> 2.0", :platforms => :rbx
6
+ gem "minitest", :platforms => :rbx
7
+ gem "html2haml"
5
8
  gem "rails", "~> 4.0.1"
6
9
 
7
- gem 'rubysl', '~> 2.0', platforms: :rbx
8
- gem 'minitest', platforms: :rbx
9
-
10
- gemspec :path=>"../"
10
+ gemspec :path => "../"
@@ -2,9 +2,9 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rails", "4.1.0.beta1"
5
+ gem "rubysl", "~> 2.0", :platforms => :rbx
6
+ gem "minitest", :platforms => :rbx
7
+ gem "html2haml"
8
+ gem "rails", "4.1"
6
9
 
7
- gem 'rubysl', '~> 2.0', platforms: :rbx
8
- gem 'minitest', platforms: :rbx
9
-
10
- gemspec :path=>"../"
10
+ gemspec :path => "../"
@@ -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", "4.2"
9
+
10
+ gemspec :path => "../"
@@ -15,16 +15,16 @@ 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", [">= 3.1", "< 5.0"]
18
+ s.add_dependency "haml", [">= 4.0.6", "< 5.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"]
22
22
  s.add_dependency "html2haml", [">= 1.0.1"]
23
23
 
24
24
  s.add_development_dependency "rails", [">= 4.0.1"]
25
- s.add_development_dependency "bundler", "~> 1.2"
25
+ s.add_development_dependency "bundler", "~> 1.7"
26
26
  s.add_development_dependency "rake"
27
- s.add_development_dependency 'appraisal', '>= 0.3.8'
27
+ s.add_development_dependency 'appraisal', '~> 1.0'
28
28
 
29
29
  s.files = `git ls-files`.split("\n")
30
30
  s.executables = `git ls-files`.split("\n").select{|f| f =~ /^bin/}
@@ -5,10 +5,30 @@ module Haml
5
5
  class MailerGenerator < ControllerGenerator
6
6
  source_root File.expand_path("../templates", __FILE__)
7
7
 
8
- protected
8
+ def copy_view_files
9
+ view_base_path = File.join("app/views", class_path, file_name)
10
+ empty_directory view_base_path
11
+
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
16
+ end
17
+ end
18
+
19
+ actions.each do |action|
20
+ @action = action
9
21
 
10
- def format
11
- :text
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
25
+ end
26
+ end
27
+ end
28
+
29
+ protected
30
+ def formats
31
+ [:text, :html]
12
32
  end
13
33
 
14
34
  end
@@ -0,0 +1,3 @@
1
+ %hmtl
2
+ %body
3
+ = yield
@@ -0,0 +1,4 @@
1
+ %h1= class_name + "#" + @action
2
+
3
+ %p
4
+ = @greeting + ", find me in <%= @path %>"
@@ -9,7 +9,7 @@
9
9
  %th
10
10
  %th
11
11
  %th
12
-
12
+
13
13
  %tbody
14
14
  - @<%= plural_table_name %>.each do |<%= singular_table_name %>|
15
15
  %tr
@@ -4,15 +4,12 @@ require 'haml/railtie'
4
4
 
5
5
  module Haml
6
6
  module Rails
7
+ class Engine < ::Rails::Engine
8
+ end
7
9
  class Railtie < ::Rails::Railtie
8
- if ::Rails.version.to_s >= "3.1"
9
- config.app_generators.template_engine :haml
10
- else
11
- config.generators.template_engine :haml
12
- end
10
+ config.app_generators.template_engine :haml
13
11
 
14
12
  config.before_initialize do
15
- Haml.init_rails(binding)
16
13
  Haml::Template.options[:format] = :html5
17
14
  end
18
15
 
@@ -1,5 +1,5 @@
1
1
  module Haml
2
2
  module Rails
3
- VERSION = "0.8.2"
3
+ VERSION = "0.9.0"
4
4
  end
5
5
  end
@@ -2,16 +2,17 @@ require 'test_helper'
2
2
  require 'lib/generators/haml/testing_helper'
3
3
 
4
4
  class Haml::Generators::ControllerGeneratorTest < Rails::Generators::TestCase
5
- destination File.join(Rails.root)
5
+ destination Rails.root
6
6
  tests Rails::Generators::ControllerGenerator
7
- arguments %w(Account foo bar --template-engine haml)
8
7
 
9
8
  setup :prepare_destination
10
9
  setup :copy_routes
11
10
 
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
11
+ arguments %w(Account foo bar --template-engine haml)
12
+
13
+ test "should invoke haml engine" do
14
+ run_generator
15
+ assert_file "app/views/account/foo.html.haml"
16
+ assert_file "app/views/account/bar.html.haml"
17
+ end
17
18
  end
@@ -11,14 +11,33 @@ class Haml::Generators::MailerGeneratorTest < Rails::Generators::TestCase
11
11
 
12
12
  test "should invoke template engine" do
13
13
  run_generator
14
+
15
+ assert_file "app/views/layouts/mailer.text.haml" do |view|
16
+ assert_match /\= yield/, view
17
+ end
18
+
19
+ assert_file "app/views/layouts/mailer.html.haml" do |view|
20
+ assert_match /\= yield/, view
21
+ end
22
+
14
23
  assert_file "app/views/notifier/foo.text.haml" do |view|
15
24
  assert_match %r(app/views/notifier/foo\.text\.haml), view
16
25
  assert_match /\= @greeting/, view
17
26
  end
18
27
 
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
+
19
33
  assert_file "app/views/notifier/bar.text.haml" do |view|
20
34
  assert_match %r(app/views/notifier/bar\.text\.haml), view
21
35
  assert_match /\= @greeting/, view
22
36
  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
23
42
  end
24
43
  end
@@ -7,26 +7,24 @@ require 'rails/generators/test_case'
7
7
  class TestApp < Rails::Application
8
8
  config.root = File.dirname(__FILE__)
9
9
  end
10
- Rails.application = TestApp
11
10
 
12
11
  module Rails
13
12
  def self.root
14
13
  @root ||= File.expand_path(File.join(File.dirname(__FILE__), '..', 'tmp', 'rails'))
15
14
  end
16
15
  end
17
- Rails.application.config.root = Rails.root
18
16
 
19
17
  # Call configure to load the settings from
20
18
  # Rails.application.config.generators to Rails::Generators
21
- Rails::Generators.configure! Rails.application.config.generators
19
+ Rails.application.load_generators
22
20
 
23
21
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
24
22
 
25
23
  def copy_routes
26
- routes = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'routes.rb'))
24
+ routes = File.join(File.dirname(__FILE__), 'fixtures', 'routes.rb')
27
25
  destination = File.join(Rails.root, "config")
28
26
  FileUtils.mkdir_p(destination)
29
- FileUtils.cp File.expand_path(routes), destination
27
+ FileUtils.cp File.expand_path(routes), File.expand_path(destination)
30
28
  end
31
29
 
32
30
  # Asserts the given class exists in the given content. When a block is given,
metadata CHANGED
@@ -1,147 +1,147 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.9.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-01-28 00:00:00.000000000 Z
11
+ date: 2015-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: haml
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '3.1'
20
- - - <
19
+ version: 4.0.6
20
+ - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '5.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - '>='
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '3.1'
30
- - - <
29
+ version: 4.0.6
30
+ - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '5.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: activesupport
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - '>='
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: 4.0.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
46
  version: 4.0.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
53
  version: 4.0.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
60
  version: 4.0.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
67
  version: 4.0.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
74
  version: 4.0.1
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: html2haml
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - '>='
79
+ - - ">="
80
80
  - !ruby/object:Gem::Version
81
81
  version: 1.0.1
82
82
  type: :runtime
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - '>='
86
+ - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: 1.0.1
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: rails
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - '>='
93
+ - - ">="
94
94
  - !ruby/object:Gem::Version
95
95
  version: 4.0.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
102
  version: 4.0.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.2'
109
+ version: '1.7'
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.2'
116
+ version: '1.7'
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: rake
119
119
  requirement: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - '>='
121
+ - - ">="
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
- - - '>='
128
+ - - ">="
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: appraisal
133
133
  requirement: !ruby/object:Gem::Requirement
134
134
  requirements:
135
- - - '>='
135
+ - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: 0.3.8
137
+ version: '1.0'
138
138
  type: :development
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
- - - '>='
142
+ - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: 0.3.8
144
+ version: '1.0'
145
145
  description: Haml-rails provides Haml generators for Rails 4. It also enables Haml
146
146
  as the templating engine for you, so you don't have to screw around in your own
147
147
  application.rb when your Gemfile already clearly indicated what templating engine
@@ -152,8 +152,8 @@ executables: []
152
152
  extensions: []
153
153
  extra_rdoc_files: []
154
154
  files:
155
- - .gitignore
156
- - .travis.yml
155
+ - ".gitignore"
156
+ - ".travis.yml"
157
157
  - Appraisals
158
158
  - Gemfile
159
159
  - LICENSE
@@ -161,10 +161,14 @@ files:
161
161
  - Rakefile
162
162
  - gemfiles/rails_4_0.gemfile
163
163
  - gemfiles/rails_4_1.gemfile
164
+ - gemfiles/rails_4_2.gemfile
164
165
  - haml-rails.gemspec
165
166
  - lib/generators/haml/controller/controller_generator.rb
166
167
  - lib/generators/haml/controller/templates/view.html.haml
167
168
  - lib/generators/haml/mailer/mailer_generator.rb
169
+ - lib/generators/haml/mailer/templates/layout.html.haml
170
+ - lib/generators/haml/mailer/templates/layout.text.haml
171
+ - lib/generators/haml/mailer/templates/view.html.haml
168
172
  - lib/generators/haml/mailer/templates/view.text.haml
169
173
  - lib/generators/haml/scaffold/scaffold_generator.rb
170
174
  - lib/generators/haml/scaffold/templates/_form.html.haml
@@ -192,17 +196,17 @@ require_paths:
192
196
  - lib
193
197
  required_ruby_version: !ruby/object:Gem::Requirement
194
198
  requirements:
195
- - - '>='
199
+ - - ">="
196
200
  - !ruby/object:Gem::Version
197
201
  version: '0'
198
202
  required_rubygems_version: !ruby/object:Gem::Requirement
199
203
  requirements:
200
- - - '>='
204
+ - - ">="
201
205
  - !ruby/object:Gem::Version
202
206
  version: 1.3.6
203
207
  requirements: []
204
208
  rubyforge_project: haml-rails
205
- rubygems_version: 2.4.4
209
+ rubygems_version: 2.4.5
206
210
  signing_key:
207
211
  specification_version: 4
208
212
  summary: let your Gemfile do the configuring