haml_coffee_assets 1.16.2 → 1.17.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: 26b6eddf6e0907f03202659cbb98ca7ad5ab506a
4
- data.tar.gz: 13609dfc9331d8baf0392c8d76df05a824f988fe
3
+ metadata.gz: 1121228ce86ce585710d352537905a984db3d50e
4
+ data.tar.gz: 6ddeef502a46018c8b570e303e5b46d8749bdf40
5
5
  SHA512:
6
- metadata.gz: f94ab59ac739b175f970278bb640f13d4b473fae79d7c2955c19080c0debccc12491143e3621c7310130b4be509f4d88721919f313a3d4a99b0cc93dd780a456
7
- data.tar.gz: 3e135ec8fb7f739364e93cd4b72a6b2755a93be2a6cb1e00b9a9f987e49770400c5efd08d19f1a2cb111c1748e7863f328f0fd985d2e71ea87929ebd0a4ba959
6
+ metadata.gz: 645021b57b8ab7148cfeb5cd034023d702ecf71ff6fb26d8d893e75d88f9bfe2cdcd5f631dbfefa3f34e78e24989e80fdd41535b2a66fa61aa29744b68920ee0
7
+ data.tar.gz: 9ee8dddacee4b351b97f83657ad65307cba163650266eb16fa6e39a7713d972c802dd290b0150cb7c68bdd0a3412e59c0699cf960942ed1e52d4413bac8047bf
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Haml Coffee Assets [![Build Status](https://secure.travis-ci.org/netzpirat/haml_coffee_assets.png)](http://travis-ci.org/netzpirat/haml_coffee_assets)
1
+ # Haml Coffee Assets [![Build Status](https://secure.travis-ci.org/emilioforrer/haml_coffee_assets.png)](http://travis-ci.org/emilioforrer/haml_coffee_assets)
2
2
 
3
3
  Haml Coffee Assets compiles [Haml Coffee](https://github.com/netzpirat/haml-coffee) templates in the Rails 3.1 asset
4
4
  pipeline, so you can use them as JavaScript templates in your JavaScript heavy Rails application. Server-side rendering
@@ -59,7 +59,7 @@ If you're using AMD support then you do not need to include the above helper, si
59
59
  This provides the default escaping and the global context functions. Read more about it in the configuration section
60
60
  below.
61
61
 
62
- Please have a look at the [CHANGELOG](https://github.com/netzpirat/haml_coffee_assets/blob/master/CHANGELOG.md) when
62
+ Please have a look at the [CHANGELOG](https://github.com/emilioforrer/haml_coffee_assets/blob/master/CHANGELOG.md) when
63
63
  upgrading to a newer Haml Coffee Assets version.
64
64
 
65
65
  If you want to use Haml Coffee with Sinatra, please have a look at the
@@ -408,7 +408,7 @@ App.globalTemplateContext = (locals) -> HAML.extend({}, {
408
408
  }, locals)
409
409
  ```
410
410
 
411
- Please have a look at the wiki for [further examples](https://github.com/netzpirat/haml_coffee_assets/wiki) on how to
411
+ Please have a look at the wiki for [further examples](https://github.com/emilioforrer/haml_coffee_assets/wiki) on how to
412
412
  use the global context.
413
413
 
414
414
  ### Customize the tag lists
@@ -456,7 +456,7 @@ to, you can set custom functions for:
456
456
  * config.hamlcoffee.customSucceed
457
457
  * config.hamlcoffee.customPrecede
458
458
 
459
- You can see the [default implementation](https://github.com/netzpirat/haml_coffee_assets/blob/master/vendor/assets/javascripts/hamlcoffee.js.coffee.erb)
459
+ You can see the [default implementation](https://github.com/emilioforrer/haml_coffee_assets/blob/master/vendor/assets/javascripts/hamlcoffee.js.coffee.erb)
460
460
  and the [Haml Coffee documentation](https://github.com/netzpirat/haml-coffee#custom-helper-function-options)
461
461
  for more information about each helper function.
462
462
 
@@ -516,14 +516,14 @@ example.
516
516
 
517
517
  Developed by Michael Kessler, [FlinkFinger](http://www.flinkfinger.com).
518
518
 
519
- If you like Haml Coffee Assets, you can watch the repository at [GitHub](https://github.com/netzpirat/haml_coffee_assets)
519
+ If you like Haml Coffee Assets, you can watch the repository at [GitHub](https://github.com/emilioforrer/haml_coffee_assets)
520
520
  and follow [@netzpirat](https://twitter.com/#!/netzpirat) on Twitter for project updates.
521
521
 
522
522
  ## Development
523
523
 
524
- * Issues and feature request hosted at [GitHub Issues](https://github.com/netzpirat/haml_coffee_assets/issues).
525
- * Documentation hosted at [RubyDoc](http://rubydoc.info/github/netzpirat/haml_coffee_assets/master/frames).
526
- * Source hosted at [GitHub](https://github.com/netzpirat/haml_coffee_assets).
524
+ * Issues and feature request hosted at [GitHub Issues](https://github.com/emilioforrer/haml_coffee_assets/issues).
525
+ * Documentation hosted at [RubyDoc](http://rubydoc.info/github/emilioforrer/haml_coffee_assets/master/frames).
526
+ * Source hosted at [GitHub](https://github.com/emilioforrer/haml_coffee_assets).
527
527
 
528
528
  Pull requests are very welcome! Please try to follow these simple rules if applicable:
529
529
 
@@ -548,8 +548,8 @@ Please try to follow these simple rules:
548
548
 
549
549
  ## Contributors
550
550
 
551
- See the [CHANGELOG](https://github.com/netzpirat/haml_coffee_assets/blob/master/CHANGELOG.md) and the GitHub list of
552
- [contributors](https://github.com/netzpirat/haml_coffee_assets/contributors).
551
+ See the [CHANGELOG](https://github.com/emilioforrer/haml_coffee_assets/blob/master/CHANGELOG.md) and the GitHub list of
552
+ [contributors](https://github.com/emilioforrer/haml_coffee_assets/contributors).
553
553
 
554
554
  ## Acknowledgement
555
555
 
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'pathname'
4
4
 
5
- require 'tilt'
6
5
  require 'sprockets'
7
6
  require 'execjs'
8
7
 
@@ -11,7 +10,7 @@ require 'haml_coffee_assets/configuration'
11
10
  require 'haml_coffee_assets/compiler'
12
11
  require 'haml_coffee_assets/version'
13
12
 
14
- require 'haml_coffee_assets/tilt/template_handler'
13
+ require 'haml_coffee_assets/transformer'
15
14
 
16
15
  if defined?(Rails) && Rails.version >= '3.0.0'
17
16
  require 'rails'
@@ -19,7 +18,7 @@ if defined?(Rails) && Rails.version >= '3.0.0'
19
18
  require 'haml_coffee_assets/action_view/patches'
20
19
  else
21
20
  require 'sprockets/engines'
22
- Sprockets.register_engine '.hamlc', ::HamlCoffeeAssets::Tilt::TemplateHandler
21
+ Sprockets.register_engine '.hamlc', ::HamlCoffeeAssets::Transformer
23
22
  end
24
23
 
25
24
  # Main Haml Coffee Assets module with
@@ -77,10 +77,18 @@ module HamlCoffeeAssets
77
77
  end
78
78
  end
79
79
 
80
- next unless app.assets
80
+ config.assets.configure do |env|
81
+ if env.respond_to?(:register_transformer)
82
+ env.register_mime_type 'text/hamlc', extensions: ['.hamlc']
83
+ env.register_transformer 'text/hamlc', 'application/javascript', ::HamlCoffeeAssets::Transformer
84
+ end
81
85
 
82
- # Register Tilt template (for Sprockets)
83
- app.assets.register_engine '.hamlc', ::HamlCoffeeAssets::Tilt::TemplateHandler
86
+ if env.respond_to?(:register_engine)
87
+ args = ['.hamlc', ::HamlCoffeeAssets::Transformer]
88
+ args << { mime_type: 'text/hamlc', silence_deprecation: true } if Sprockets::VERSION.start_with?('3')
89
+ env.register_engine(*args)
90
+ end
91
+ end
84
92
  end
85
93
 
86
94
  end
@@ -0,0 +1,33 @@
1
+ # coding: UTF-8
2
+
3
+ module HamlCoffeeAssets
4
+ # Haml Coffee Sprockets processor
5
+ #
6
+ class Transformer
7
+ def initialize(filename, &block)
8
+ @filename = filename
9
+ @source = block.call
10
+ end
11
+
12
+ def render(context, empty_hash_wtf)
13
+ self.class.run(@filename, @source, context)
14
+ end
15
+
16
+ def self.run(filename, source, context)
17
+ jst = !!(filename =~ /\.jst\.hamlc(?:\.|$)/)
18
+ name = filename
19
+ name = HamlCoffeeAssets.config.name_filter.call(name) if HamlCoffeeAssets.config.name_filter && !jst
20
+
21
+ HamlCoffeeAssets::Compiler.compile(name, source, !jst)
22
+ end
23
+
24
+ def self.call(input)
25
+ filename = input[:name]
26
+ source = input[:data]
27
+ context = input[:environment].context_class.new(input)
28
+
29
+ result = run(filename, source, context)
30
+ context.metadata.merge(data: result)
31
+ end
32
+ end
33
+ end
@@ -1,5 +1,5 @@
1
1
  # coding: UTF-8
2
2
 
3
3
  module HamlCoffeeAssets
4
- VERSION = '1.16.2' unless defined?(HamlCoffeeAssets::VERSION)
4
+ VERSION = '1.17.0' unless defined?(HamlCoffeeAssets::VERSION)
5
5
  end
@@ -48,7 +48,7 @@ define ->
48
48
  #
49
49
  findAndPreserve: (text) ->
50
50
  tags = '<%= ::HamlCoffeeAssets.config.preserveTags %>'.split(',').join('|')
51
- text = text.replace(/\r/g, '').replace ///<(#{ tags })>([\s\S]*?)<\/\1>/// g, (str, tag, content) ->
51
+ text = text.replace(/\r/g, '').replace ///<(#{ tags })>([\s\S]*?)<\/\1>///g, (str, tag, content) ->
52
52
  "<#{ tag }>#{ <%= ::HamlCoffeeAssets.config.customPreserve %>(content) }</#{ tag }>"
53
53
 
54
54
  # The surround helper surrounds the function output
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml_coffee_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.2
4
+ version: 1.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Kessler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-26 00:00:00.000000000 Z
11
+ date: 2016-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coffee-script
@@ -25,35 +25,189 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2'
27
27
  - !ruby/object:Gem::Dependency
28
- name: tilt
28
+ name: sprockets
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1'
33
+ version: '2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1'
40
+ version: '2'
41
41
  - !ruby/object:Gem::Dependency
42
- name: sprockets
42
+ name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '2'
48
- type: :runtime
47
+ version: '0'
48
+ type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '2'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: bundler
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: jquery-rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: coffee-rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: jasmine
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: jasmine-rails
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: guard
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: guard-jasmine
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: guard-rspec
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: rake
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: yard
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: pry
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: rb-readline
57
211
  requirement: !ruby/object:Gem::Requirement
58
212
  requirements:
59
213
  - - ">="
@@ -83,13 +237,13 @@ files:
83
237
  - lib/haml_coffee_assets/configuration.rb
84
238
  - lib/haml_coffee_assets/global_context.rb
85
239
  - lib/haml_coffee_assets/rails/engine.rb
86
- - lib/haml_coffee_assets/tilt/template_handler.rb
240
+ - lib/haml_coffee_assets/transformer.rb
87
241
  - lib/haml_coffee_assets/version.rb
88
242
  - lib/js/haml_coffee_assets.js
89
243
  - lib/js/hamlcoffee.js
90
244
  - vendor/assets/javascripts/hamlcoffee.js.coffee.erb
91
245
  - vendor/assets/javascripts/hamlcoffee_amd.js.coffee.erb
92
- homepage: https://github.com/netzpirat/haml_coffee_assets
246
+ homepage: https://github.com/emilioforrer/haml_coffee_assets
93
247
  licenses:
94
248
  - MIT
95
249
  metadata: {}
@@ -1,48 +0,0 @@
1
- # coding: UTF-8
2
-
3
- require 'tilt'
4
-
5
- module HamlCoffeeAssets
6
- module Tilt
7
-
8
- # Haml Coffee template handler implementation for Tilt.
9
- #
10
- class TemplateHandler < ::Tilt::Template
11
-
12
- self.default_mime_type = 'application/javascript'
13
-
14
- # Test if the compiler is initialized.
15
- #
16
- # @return [Boolean] the initialization status
17
- #
18
- def self.engine_initialized?
19
- defined? HamlCoffeeAssets::Compiler
20
- end
21
-
22
- # Initialize the template engine.
23
- #
24
- def initialize_engine
25
- require_template_library 'haml_coffee_assets/compiler'
26
- end
27
-
28
- # Prepare the template
29
- #
30
- def prepare
31
- end
32
-
33
- # Compile the template.
34
- #
35
- def evaluate(scope, locals = { }, &block)
36
- jst = !!(scope.pathname.to_s =~ /\.jst\.hamlc(?:\.|$)/)
37
- name = scope.logical_path
38
- name = HamlCoffeeAssets.config.name_filter.call(name) if HamlCoffeeAssets.config.name_filter && !jst
39
-
40
- @output ||= HamlCoffeeAssets::Compiler.compile(name, data, !jst)
41
- end
42
-
43
- private
44
-
45
- end
46
-
47
- end
48
- end