ember-es6_template 0.5.0 → 0.5.1

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: 42edda08f0f4c6a3f5fdf6484094568146f9717e
4
- data.tar.gz: 2d764e7c029fd1ffb91ad2030496f5894ce09459
3
+ metadata.gz: 4767d51dcfca91109c78fb8a1cb11e75fdb9675f
4
+ data.tar.gz: 3969bc707633b3ce5a2a2623967f0a5330863542
5
5
  SHA512:
6
- metadata.gz: 3d76ccf711685a6245d14f53c4fdf4771309aee6191e2ceb7b645de1889bc2323c73b60bdf4eb7d8dcd1ce412caef5eb55545d68ff2ef9da17d30be93104250f
7
- data.tar.gz: 9f8853546eaddc91656d11eb4e1c5dbf7699c132a9fe8b64c5548593beab67062e4dae029ed9067364d7b85ffe4a5d098864685a3c9503780fbbed992b18f606
6
+ metadata.gz: 80700526177a4185c7e81918f06924e26adf8bdcc12947fa3fdf47a87c9411004632c9fcedb2f0cf5362db74540dbdea33c9cfccbca4b03f7be9d811ed8118f5
7
+ data.tar.gz: ca3af93e133d8e124b42c3eb543cef4d0c0643780e275e26ee808615c7c1d2d3caa7afd258c6e9a075910afd467d460c139f87035569f0a1411b1e7d2fd08797
data/.travis.yml CHANGED
@@ -3,7 +3,6 @@ cache: bundler
3
3
  sudo: false
4
4
 
5
5
  rvm:
6
- - 2.0.0
7
6
  - 2.1
8
7
  - 2.2.4
9
8
  - 2.3.0
@@ -7,9 +7,9 @@ module Ember
7
7
  module ES6Template
8
8
  case Sprockets::VERSION
9
9
  when /^2\./
10
- require 'ember/es6_template/sprockets2'
10
+ require 'ember/es6_template/sprockets-legacy'
11
11
  when /^[34]\./
12
- require 'ember/es6_template/sprockets3'
12
+ require 'ember/es6_template/sprockets'
13
13
  else
14
14
  raise "Unsupported sprockets version: #{Sprockets::VERSION}"
15
15
  end
@@ -6,9 +6,9 @@ end
6
6
 
7
7
  module Ember
8
8
  module ES6Template
9
- autoload :ES6, 'ember/es6_template/sprockets2/es6'
10
- autoload :ES6Module, 'ember/es6_template/sprockets2/es6module'
11
- autoload :CoffeeScript, 'ember/es6_template/sprockets2/coffee_script'
9
+ autoload :ES6, 'ember/es6_template/sprockets-legacy/es6'
10
+ autoload :ES6Module, 'ember/es6_template/sprockets-legacy/es6module'
11
+ autoload :CoffeeScript, 'ember/es6_template/sprockets-legacy/coffee_script'
12
12
 
13
13
  def self.setup(env)
14
14
  env.register_engine '.es6', ES6
@@ -1,14 +1,17 @@
1
1
  module Ember
2
2
  module ES6Template
3
3
  class CoffeeScript < Tilt::CoffeeScriptTemplate
4
+ self.default_mime_type = 'application/javascript'
5
+
4
6
  def evaluate(scope, locals, &block)
5
7
  filename = scope.pathname.to_s
6
8
 
7
- if es6?(filename)
8
- ::CoffeeScript.compile(data, bare: true)
9
- else
10
- super
11
- end
9
+ @output ||=
10
+ if es6?(filename)
11
+ ::CoffeeScript.compile(data, options.merge(bare: true))
12
+ else
13
+ ::CoffeeScript.compile(data, options)
14
+ end
12
15
  end
13
16
 
14
17
  private
@@ -1,10 +1,10 @@
1
1
  module Ember
2
2
  module ES6Template
3
- autoload :ES6, 'ember/es6_template/sprockets3/es6'
4
- autoload :ES6Module, 'ember/es6_template/sprockets3/es6module'
5
- autoload :CoffeeScript, 'ember/es6_template/sprockets3/coffee_script'
6
- autoload :CoffeeScriptModule, 'ember/es6_template/sprockets3/coffee_script_module'
7
- autoload :CoffeeScriptHelper, 'ember/es6_template/sprockets3/coffee_script_helper'
3
+ autoload :ES6, 'ember/es6_template/sprockets/es6'
4
+ autoload :ES6Module, 'ember/es6_template/sprockets/es6module'
5
+ autoload :CoffeeScript, 'ember/es6_template/sprockets/coffee_script'
6
+ autoload :CoffeeScriptModule, 'ember/es6_template/sprockets/coffee_script_module'
7
+ autoload :CoffeeScriptHelper, 'ember/es6_template/sprockets/coffee_script_helper'
8
8
 
9
9
  def self.setup(env)
10
10
  env.register_mime_type 'application/ecmascript-6', extensions: %w(.es6)
@@ -5,10 +5,16 @@ module Ember
5
5
  data = input[:data]
6
6
 
7
7
  result = input[:cache].fetch(_cache_key + [data]) do
8
- transform(
9
- Sprockets::Autoload::CoffeeScript.compile(data, bare: true),
10
- input
11
- )
8
+ if es6?(input[:filename])
9
+ transform(
10
+ Sprockets::Autoload::CoffeeScript.compile(data, bare: true),
11
+ input
12
+ )
13
+ else
14
+ code = Sprockets::Autoload::CoffeeScript.compile(data, bare: false)
15
+
16
+ {'code' => code}
17
+ end
12
18
  end
13
19
 
14
20
  result['code']
@@ -25,6 +31,10 @@ module Ember
25
31
  Sprockets::Autoload::CoffeeScript.version
26
32
  ]
27
33
  end
34
+
35
+ def es6?(filename)
36
+ File.basename(filename) =~ /\.(?:es6|module)\./
37
+ end
28
38
  end
29
39
  end
30
40
  end
@@ -1,5 +1,5 @@
1
1
  module Ember
2
2
  module ES6Template
3
- VERSION = '0.5.0'
3
+ VERSION = '0.5.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ember-es6_template
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryunosuke SATO
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-22 00:00:00.000000000 Z
11
+ date: 2016-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: babel-transpiler
@@ -138,16 +138,16 @@ files:
138
138
  - ember-es6_template.gemspec
139
139
  - lib/ember/es6_template.rb
140
140
  - lib/ember/es6_template/config.rb
141
- - lib/ember/es6_template/sprockets2.rb
142
- - lib/ember/es6_template/sprockets2/coffee_script.rb
143
- - lib/ember/es6_template/sprockets2/es6.rb
144
- - lib/ember/es6_template/sprockets2/es6module.rb
145
- - lib/ember/es6_template/sprockets3.rb
146
- - lib/ember/es6_template/sprockets3/coffee_script.rb
147
- - lib/ember/es6_template/sprockets3/coffee_script_helper.rb
148
- - lib/ember/es6_template/sprockets3/coffee_script_module.rb
149
- - lib/ember/es6_template/sprockets3/es6.rb
150
- - lib/ember/es6_template/sprockets3/es6module.rb
141
+ - lib/ember/es6_template/sprockets-legacy.rb
142
+ - lib/ember/es6_template/sprockets-legacy/coffee_script.rb
143
+ - lib/ember/es6_template/sprockets-legacy/es6.rb
144
+ - lib/ember/es6_template/sprockets-legacy/es6module.rb
145
+ - lib/ember/es6_template/sprockets.rb
146
+ - lib/ember/es6_template/sprockets/coffee_script.rb
147
+ - lib/ember/es6_template/sprockets/coffee_script_helper.rb
148
+ - lib/ember/es6_template/sprockets/coffee_script_module.rb
149
+ - lib/ember/es6_template/sprockets/es6.rb
150
+ - lib/ember/es6_template/sprockets/es6module.rb
151
151
  - lib/ember/es6_template/version.rb
152
152
  homepage: https://github.com/tricknotes/ember-es6_template
153
153
  licenses: