haml_coffee_assets 1.18.0 → 1.21.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: b1f5919bc4a8ae4abc0b3057ceeedf6fb27815ac689ec836c11c05b7d6d72612
4
+ data.tar.gz: 50de614e99123d85b1ba6730dee3c1530284f94b20f02d16ef03466e4baee03e
5
5
  SHA512:
6
- metadata.gz: ff544eab8d75b2cb4d163a9fdee95000a655912b1c206774087101d6bee0c4c0ced01e2499ecd3e1e7d166da5f30f9b34edac832cb99aa93983a3126eae0fd5c
7
- data.tar.gz: 55f842a099219ac837591abbc7b0dbc68585aea0419e95051b3a8d94e986fa832c3e47bc75b0e96b0c33f2e7e7326b348e3e65402e342a012697a93d55867700
6
+ metadata.gz: ce3da62bdc7e209a4deb2dc8520da2873a31623847e67ba0bf4803e4702b96645affbe0d39559ef7d55dc2ecf678deea5928348f6855ee3ab4cf1ae294208e56
7
+ data.tar.gz: 9af1f73d51627e827cc3111f7442e547f7d41da5547a48140b1d5b4bd2419e6e78ee7ac18128c0bef002bb2d477045c2d80173f2cc810a3f8bee4343b3f35a14
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,50 +33,6 @@ 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
38
  env.register_mime_type 'text/hamlc', extensions: ['.hamlc']
@@ -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.21.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,7 +1,7 @@
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.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Kessler
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-06-23 00:00:00.000000000 Z
13
+ date: 2022-07-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: coffee-script
@@ -26,20 +26,40 @@ dependencies:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
28
  version: '2'
29
+ - !ruby/object:Gem::Dependency
30
+ name: railties
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '4.2'
36
+ - - "<"
37
+ - !ruby/object:Gem::Version
38
+ version: '7.1'
39
+ type: :runtime
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: '4.2'
46
+ - - "<"
47
+ - !ruby/object:Gem::Version
48
+ version: '7.1'
29
49
  - !ruby/object:Gem::Dependency
30
50
  name: sprockets
31
51
  requirement: !ruby/object:Gem::Requirement
32
52
  requirements:
33
53
  - - ">="
34
54
  - !ruby/object:Gem::Version
35
- version: '2'
55
+ version: '3.7'
36
56
  type: :runtime
37
57
  prerelease: false
38
58
  version_requirements: !ruby/object:Gem::Requirement
39
59
  requirements:
40
60
  - - ">="
41
61
  - !ruby/object:Gem::Version
42
- version: '2'
62
+ version: '3.7'
43
63
  - !ruby/object:Gem::Dependency
44
64
  name: bundler
45
65
  requirement: !ruby/object:Gem::Requirement
@@ -222,6 +242,20 @@ dependencies:
222
242
  - - ">="
223
243
  - !ruby/object:Gem::Version
224
244
  version: '0'
245
+ - !ruby/object:Gem::Dependency
246
+ name: puma
247
+ requirement: !ruby/object:Gem::Requirement
248
+ requirements:
249
+ - - ">="
250
+ - !ruby/object:Gem::Version
251
+ version: '0'
252
+ type: :development
253
+ prerelease: false
254
+ version_requirements: !ruby/object:Gem::Requirement
255
+ requirements:
256
+ - - ">="
257
+ - !ruby/object:Gem::Version
258
+ version: '0'
225
259
  description: Compile Haml CoffeeScript templates in the Rails asset pipeline.
226
260
  email:
227
261
  - michi@flinkfinger.com
@@ -259,15 +293,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
259
293
  requirements:
260
294
  - - ">="
261
295
  - !ruby/object:Gem::Version
262
- version: 1.9.3
296
+ version: '2.5'
263
297
  required_rubygems_version: !ruby/object:Gem::Requirement
264
298
  requirements:
265
299
  - - ">="
266
300
  - !ruby/object:Gem::Version
267
- version: 1.3.6
301
+ version: 2.5.2
268
302
  requirements: []
269
- rubyforge_project: haml_coffee_assets
270
- rubygems_version: 2.6.10
303
+ rubygems_version: 3.2.33
271
304
  signing_key:
272
305
  specification_version: 4
273
306
  summary: Haml CoffeeScript templates