haml_assets 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NmViMmRiNmM5NTAwNTU5MzgwODVmNGYzN2QxZWM5ODAyZTk4ODM5MQ==
5
+ data.tar.gz: !binary |-
6
+ NmFiOGQxZjFlMzg5M2M0MGFlOGI1YjhiODExYzJkNzdlZDNmZDhkYw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MThiY2M5NmRhZWFkYWUzOWI2ZmNlMDllNTk2ZDcxOTBjNDU1NjQyNWI4ZWNk
10
+ OWVkNTJjZDZjNGE2YzU5OTY5OWZmNDM2NGI0OTkzMTkxYjY0ODkyMTdlOWFi
11
+ ZmE0MDJjYmVmOGJlNDYyOGQ3MTlmYTk0OTYwMTA5OGMzYmIwMzg=
12
+ data.tar.gz: !binary |-
13
+ OTE4OWE4NjI2NTM1ODEwNzhmM2M3NDYyYzU2Y2RkMDQwYTIwMmE0MmY1OTRj
14
+ YjkyMmRmZTg0ODkxMmQyZjQyMjgyMmZhOTYyMTE1NDA3YmYxYjYwODI0MDY2
15
+ M2YzNWFmMmM4MWJhOTEwOWNiOTVhYTY3N2UzYWQ4ZjA4MzdkNjk=
@@ -1,7 +1,14 @@
1
- ## v0.2.0
1
+ ## On master
2
2
 
3
- * Allow partials to render (@nicolai86, @libc)
3
+ ## v0.2.2 (2013-06-02)
4
+
5
+ * Allow partials to be read from app/views
4
6
 
5
- ## v0.2.1
7
+ ## v0.2.1 (2012-10-08)
6
8
 
7
9
  * Allow partials to trigger recompile (@libc)
10
+
11
+ ## v0.2.0 (2012-10-07)
12
+
13
+ * Allow partials to render (@nicolai86, @libc)
14
+
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- haml_assets (0.2.1)
4
+ haml_assets (0.2.2)
5
5
  haml
6
6
  tilt
7
7
 
@@ -43,7 +43,8 @@ GEM
43
43
  diff-lcs (1.1.3)
44
44
  ejs (1.0.0)
45
45
  erubis (2.7.0)
46
- haml (3.1.4)
46
+ haml (4.0.0)
47
+ tilt
47
48
  hike (1.2.1)
48
49
  i18n (0.6.0)
49
50
  mail (2.3.0)
data/README.md CHANGED
@@ -66,6 +66,22 @@ A partial will become a part of whatever template you are rendering, so make
66
66
  sure that you are generating the correct markup. For example, do not include an
67
67
  embedded coffeescript partial inside an embedded javascript template.
68
68
 
69
+ ### Finding partials in `app/views`
70
+
71
+ *Warning* this is a potentially confusing option!
72
+
73
+ If you need to share a partial with Rails views, you can tell `haml_assets` to
74
+ share partials with the Rails app by looking for the templates in `app/views`.
75
+ Add this to an initializer:
76
+
77
+ HamlAssets::Config.look_in_app_views = true
78
+
79
+ Now your asset pipeline `haml` views will additionally look for partials in the
80
+ usual Rails location `app/views`.
81
+
82
+ See this issue from `handlebars_assets` for a dicussion of the asset pipeline
83
+ and initializers [issue 34](https://github.com/leshill/handlebars_assets/issues/34).
84
+
69
85
  ## Contributing
70
86
 
71
87
  Once you've made your great commits:
@@ -6,8 +6,8 @@ Gem::Specification.new do |s|
6
6
  s.name = "haml_assets"
7
7
  s.version = HamlAssets::VERSION
8
8
  s.authors = ["Les Hill", "Wes Gibbs"]
9
- s.email = ["les@infbio.com", "wes@infbio.com"]
10
- s.homepage = ""
9
+ s.email = ["leshill@gmail.com", "wes@infbio.com"]
10
+ s.homepage = "https://github.com/carezone/haml_assets"
11
11
  s.summary = %q{Use Haml with Rails helpers in the asset pipeline}
12
12
  s.description = %q{Use Haml with Rails helpers in the asset pipeline}
13
13
 
@@ -25,4 +25,4 @@ Gem::Specification.new do |s|
25
25
  s.add_development_dependency 'rspec'
26
26
  s.add_development_dependency 'rspec-rails'
27
27
  s.add_development_dependency 'ejs'
28
- end
28
+ end
@@ -7,5 +7,6 @@ if defined? Rails
7
7
  end
8
8
 
9
9
  module HamlAssets
10
+ autoload :Config, "haml_assets/config"
10
11
  autoload :HamlSprocketsEngine, "haml_assets/haml_sprockets_engine"
11
12
  end
@@ -0,0 +1,13 @@
1
+ module HamlAssets
2
+ module Config
3
+ extend self
4
+
5
+ def look_in_app_views
6
+ @look_in_app_views
7
+ end
8
+
9
+ def look_in_app_views=(look)
10
+ @look_in_app_views = look
11
+ end
12
+ end
13
+ end
@@ -28,7 +28,9 @@ module HamlAssets
28
28
  end
29
29
 
30
30
  def environment_paths
31
- environment.paths.to_a
31
+ paths = environment.paths.to_a
32
+ paths += [(Rails.root + 'app/views').to_s] if HamlAssets::Config.look_in_app_views
33
+ paths
32
34
  end
33
35
 
34
36
  def lookup_context
@@ -80,10 +82,6 @@ module HamlAssets
80
82
 
81
83
  protected
82
84
 
83
- def context_class(scope)
84
- @context_class ||= Class.new(scope.environment.context_class)
85
- end
86
-
87
85
  def prepare; end
88
86
 
89
87
  def render_haml(context, locals)
@@ -1,3 +1,3 @@
1
1
  module HamlAssets
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -29,4 +29,31 @@ describe HamlAssets do
29
29
  template.send(:render_haml, context, {}).strip.should eq(%Q(<div>partial</div>))
30
30
  end
31
31
  end
32
+
33
+ context 'rendering from app/views' do
34
+
35
+ class Context
36
+ include HamlAssets::HamlSprocketsEngine::ViewContext
37
+
38
+ attr_accessor :environment
39
+ end
40
+
41
+ let(:context) { Context.new }
42
+ let(:environment) { stub :environment, paths: paths }
43
+ let(:paths) { ['path1', 'path2' ] }
44
+
45
+ before { context.environment = environment }
46
+
47
+ after { HamlAssets::Config.look_in_app_views = false }
48
+
49
+ it 'when not on, just uses the environment paths to find templates' do
50
+ HamlAssets::Config.look_in_app_views = false
51
+ context.environment_paths.should eq(paths)
52
+ end
53
+
54
+ it 'when on, adds app/views to the environment paths to find templates' do
55
+ HamlAssets::Config.look_in_app_views = true
56
+ context.environment_paths.should eq(paths + [(Rails.root + 'app/views').to_s])
57
+ end
58
+ end
32
59
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
5
- prerelease:
4
+ version: 0.2.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Les Hill
@@ -10,12 +9,11 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2012-10-08 00:00:00.000000000 Z
12
+ date: 2013-06-02 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: haml
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
18
  - - ! '>='
21
19
  - !ruby/object:Gem::Version
@@ -23,7 +21,6 @@ dependencies:
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
25
  - - ! '>='
29
26
  - !ruby/object:Gem::Version
@@ -31,7 +28,6 @@ dependencies:
31
28
  - !ruby/object:Gem::Dependency
32
29
  name: tilt
33
30
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
31
  requirements:
36
32
  - - ! '>='
37
33
  - !ruby/object:Gem::Version
@@ -39,7 +35,6 @@ dependencies:
39
35
  type: :runtime
40
36
  prerelease: false
41
37
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
38
  requirements:
44
39
  - - ! '>='
45
40
  - !ruby/object:Gem::Version
@@ -47,7 +42,6 @@ dependencies:
47
42
  - !ruby/object:Gem::Dependency
48
43
  name: rails
49
44
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
45
  requirements:
52
46
  - - ~>
53
47
  - !ruby/object:Gem::Version
@@ -55,7 +49,6 @@ dependencies:
55
49
  type: :development
56
50
  prerelease: false
57
51
  version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
52
  requirements:
60
53
  - - ~>
61
54
  - !ruby/object:Gem::Version
@@ -63,7 +56,6 @@ dependencies:
63
56
  - !ruby/object:Gem::Dependency
64
57
  name: rspec
65
58
  requirement: !ruby/object:Gem::Requirement
66
- none: false
67
59
  requirements:
68
60
  - - ! '>='
69
61
  - !ruby/object:Gem::Version
@@ -71,7 +63,6 @@ dependencies:
71
63
  type: :development
72
64
  prerelease: false
73
65
  version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
66
  requirements:
76
67
  - - ! '>='
77
68
  - !ruby/object:Gem::Version
@@ -79,7 +70,6 @@ dependencies:
79
70
  - !ruby/object:Gem::Dependency
80
71
  name: rspec-rails
81
72
  requirement: !ruby/object:Gem::Requirement
82
- none: false
83
73
  requirements:
84
74
  - - ! '>='
85
75
  - !ruby/object:Gem::Version
@@ -87,7 +77,6 @@ dependencies:
87
77
  type: :development
88
78
  prerelease: false
89
79
  version_requirements: !ruby/object:Gem::Requirement
90
- none: false
91
80
  requirements:
92
81
  - - ! '>='
93
82
  - !ruby/object:Gem::Version
@@ -95,7 +84,6 @@ dependencies:
95
84
  - !ruby/object:Gem::Dependency
96
85
  name: ejs
97
86
  requirement: !ruby/object:Gem::Requirement
98
- none: false
99
87
  requirements:
100
88
  - - ! '>='
101
89
  - !ruby/object:Gem::Version
@@ -103,14 +91,13 @@ dependencies:
103
91
  type: :development
104
92
  prerelease: false
105
93
  version_requirements: !ruby/object:Gem::Requirement
106
- none: false
107
94
  requirements:
108
95
  - - ! '>='
109
96
  - !ruby/object:Gem::Version
110
97
  version: '0'
111
98
  description: Use Haml with Rails helpers in the asset pipeline
112
99
  email:
113
- - les@infbio.com
100
+ - leshill@gmail.com
114
101
  - wes@infbio.com
115
102
  executables: []
116
103
  extensions: []
@@ -127,6 +114,7 @@ files:
127
114
  - Rakefile
128
115
  - haml_assets.gemspec
129
116
  - lib/haml_assets.rb
117
+ - lib/haml_assets/config.rb
130
118
  - lib/haml_assets/engine.rb
131
119
  - lib/haml_assets/haml_sprockets_engine.rb
132
120
  - lib/haml_assets/version.rb
@@ -147,29 +135,28 @@ files:
147
135
  - spec/rails_app/script/rails
148
136
  - spec/render_spec.rb
149
137
  - spec/spec_helper.rb
150
- homepage: ''
138
+ homepage: https://github.com/carezone/haml_assets
151
139
  licenses: []
140
+ metadata: {}
152
141
  post_install_message:
153
142
  rdoc_options: []
154
143
  require_paths:
155
144
  - lib
156
145
  required_ruby_version: !ruby/object:Gem::Requirement
157
- none: false
158
146
  requirements:
159
147
  - - ! '>='
160
148
  - !ruby/object:Gem::Version
161
149
  version: '0'
162
150
  required_rubygems_version: !ruby/object:Gem::Requirement
163
- none: false
164
151
  requirements:
165
152
  - - ! '>='
166
153
  - !ruby/object:Gem::Version
167
154
  version: '0'
168
155
  requirements: []
169
156
  rubyforge_project: haml_assets
170
- rubygems_version: 1.8.24
157
+ rubygems_version: 2.0.3
171
158
  signing_key:
172
- specification_version: 3
159
+ specification_version: 4
173
160
  summary: Use Haml with Rails helpers in the asset pipeline
174
161
  test_files:
175
162
  - spec/rails_app/.gitignore
@@ -189,3 +176,4 @@ test_files:
189
176
  - spec/rails_app/script/rails
190
177
  - spec/render_spec.rb
191
178
  - spec/spec_helper.rb
179
+ has_rdoc: