haml-rails 0.4 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: affec05aedfc4836104c3cd57622266f8e353384
4
+ data.tar.gz: f1947207022b57cbd39eed2550f41ec39b960500
5
+ SHA512:
6
+ metadata.gz: 8815f932866290239d39b4953f2e66a7623fa3389fab5b35ecc5fe75c3f22600f86c9a0da8079da54075a3f1ed7dd2988a5a6544b59ff8e3afd4deea62883a13
7
+ data.tar.gz: 5bf5bffbef7d76a62b0a9a270d6befad62a22bb0e52248ea3afd409036749f0b5f36b7f1e931e2e51e3119edd51813247ba535e2b1351addafbb55ae50026f0d
data/.gitignore CHANGED
@@ -1,3 +1,6 @@
1
1
  *.gem
2
2
  .bundle/
3
+ *.lock
4
+ gemfiles/*.lock
3
5
  tmp/
6
+ /vendor/bundle
data/.travis.yml CHANGED
@@ -1,5 +1,16 @@
1
1
  language: ruby
2
2
  rvm:
3
- - "1.8.7"
4
- - "1.9.2"
5
- - "1.9.3"
3
+ - 1.8.7
4
+ - 1.9.2
5
+ - 1.9.3
6
+ - 2.0.0
7
+ gemfile:
8
+ - gemfiles/rails_3_1.gemfile
9
+ - gemfiles/rails_3_2.gemfile
10
+ - gemfiles/rails_4_0.gemfile
11
+ matrix:
12
+ exclude:
13
+ - rvm: 1.8.7
14
+ gemfile: gemfiles/rails_4_0.gemfile
15
+ - rvm: 1.9.2
16
+ gemfile: gemfiles/rails_4_0.gemfile
data/Appraisals ADDED
@@ -0,0 +1,11 @@
1
+ appraise "rails_3_1" do
2
+ gem "rails", "~> 3.1.0"
3
+ end
4
+
5
+ appraise "rails_3_2" do
6
+ gem "rails", "~> 3.2.0"
7
+ end
8
+
9
+ appraise "rails_4_0" do
10
+ gem "rails", "~> 4.0.0"
11
+ end
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source :gemcutter
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in haml-rails.gemspec
4
4
  gemspec
data/README.md CHANGED
@@ -6,9 +6,12 @@ To use it, add this line to your Gemfile:
6
6
 
7
7
  gem "haml-rails"
8
8
 
9
- Pretty fancy, eh?
9
+ This ensures that:
10
+ * Any time you generate a controller or scaffold, you'll get Haml templates (instead of ERB)
11
+ * When your Rails application loads, Haml will be loaded and initialized automatically
12
+ * Haml templates will be respected by the view template cache digestor
10
13
 
11
- Once you've done that, any time you generate a controller or scaffold, you'll get Haml instead of ERB templates. On top of that, when your Rails application loads, Haml will be loaded and initialized completely automatically! The modern world is just so amazing.
14
+ Pretty fancy, eh? The modern world is just so amazing.
12
15
 
13
16
  ### Contributors
14
17
 
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
1
  require 'bundler'
2
2
  Bundler::GemHelper.install_tasks
3
3
 
4
+ require 'appraisal'
5
+
4
6
  require 'rake/testtask'
5
7
  Rake::TestTask.new(:test) do |test|
6
8
  test.libs << 'lib' << 'test'
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 3.1.0"
6
+
7
+ gemspec :path=>"../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 3.2.0"
6
+
7
+ gemspec :path=>"../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 4.0.0"
6
+
7
+ gemspec :path=>"../"
data/haml-rails.gemspec CHANGED
@@ -15,14 +15,15 @@ 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", "< 4.1"]
19
- s.add_dependency "activesupport", [">= 3.1", "< 4.1"]
20
- s.add_dependency "actionpack", [">= 3.1", "< 4.1"]
21
- s.add_dependency "railties", [">= 3.1", "< 4.1"]
18
+ s.add_dependency "haml", [">= 3.1", "< 5.0"]
19
+ s.add_dependency "activesupport", ["~> 4.0.0"]
20
+ s.add_dependency "actionpack", ["~> 4.0.0"]
21
+ s.add_dependency "railties", ["~> 4.0.0"]
22
22
 
23
- s.add_development_dependency "rails", [">= 3.1", "< 4.1"]
23
+ s.add_development_dependency "rails", ["~> 4.0.0"]
24
24
  s.add_development_dependency "bundler", "~> 1.2"
25
25
  s.add_development_dependency "rake"
26
+ s.add_development_dependency 'appraisal', '>= 0.3.8'
26
27
 
27
28
  s.files = `git ls-files`.split("\n")
28
29
  s.executables = `git ls-files`.split("\n").select{|f| f =~ /^bin/}
@@ -1,2 +1,2 @@
1
1
  %h1 <%= class_name %>#<%= @action %>
2
- %p Find me in <%= @path %>
2
+ %p Find me in <%= @path %>
@@ -1,3 +1,3 @@
1
1
  <%= class_name %>#<%= @action %>
2
2
 
3
- = @greeting + ", find me in <%= @path %>"
3
+ = @greeting + ", find me in <%= @path %>"
data/lib/haml-rails.rb CHANGED
@@ -4,7 +4,7 @@ require 'rails'
4
4
  module Haml
5
5
  module Rails
6
6
  class Railtie < ::Rails::Railtie
7
- if ::Rails.version.to_f >= 3.1
7
+ if ::Rails.version.to_s >= "3.1"
8
8
  config.app_generators.template_engine :haml
9
9
  else
10
10
  config.generators.template_engine :haml
@@ -14,6 +14,54 @@ module Haml
14
14
  Haml.init_rails(binding)
15
15
  Haml::Template.options[:format] = :html5
16
16
  end
17
+
18
+ initializer 'haml_rails.configure_template_digestor' do
19
+ # Configure cache digests to parse haml view templates
20
+ # when calculating cache keys for view fragments
21
+
22
+ ActiveSupport.on_load(:action_view) do
23
+ ActiveSupport.on_load(:after_initialize) do
24
+ begin
25
+ if defined?(CacheDigests::DependencyTracker)
26
+ # 'cache_digests' gem being used (overrides Rails 4 implementation)
27
+ CacheDigests::DependencyTracker.register_tracker :haml, CacheDigests::DependencyTracker::ERBTracker
28
+
29
+ if ::Rails.env.development?
30
+ # recalculate cache digest keys for each request
31
+ CacheDigests::TemplateDigestor.cache = ActiveSupport::Cache::NullStore.new
32
+ end
33
+ else
34
+ # will only apply if Rails 4, which includes 'action_view/dependency_tracker'
35
+ require 'action_view/dependency_tracker'
36
+ ActionView::DependencyTracker.register_tracker :haml, ActionView::DependencyTracker::ERBTracker
37
+
38
+ if ::Rails.env.development?
39
+ # recalculate cache digest keys for each request
40
+
41
+ # using blackhole cache until code is released to allow us to get this behavior
42
+ # by simply setting `config.action_view.cache_template_loading` false in development.rb
43
+ # https://github.com/rails/rails/pull/10791
44
+ class BlackHole < Hash
45
+ def []=(*); end
46
+ def put_if_absent(*); end
47
+ def fetch(*); yield; end
48
+ def delete_pair(*); end
49
+ end
50
+
51
+ module ::ActionView
52
+ class Digestor
53
+ @@cache = BlackHole.new
54
+ end
55
+ end
56
+ end
57
+ end
58
+ rescue
59
+ # likely this version of Rails doesn't support dependency tracking
60
+ # so, we can't parse haml templates without 'cache_digests' gem anyway :)
61
+ end
62
+ end
63
+ end
64
+ end
17
65
  end
18
66
  end
19
67
  end
@@ -1,5 +1,5 @@
1
1
  module Haml
2
2
  module Rails
3
- VERSION = "0.4"
3
+ VERSION = "0.5.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,130 +1,94 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
5
- prerelease:
4
+ version: 0.5.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - André Arko
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-14 00:00:00.000000000 Z
11
+ date: 2013-11-28 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: haml
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '3.1'
22
20
  - - <
23
21
  - !ruby/object:Gem::Version
24
- version: '4.1'
22
+ version: '5.0'
25
23
  type: :runtime
26
24
  prerelease: false
27
25
  version_requirements: !ruby/object:Gem::Requirement
28
- none: false
29
26
  requirements:
30
- - - ! '>='
27
+ - - '>='
31
28
  - !ruby/object:Gem::Version
32
29
  version: '3.1'
33
30
  - - <
34
31
  - !ruby/object:Gem::Version
35
- version: '4.1'
32
+ version: '5.0'
36
33
  - !ruby/object:Gem::Dependency
37
34
  name: activesupport
38
35
  requirement: !ruby/object:Gem::Requirement
39
- none: false
40
36
  requirements:
41
- - - ! '>='
42
- - !ruby/object:Gem::Version
43
- version: '3.1'
44
- - - <
37
+ - - ~>
45
38
  - !ruby/object:Gem::Version
46
- version: '4.1'
39
+ version: 4.0.0
47
40
  type: :runtime
48
41
  prerelease: false
49
42
  version_requirements: !ruby/object:Gem::Requirement
50
- none: false
51
43
  requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: '3.1'
55
- - - <
44
+ - - ~>
56
45
  - !ruby/object:Gem::Version
57
- version: '4.1'
46
+ version: 4.0.0
58
47
  - !ruby/object:Gem::Dependency
59
48
  name: actionpack
60
49
  requirement: !ruby/object:Gem::Requirement
61
- none: false
62
50
  requirements:
63
- - - ! '>='
64
- - !ruby/object:Gem::Version
65
- version: '3.1'
66
- - - <
51
+ - - ~>
67
52
  - !ruby/object:Gem::Version
68
- version: '4.1'
53
+ version: 4.0.0
69
54
  type: :runtime
70
55
  prerelease: false
71
56
  version_requirements: !ruby/object:Gem::Requirement
72
- none: false
73
57
  requirements:
74
- - - ! '>='
75
- - !ruby/object:Gem::Version
76
- version: '3.1'
77
- - - <
58
+ - - ~>
78
59
  - !ruby/object:Gem::Version
79
- version: '4.1'
60
+ version: 4.0.0
80
61
  - !ruby/object:Gem::Dependency
81
62
  name: railties
82
63
  requirement: !ruby/object:Gem::Requirement
83
- none: false
84
64
  requirements:
85
- - - ! '>='
86
- - !ruby/object:Gem::Version
87
- version: '3.1'
88
- - - <
65
+ - - ~>
89
66
  - !ruby/object:Gem::Version
90
- version: '4.1'
67
+ version: 4.0.0
91
68
  type: :runtime
92
69
  prerelease: false
93
70
  version_requirements: !ruby/object:Gem::Requirement
94
- none: false
95
71
  requirements:
96
- - - ! '>='
97
- - !ruby/object:Gem::Version
98
- version: '3.1'
99
- - - <
72
+ - - ~>
100
73
  - !ruby/object:Gem::Version
101
- version: '4.1'
74
+ version: 4.0.0
102
75
  - !ruby/object:Gem::Dependency
103
76
  name: rails
104
77
  requirement: !ruby/object:Gem::Requirement
105
- none: false
106
78
  requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '3.1'
110
- - - <
79
+ - - ~>
111
80
  - !ruby/object:Gem::Version
112
- version: '4.1'
81
+ version: 4.0.0
113
82
  type: :development
114
83
  prerelease: false
115
84
  version_requirements: !ruby/object:Gem::Requirement
116
- none: false
117
85
  requirements:
118
- - - ! '>='
119
- - !ruby/object:Gem::Version
120
- version: '3.1'
121
- - - <
86
+ - - ~>
122
87
  - !ruby/object:Gem::Version
123
- version: '4.1'
88
+ version: 4.0.0
124
89
  - !ruby/object:Gem::Dependency
125
90
  name: bundler
126
91
  requirement: !ruby/object:Gem::Requirement
127
- none: false
128
92
  requirements:
129
93
  - - ~>
130
94
  - !ruby/object:Gem::Version
@@ -132,7 +96,6 @@ dependencies:
132
96
  type: :development
133
97
  prerelease: false
134
98
  version_requirements: !ruby/object:Gem::Requirement
135
- none: false
136
99
  requirements:
137
100
  - - ~>
138
101
  - !ruby/object:Gem::Version
@@ -140,19 +103,31 @@ dependencies:
140
103
  - !ruby/object:Gem::Dependency
141
104
  name: rake
142
105
  requirement: !ruby/object:Gem::Requirement
143
- none: false
144
106
  requirements:
145
- - - ! '>='
107
+ - - '>='
146
108
  - !ruby/object:Gem::Version
147
109
  version: '0'
148
110
  type: :development
149
111
  prerelease: false
150
112
  version_requirements: !ruby/object:Gem::Requirement
151
- none: false
152
113
  requirements:
153
- - - ! '>='
114
+ - - '>='
154
115
  - !ruby/object:Gem::Version
155
116
  version: '0'
117
+ - !ruby/object:Gem::Dependency
118
+ name: appraisal
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - '>='
122
+ - !ruby/object:Gem::Version
123
+ version: 0.3.8
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - '>='
129
+ - !ruby/object:Gem::Version
130
+ version: 0.3.8
156
131
  description: Haml-rails provides Haml generators for Rails 3. It also enables Haml
157
132
  as the templating engine for you, so you don't have to screw around in your own
158
133
  application.rb when your Gemfile already clearly indicated what templating engine
@@ -165,10 +140,14 @@ extra_rdoc_files: []
165
140
  files:
166
141
  - .gitignore
167
142
  - .travis.yml
143
+ - Appraisals
168
144
  - Gemfile
169
145
  - LICENSE
170
146
  - README.md
171
147
  - Rakefile
148
+ - gemfiles/rails_3_1.gemfile
149
+ - gemfiles/rails_3_2.gemfile
150
+ - gemfiles/rails_4_0.gemfile
172
151
  - haml-rails.gemspec
173
152
  - lib/generators/haml/controller/controller_generator.rb
174
153
  - lib/generators/haml/controller/templates/view.html.haml
@@ -191,27 +170,25 @@ files:
191
170
  homepage: http://github.com/indirect/haml-rails
192
171
  licenses:
193
172
  - MIT
173
+ metadata: {}
194
174
  post_install_message:
195
175
  rdoc_options: []
196
176
  require_paths:
197
177
  - lib
198
178
  required_ruby_version: !ruby/object:Gem::Requirement
199
- none: false
200
179
  requirements:
201
- - - ! '>='
180
+ - - '>='
202
181
  - !ruby/object:Gem::Version
203
182
  version: '0'
204
183
  required_rubygems_version: !ruby/object:Gem::Requirement
205
- none: false
206
184
  requirements:
207
- - - ! '>='
185
+ - - '>='
208
186
  - !ruby/object:Gem::Version
209
187
  version: 1.3.6
210
188
  requirements: []
211
189
  rubyforge_project: haml-rails
212
- rubygems_version: 1.8.24
190
+ rubygems_version: 2.0.3
213
191
  signing_key:
214
- specification_version: 3
192
+ specification_version: 4
215
193
  summary: let your Gemfile do the configuring
216
194
  test_files: []
217
- has_rdoc: