haml_coffee_assets 1.18.0 → 1.23.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: ea92d1734c75b52c55da86b35a0ed6526ef2d8b4
4
- data.tar.gz: 51ed13e4defc83bc40bf622a520506cfb4688d34
2
+ SHA256:
3
+ metadata.gz: 168508ea1ddb9ae12c59dd491f2495f7506f4714f07a66153c0728deebfcc4cc
4
+ data.tar.gz: e1db3ab700b2997266231ad42a25738a684d11d5d902a0161c2c28699ed2bd12
5
5
  SHA512:
6
- metadata.gz: ff544eab8d75b2cb4d163a9fdee95000a655912b1c206774087101d6bee0c4c0ced01e2499ecd3e1e7d166da5f30f9b34edac832cb99aa93983a3126eae0fd5c
7
- data.tar.gz: 55f842a099219ac837591abbc7b0dbc68585aea0419e95051b3a8d94e986fa832c3e47bc75b0e96b0c33f2e7e7326b348e3e65402e342a012697a93d55867700
6
+ metadata.gz: 2a15e615c9b0d9d1accf8428ea3b4e6b8c4366f7d0628c4f615db412fa4648456653f47c8fd57b06175b456bbb6835e8f7bd5052c2b130707d7b92a61d3b3b61
7
+ data.tar.gz: 2bc7d5896ae4d1cc3bbd94468753fff078ba77b87dcd40b5799fcec5c97481484111b5ca352509cb07091092f5e70f498c5ecc448aea593f27c723ea91761a41
data/README.md CHANGED
@@ -94,7 +94,7 @@ removed.
94
94
 
95
95
  When you give your templates the extension `.jst.hamlc`, Haml Coffee Assets will only generate the template function,
96
96
  which then in turn will be further processed by the
97
- [Sprocket JST processor](https://github.com/sstephenson/sprockets/blob/master/lib/sprockets/jst_processor.rb). Because
97
+ [Sprocket JST processor](https://github.com/rails/sprockets/blob/master/lib/sprockets/jst_processor.rb). Because
98
98
  Haml Coffee Assets will not generate the template, you can't use the AMD support, template name filter and the JST
99
99
  namespace definition is more cumbersome compared to the Haml Coffee template generation.
100
100
 
@@ -3,7 +3,7 @@ module HamlCoffeeAssets
3
3
  class TemplateHandler
4
4
  DEPENDENCY_PATTERN = /(?:window\.)?JST(?:\[["']([\w\/]+)["']\]|\.(\w+))/
5
5
 
6
- def self.call(template)
6
+ def self.call(template, _body = nil)
7
7
  new(template).render
8
8
  end
9
9
 
@@ -80,7 +80,8 @@ module HamlCoffeeAssets
80
80
  partial_source(path),
81
81
  path,
82
82
  self.class,
83
- virtual_path: partial_path(path)
83
+ virtual_path: partial_path(path),
84
+ locals: []
84
85
  )
85
86
 
86
87
  compiled << self.class.new(
@@ -38,7 +38,7 @@ module HamlCoffeeAssets
38
38
  self.selfCloseTags = 'meta,img,link,br,hr,input,area,param,col,base'
39
39
  self.context = 'window.HAML.context'
40
40
  self.templates_path = 'app/assets/javascripts/templates'
41
- self.global_context_asset = 'templates/context'
41
+ self.global_context_asset = 'templates/context.js'
42
42
  self.name_filter = lambda { |n|
43
43
  parts = n.sub(/^templates\//, '').split('/')
44
44
  parts.last.sub!(/^_/, '')
@@ -33,54 +33,11 @@ module HamlCoffeeAssets
33
33
  end
34
34
  end
35
35
 
36
- if ::Rails.env == "development"
37
- # Monkey patch rails so it busts the server cache for templates
38
- # depending on the global_context_asset.
39
- #
40
- # Currently, the only way to force rails to recompile a server template is to
41
- # touch it. This is problematic because when the global_context_asset
42
- # changes we need to manually touch every template that uses the congtext
43
- # in some way.
44
- #
45
- # To ease development, make rails 'touch' and recompile hamlc templates
46
- # when the global context has changed.
47
- #
48
- # Do this ONLY in development.
49
- #
50
- # TODO: Don't monkey patch rails.
51
- module ::ActionView
52
- class Template
53
- def stale?
54
- return false unless ::Rails.env == "development"
55
- return false unless handler.respond_to?(:stale?)
56
- handler.stale?(updated_at)
57
- end
58
-
59
- alias_method :old_render, :render
60
-
61
- # by default, rails will only compile a template once
62
- # path render so it recompiles the template if 'stale'
63
- def render(view, locals, buffer=nil, &block)
64
- if @compiled and stale?
65
- now = Time.now
66
- File.utime(now, now, identifier) # touch file
67
- ::Rails.logger.info "Busted cache for #{identifier} by touching it"
68
-
69
- view = refresh(view)
70
- @source = view.source
71
- @compiled = false
72
- end
73
- old_render(view, locals, buffer, &block)
74
- end
75
-
76
- end
77
- end
78
- end
79
-
80
36
  config.assets.configure do |env|
81
37
  if env.respond_to?(:register_transformer)
82
- env.register_mime_type 'text/hamlc', extensions: ['.hamlc']
38
+ env.register_mime_type 'text/hamlc', extensions: ['.hamlc', '.jst.hamlc']
83
39
  env.register_transformer 'text/hamlc', 'application/javascript', ::HamlCoffeeAssets::Transformer
40
+ env.register_transformer 'text/hamlc', 'application/javascript+function', ::HamlCoffeeAssets::Transformer
84
41
  end
85
42
 
86
43
  if env.respond_to?(:register_engine)
@@ -10,23 +10,23 @@ module HamlCoffeeAssets
10
10
  end
11
11
 
12
12
  def render(context, empty_hash_wtf)
13
- self.class.run(@filename, @source, context)
13
+ self.class.run(@filename, @filename, @source, context)
14
14
  end
15
15
 
16
- def self.run(filename, source, context)
16
+ def self.run(filename, name, source, context)
17
17
  jst = !!(filename =~ /\.jst\.hamlc(?:\.|$)/)
18
- name = filename
19
18
  name = HamlCoffeeAssets.config.name_filter.call(name) if HamlCoffeeAssets.config.name_filter && !jst
20
19
 
21
20
  HamlCoffeeAssets::Compiler.compile(name, source, !jst)
22
21
  end
23
22
 
24
23
  def self.call(input)
25
- filename = input[:name]
24
+ filename = input[:filename]
25
+ name = input[:name]
26
26
  source = input[:data]
27
27
  context = input[:environment].context_class.new(input)
28
28
 
29
- result = run(filename, source, context)
29
+ result = run(filename, name, source, context)
30
30
  context.metadata.merge(data: result)
31
31
  end
32
32
  end
@@ -1,5 +1,5 @@
1
1
  # coding: UTF-8
2
2
 
3
3
  module HamlCoffeeAssets
4
- VERSION = '1.18.0' unless defined?(HamlCoffeeAssets::VERSION)
4
+ VERSION = '1.23.0' unless defined?(HamlCoffeeAssets::VERSION)
5
5
  end
@@ -12,7 +12,12 @@ require 'haml_coffee_assets/version'
12
12
 
13
13
  require 'haml_coffee_assets/transformer'
14
14
 
15
- if defined?(Rails) && Rails.version >= '3.0.0'
15
+ if defined?(Rails) && Rails.version >= '7.0.0'
16
+ require 'rails'
17
+ require 'sprockets/railtie'
18
+ require 'haml_coffee_assets/rails/engine'
19
+ require 'haml_coffee_assets/action_view/patches'
20
+ elsif defined?(Rails) && Rails.version >= '3.0.0'
16
21
  require 'rails'
17
22
  require 'haml_coffee_assets/rails/engine'
18
23
  require 'haml_coffee_assets/action_view/patches'
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml_coffee_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.0
4
+ version: 1.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Kessler
8
8
  - Emilio Forrer
9
9
  - Christopher Ostrowski
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-06-23 00:00:00.000000000 Z
13
+ date: 2023-05-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: coffee-script
@@ -27,75 +27,39 @@ dependencies:
27
27
  - !ruby/object:Gem::Version
28
28
  version: '2'
29
29
  - !ruby/object:Gem::Dependency
30
- name: sprockets
30
+ name: railties
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - ">="
34
34
  - !ruby/object:Gem::Version
35
- version: '2'
36
- type: :runtime
37
- prerelease: false
38
- version_requirements: !ruby/object:Gem::Requirement
39
- requirements:
40
- - - ">="
35
+ version: '5.2'
36
+ - - "<"
41
37
  - !ruby/object:Gem::Version
42
- version: '2'
43
- - !ruby/object:Gem::Dependency
44
- name: bundler
45
- requirement: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: '0'
50
- type: :development
51
- prerelease: false
52
- version_requirements: !ruby/object:Gem::Requirement
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- version: '0'
57
- - !ruby/object:Gem::Dependency
58
- name: rspec
59
- requirement: !ruby/object:Gem::Requirement
60
- requirements:
61
- - - ">="
62
- - !ruby/object:Gem::Version
63
- version: '0'
64
- type: :development
38
+ version: '7.1'
39
+ type: :runtime
65
40
  prerelease: false
66
41
  version_requirements: !ruby/object:Gem::Requirement
67
42
  requirements:
68
43
  - - ">="
69
44
  - !ruby/object:Gem::Version
70
- version: '0'
71
- - !ruby/object:Gem::Dependency
72
- name: jquery-rails
73
- requirement: !ruby/object:Gem::Requirement
74
- requirements:
75
- - - ">="
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
- type: :development
79
- prerelease: false
80
- version_requirements: !ruby/object:Gem::Requirement
81
- requirements:
82
- - - ">="
45
+ version: '5.2'
46
+ - - "<"
83
47
  - !ruby/object:Gem::Version
84
- version: '0'
48
+ version: '7.1'
85
49
  - !ruby/object:Gem::Dependency
86
- name: coffee-rails
50
+ name: sprockets
87
51
  requirement: !ruby/object:Gem::Requirement
88
52
  requirements:
89
53
  - - ">="
90
54
  - !ruby/object:Gem::Version
91
- version: '0'
92
- type: :development
55
+ version: '3.7'
56
+ type: :runtime
93
57
  prerelease: false
94
58
  version_requirements: !ruby/object:Gem::Requirement
95
59
  requirements:
96
60
  - - ">="
97
61
  - !ruby/object:Gem::Version
98
- version: '0'
62
+ version: '3.7'
99
63
  - !ruby/object:Gem::Dependency
100
64
  name: jasmine
101
65
  requirement: !ruby/object:Gem::Requirement
@@ -125,77 +89,7 @@ dependencies:
125
89
  - !ruby/object:Gem::Version
126
90
  version: '0'
127
91
  - !ruby/object:Gem::Dependency
128
- name: guard
129
- requirement: !ruby/object:Gem::Requirement
130
- requirements:
131
- - - ">="
132
- - !ruby/object:Gem::Version
133
- version: '0'
134
- type: :development
135
- prerelease: false
136
- version_requirements: !ruby/object:Gem::Requirement
137
- requirements:
138
- - - ">="
139
- - !ruby/object:Gem::Version
140
- version: '0'
141
- - !ruby/object:Gem::Dependency
142
- name: guard-jasmine
143
- requirement: !ruby/object:Gem::Requirement
144
- requirements:
145
- - - ">="
146
- - !ruby/object:Gem::Version
147
- version: '0'
148
- type: :development
149
- prerelease: false
150
- version_requirements: !ruby/object:Gem::Requirement
151
- requirements:
152
- - - ">="
153
- - !ruby/object:Gem::Version
154
- version: '0'
155
- - !ruby/object:Gem::Dependency
156
- name: guard-rspec
157
- requirement: !ruby/object:Gem::Requirement
158
- requirements:
159
- - - ">="
160
- - !ruby/object:Gem::Version
161
- version: '0'
162
- type: :development
163
- prerelease: false
164
- version_requirements: !ruby/object:Gem::Requirement
165
- requirements:
166
- - - ">="
167
- - !ruby/object:Gem::Version
168
- version: '0'
169
- - !ruby/object:Gem::Dependency
170
- name: rake
171
- requirement: !ruby/object:Gem::Requirement
172
- requirements:
173
- - - ">="
174
- - !ruby/object:Gem::Version
175
- version: '0'
176
- type: :development
177
- prerelease: false
178
- version_requirements: !ruby/object:Gem::Requirement
179
- requirements:
180
- - - ">="
181
- - !ruby/object:Gem::Version
182
- version: '0'
183
- - !ruby/object:Gem::Dependency
184
- name: yard
185
- requirement: !ruby/object:Gem::Requirement
186
- requirements:
187
- - - ">="
188
- - !ruby/object:Gem::Version
189
- version: '0'
190
- type: :development
191
- prerelease: false
192
- version_requirements: !ruby/object:Gem::Requirement
193
- requirements:
194
- - - ">="
195
- - !ruby/object:Gem::Version
196
- version: '0'
197
- - !ruby/object:Gem::Dependency
198
- name: pry
92
+ name: rspec
199
93
  requirement: !ruby/object:Gem::Requirement
200
94
  requirements:
201
95
  - - ">="
@@ -209,7 +103,7 @@ dependencies:
209
103
  - !ruby/object:Gem::Version
210
104
  version: '0'
211
105
  - !ruby/object:Gem::Dependency
212
- name: rb-readline
106
+ name: simplecov
213
107
  requirement: !ruby/object:Gem::Requirement
214
108
  requirements:
215
109
  - - ">="
@@ -251,7 +145,7 @@ homepage: https://github.com/emilioforrer/haml_coffee_assets
251
145
  licenses:
252
146
  - MIT
253
147
  metadata: {}
254
- post_install_message:
148
+ post_install_message:
255
149
  rdoc_options: []
256
150
  require_paths:
257
151
  - lib
@@ -259,16 +153,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
259
153
  requirements:
260
154
  - - ">="
261
155
  - !ruby/object:Gem::Version
262
- version: 1.9.3
156
+ version: 2.5.8
263
157
  required_rubygems_version: !ruby/object:Gem::Requirement
264
158
  requirements:
265
159
  - - ">="
266
160
  - !ruby/object:Gem::Version
267
- version: 1.3.6
161
+ version: 2.5.2
268
162
  requirements: []
269
- rubyforge_project: haml_coffee_assets
270
- rubygems_version: 2.6.10
271
- signing_key:
163
+ rubygems_version: 3.4.11
164
+ signing_key:
272
165
  specification_version: 4
273
166
  summary: Haml CoffeeScript templates
274
167
  test_files: []