ember-es6_template 0.2.1 → 0.2.2

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: 876adc28ef214a2ac6984b491f78613476cc7bde
4
- data.tar.gz: 8700b61456b3a4da31930deb333ac95f23a8839b
3
+ metadata.gz: cc9281fed91e8debece31cf2ec7c7b1965daa2a1
4
+ data.tar.gz: b86c0e435c11fbcc23442ece9cb73d88b4251960
5
5
  SHA512:
6
- metadata.gz: f4052077697251822e91890a8555648e8e2186f4b457be73f3147f2666986159197c387d2b2b3d45e5cbd81a6c63e172120de128dde19dff400596a516e0f03e
7
- data.tar.gz: 509df12a1defad6b44394f4aa73f950077f2858956c347f18c0f988b24ceb4b2543be8e6a8a59678a21662cce66689950c437991799c2252348cf776f7ad9953
6
+ metadata.gz: 8f28cd28af9ea375004b9038ddf9c10d6a4a0bbe1901d440e60da8779dd6b1ab871e0c59368e40813eabfe0d04ea08066819d09ad4d23cba30fe90727b8de026
7
+ data.tar.gz: 501606377c77574127843bfe95b38d2a7c9fe0c96c1ec5fcb3fc93cec0de47dce95b2f1c17705bf4c49e1e39b01e478dd764268e70b60d136871451c9e505b87
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency 'babel-transpiler', '>= 0.6.0', '< 0.8'
22
- spec.add_dependency 'sprockets'
22
+ spec.add_dependency 'sprockets', '>= 2.1', '< 4'
23
23
 
24
24
  spec.add_development_dependency 'bundler', '~> 1.7'
25
25
  spec.add_development_dependency 'rake', '~> 10.0'
@@ -7,28 +7,9 @@ module Ember
7
7
  module ES6Template
8
8
  case Sprockets::VERSION
9
9
  when /^2\./
10
- autoload :ES6, 'ember/es6_template/es6_sprockets2'
11
- autoload :ES6Module, 'ember/es6_template/es6module_sprockets2'
12
- autoload :CoffeeScript, 'ember/es6_template/coffee_script_sprockets2'
13
-
14
- def self.setup(env)
15
- env.register_engine '.es6', ES6
16
- env.register_engine '.module', ES6Module
17
- env.register_engine '.coffee', CoffeeScript
18
- end
10
+ require 'ember/es6_template/sprockets2'
19
11
  when /^3\./
20
- autoload :ES6, 'ember/es6_template/es6'
21
- autoload :ES6Module, 'ember/es6_template/es6module'
22
- autoload :CoffeeScript, 'ember/es6_template/coffee_script'
23
- autoload :CoffeeScriptModule, 'ember/es6_template/coffee_script_module'
24
- autoload :CoffeeScriptHelper, 'ember/es6_template/coffee_script_helper'
25
-
26
- def self.setup(env)
27
- env.register_engine '.es6', ES6, mime_type: 'application/javascript'
28
- env.register_engine '.module.es6', ES6Module, mime_type: 'application/javascript'
29
- env.register_engine '.module.coffee', CoffeeScriptModule, mime_type: 'application/javascript'
30
- env.register_engine '.coffee', CoffeeScript, mime_type: 'application/javascript' # Force parse as ES6
31
- end
12
+ require 'ember/es6_template/sprockets3'
32
13
  else
33
14
  raise "Unsupported sprockets version: #{Sprockets::VERSION}"
34
15
  end
@@ -0,0 +1,13 @@
1
+ module Ember
2
+ module ES6Template
3
+ autoload :ES6, 'ember/es6_template/sprockets2/es6'
4
+ autoload :ES6Module, 'ember/es6_template/sprockets2/es6module'
5
+ autoload :CoffeeScript, 'ember/es6_template/sprockets2/coffee_script'
6
+
7
+ def self.setup(env)
8
+ env.register_engine '.es6', ES6
9
+ env.register_engine '.module', ES6Module
10
+ env.register_engine '.coffee', CoffeeScript
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ module Ember
2
+ module ES6Template
3
+ class CoffeeScript < Tilt::CoffeeScriptTemplate
4
+ def evaluate(scope, locals, &block)
5
+ filename = scope.pathname.to_s
6
+
7
+ if es6?(filename)
8
+ ::CoffeeScript.compile(data, bare: true)
9
+ else
10
+ super
11
+ end
12
+ end
13
+
14
+ private
15
+
16
+ def es6?(filename)
17
+ filename =~ /\.(?:module|es6)\.coffee/
18
+ end
19
+ end
20
+ end
21
+ end
@@ -12,14 +12,21 @@ module Ember
12
12
  def evaluate(scope, locals, &block)
13
13
  env = scope.environment
14
14
 
15
+ return data if module?(scope.pathname.to_s)
16
+
15
17
  result = Babel::Transpiler.transform(data,
16
18
  'sourceRoot' => env.root,
17
19
  'moduleRoot' => '',
18
- 'filename' => scope.logical_path,
19
- 'blacklist' => ['es6.modules']
20
+ 'filename' => scope.logical_path
20
21
  )
21
22
 
22
- result['code']
23
+ return result['code']
24
+ end
25
+
26
+ private
27
+
28
+ def module?(filename)
29
+ filename =~ /\.module\.es6/
23
30
  end
24
31
  end
25
32
  end
@@ -0,0 +1,17 @@
1
+ module Ember
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'
8
+
9
+ def self.setup(env)
10
+ env.register_engine '.es6', ES6, mime_type: 'application/javascript'
11
+ env.register_engine '.module.es6', ES6Module, mime_type: 'application/javascript'
12
+ env.register_engine '.module.coffee', CoffeeScriptModule, mime_type: 'application/javascript'
13
+ env.register_engine '.coffee', CoffeeScript, mime_type: 'application/javascript' # Force parse as ES6
14
+ end
15
+ end
16
+ end
17
+
@@ -1,5 +1,5 @@
1
1
  module Ember
2
2
  module ES6Template
3
- VERSION = '0.2.1'
3
+ VERSION = '0.2.2'
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.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryunosuke SATO
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-04-03 00:00:00.000000000 Z
11
+ date: 2015-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: babel-transpiler
@@ -36,14 +36,20 @@ dependencies:
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: '0'
39
+ version: '2.1'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '4'
40
43
  type: :runtime
41
44
  prerelease: false
42
45
  version_requirements: !ruby/object:Gem::Requirement
43
46
  requirements:
44
47
  - - ">="
45
48
  - !ruby/object:Gem::Version
46
- version: '0'
49
+ version: '2.1'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '4'
47
53
  - !ruby/object:Gem::Dependency
48
54
  name: bundler
49
55
  requirement: !ruby/object:Gem::Requirement
@@ -131,14 +137,16 @@ files:
131
137
  - bin/setup
132
138
  - ember-es6_template.gemspec
133
139
  - lib/ember/es6_template.rb
134
- - lib/ember/es6_template/coffee_script.rb
135
- - lib/ember/es6_template/coffee_script_helper.rb
136
- - lib/ember/es6_template/coffee_script_module.rb
137
- - lib/ember/es6_template/coffee_script_sprockets2.rb
138
- - lib/ember/es6_template/es6.rb
139
- - lib/ember/es6_template/es6_sprockets2.rb
140
- - lib/ember/es6_template/es6module.rb
141
- - lib/ember/es6_template/es6module_sprockets2.rb
140
+ - lib/ember/es6_template/sprockets2.rb
141
+ - lib/ember/es6_template/sprockets2/coffee_script.rb
142
+ - lib/ember/es6_template/sprockets2/es6.rb
143
+ - lib/ember/es6_template/sprockets2/es6module.rb
144
+ - lib/ember/es6_template/sprockets3.rb
145
+ - lib/ember/es6_template/sprockets3/coffee_script.rb
146
+ - lib/ember/es6_template/sprockets3/coffee_script_helper.rb
147
+ - lib/ember/es6_template/sprockets3/coffee_script_module.rb
148
+ - lib/ember/es6_template/sprockets3/es6.rb
149
+ - lib/ember/es6_template/sprockets3/es6module.rb
142
150
  - lib/ember/es6_template/version.rb
143
151
  homepage: https://github.com/tricknotes/ember-es6_template
144
152
  licenses:
@@ -1,37 +0,0 @@
1
- module Ember
2
- module ES6Template
3
- class CoffeeScript < Tilt::CoffeeScriptTemplate
4
- def evaluate(scope, locals, &block)
5
- env = scope.environment
6
-
7
- filename = scope.pathname.to_s
8
-
9
- if es6_module?(filename)
10
- ::CoffeeScript.compile(data, bare: true)
11
- elsif es6?(filename)
12
- result = Babel::Transpiler.transform(
13
- ::CoffeeScript.compile(data, bare: true),
14
- 'sourceRoot' => env.root,
15
- 'moduleRoot' => '',
16
- 'filename' => scope.logical_path
17
- )
18
-
19
- result['code']
20
- else
21
- super
22
- end
23
- end
24
-
25
- private
26
-
27
- def es6_module?(filename)
28
- filename =~ /\.module\.(?:es6\.)?coffee/
29
- end
30
-
31
- def es6?(filename)
32
- filename =~ /\.(?:es6\.)?coffee/
33
- end
34
- end
35
- end
36
- end
37
-