ember-handlebars-template 0.5.0 → 0.6.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: e76c09531d2829e62791c735bed549bc15388755
4
- data.tar.gz: 94e698d5e73378bd86c7009d929b4a355b55a7bc
3
+ metadata.gz: 6b4d0d73a1c7de72d9dd6374b991694fbf66666b
4
+ data.tar.gz: 1715422100d413db2b51ea25892c72b43d22410d
5
5
  SHA512:
6
- metadata.gz: 2f2f6d25708054f22519aaffeeaf54406162446f1f6e0ab0d73f780d316ec3ba4c742987b89acd7ba29a36bc8ebc706c87f30323573cf4004ea28006cfd69d15
7
- data.tar.gz: e58d4b1f0a45a4a52e219bd0af09d9632bd7f1f81298569ba135b28a56ccee28145890d7f9b39709d45a97c0cf8390a1cbc974a70c9b40b30bb63f3f40128b6c
6
+ metadata.gz: 41559a84246011cc12c4758a8c3f44cda51175d460a484897f831f22c31bcb63283fb9ba747b1576c8e80beb6339d99e351517baa0fef27d4cae295a65635d0b
7
+ data.tar.gz: d0a8f4badb7cc6eb70d652aba0d05b6ca9ac4e9c3f0c3f63f932196f271537fef06438710a19159630d91b149bf28ce80a4297b558b936e7d979dc184c4d6fa7
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
 
21
21
  spec.add_dependency 'sprockets', '>= 3.3', '< 3.6'
22
- spec.add_dependency 'barber', '>= 0.10.0'
22
+ spec.add_dependency 'barber', '>= 0.11.0'
23
23
 
24
24
  spec.add_development_dependency 'bundler', '~> 1.7'
25
25
  spec.add_development_dependency 'rake', '~> 10.0'
@@ -38,7 +38,7 @@ module Ember
38
38
 
39
39
  unless root.empty?
40
40
  Array(root).each.each do |r|
41
- path.sub!(/#{Regexp.quote(r)}\//, '')
41
+ path = path.sub(/#{Regexp.quote(r)}\//, '')
42
42
  end
43
43
  end
44
44
 
@@ -55,12 +55,12 @@ module Ember
55
55
  "Handlebars.template(#{Barber::Precompiler.compile(string)});"
56
56
  end
57
57
 
58
- def compile_ember_handlebars(string, ember_template = 'Handlebars')
59
- "Ember.#{ember_template}.compile(#{indent(string).inspect});"
58
+ def compile_ember_handlebars(string, ember_template = 'Handlebars', options = nil)
59
+ "Ember.#{ember_template}.compile(#{indent(string).inspect}, #{options.to_json});"
60
60
  end
61
61
 
62
- def precompile_ember_handlebars(string, ember_template = 'Handlebars')
63
- "Ember.#{ember_template}.template(#{Barber::Ember::Precompiler.compile(string)});"
62
+ def precompile_ember_handlebars(string, ember_template = 'Handlebars', options = nil)
63
+ "Ember.#{ember_template}.template(#{Barber::Ember::Precompiler.compile(string, options)});"
64
64
  end
65
65
 
66
66
  def indent(string)
@@ -56,27 +56,39 @@ module Ember
56
56
  template = mustache_to_handlebars(filename, data)
57
57
  end
58
58
 
59
+ template_name = actual_name(input)
60
+
61
+ module_name =
62
+ case config.output_type
63
+ when :amd
64
+ amd_template_target(config.amd_namespace, template_name)
65
+ when :global
66
+ template_path(template_name, config)
67
+ else
68
+ raise "Unsupported `output_type`: #{config.output_type}"
69
+ end
70
+
71
+ meta = {moduleName: module_name}
72
+
59
73
  if config.precompile
60
74
  if raw
61
75
  template = precompile_handlebars(template)
62
76
  else
63
- template = precompile_ember_handlebars(template, config.ember_template, input)
77
+ template = precompile_ember_handlebars(template, config.ember_template, input, meta)
64
78
  end
65
79
  else
66
80
  if raw
67
81
  template = compile_handlebars(data)
68
82
  else
69
- template = compile_ember_handlebars(template, config.ember_template)
83
+ template = compile_ember_handlebars(template, config.ember_template, meta)
70
84
  end
71
85
  end
72
86
 
73
87
  case config.output_type
74
88
  when :amd
75
- target = amd_template_target(config.amd_namespace, actual_name(input))
76
-
77
- "define('#{target}', ['exports'], function(__exports__){ __exports__['default'] = #{template} });"
89
+ "define('#{module_name}', ['exports'], function(__exports__){ __exports__['default'] = #{template} });"
78
90
  when :global
79
- target = global_template_target(actual_name(input), config)
91
+ target = global_template_target(template_name, config)
80
92
 
81
93
  "#{target} = #{template}\n"
82
94
  else
@@ -97,15 +109,16 @@ module Ember
97
109
  end
98
110
  end
99
111
 
100
- def precompile_ember_handlebars(template, ember_template, input)
112
+ def precompile_ember_handlebars(template, ember_template, input, options = nil)
101
113
  dependencies = [
102
114
  Barber::Ember::Precompiler.compiler_version,
103
115
  ember_template,
104
- template
116
+ template,
117
+ options
105
118
  ]
106
119
 
107
120
  input[:cache].fetch(_cache_key + dependencies) do
108
- super(template, ember_template)
121
+ super(template, ember_template, options)
109
122
  end
110
123
  end
111
124
 
@@ -1,5 +1,5 @@
1
1
  module Ember
2
2
  module Handlebars
3
- VERSION = '0.5.0'
3
+ VERSION = '0.6.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ember-handlebars-template
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
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-12-10 00:00:00.000000000 Z
11
+ date: 2015-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sprockets
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: 0.10.0
39
+ version: 0.11.0
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 0.10.0
46
+ version: 0.11.0
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  version: '0'
127
127
  requirements: []
128
128
  rubyforge_project:
129
- rubygems_version: 2.4.5.1
129
+ rubygems_version: 2.5.0
130
130
  signing_key:
131
131
  specification_version: 4
132
132
  summary: The sprockets template for Ember Handlebars.