barber 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +13 -4
- data/Gemfile +3 -0
- data/Rakefile +0 -1
- data/barber.gemspec +0 -1
- data/lib/barber/ember/precompilers.rb +5 -5
- data/lib/barber/javascripts/ember_precompiler.js +2 -2
- data/lib/barber/precompiler.rb +4 -4
- data/lib/barber/precompilers.rb +5 -5
- data/lib/barber/version.rb +1 -1
- data/test/ember/precompilers_test.rb +17 -2
- data/test/precompilers_test.rb +17 -2
- metadata +3 -25
- data/Appraisals +0 -34
- data/gemfiles/ember_1.0.gemfile +0 -8
- data/gemfiles/ember_1.10.gemfile +0 -8
- data/gemfiles/ember_1.13.gemfile +0 -8
- data/gemfiles/ember_1.8.gemfile +0 -8
- data/gemfiles/ember_1.9.gemfile +0 -8
- data/gemfiles/ember_2.2.gemfile +0 -8
- data/gemfiles/handlebars_3.0.gemfile +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c772cfc54bb1b63111ebbd3c05b44f76f694f6f
|
4
|
+
data.tar.gz: d1171d06f0641e78d99236356302a33c80979ac8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b46cd38b50538ca03f431bec68d26c96b2925b3d5d0415afe3c4c5f20eb2999b536efa4c5befbbcfa1a95447b6fe21e8f8f85b6e3340648f53c3fce7e47f8c2d
|
7
|
+
data.tar.gz: af35e7dada34c54f5ed7b0ef7ca60a36f19184366e2e06365568e7bbc682ccf4bbe21cf0684e45051c1af29051131628e4f3f5fe8e02b7dbbc067aea2db6a40b
|
data/.travis.yml
CHANGED
@@ -1,10 +1,19 @@
|
|
1
|
+
language: ruby
|
2
|
+
sudo: false
|
3
|
+
cache: bundler
|
1
4
|
rvm:
|
2
5
|
- "2.0.0"
|
3
6
|
- "2.1"
|
4
7
|
- "2.2"
|
5
8
|
- jruby-19mode
|
6
9
|
- rbx-19mode
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
10
|
+
env:
|
11
|
+
matrix:
|
12
|
+
- EMBER_SOURCE_VERSION="~> 1.0.0" # Uses handlebars-source 1.0.12
|
13
|
+
- EMBER_SOURCE_VERSION="~> 1.8.0" # Uses handlebars-source 1.3.0
|
14
|
+
- EMBER_SOURCE_VERSION="~> 1.9.0" # Uses handlebars-source 2.0.0
|
15
|
+
- EMBER_SOURCE_VERSION="~> 1.10.0" # Uses HTMLBars
|
16
|
+
- EMBER_SOURCE_VERSION="~> 1.13.0" # The latest Ember.js 1.x
|
17
|
+
- EMBER_SOURCE_VERSION="~> 2.2.0" # The latest Ember.js 2.x
|
18
|
+
- EMBER_SOURCE_VERSION="~> 2.0"
|
19
|
+
HANDLEBARS_SOURCE_VERSION="~> 3.0.0" # Uses handlebars-source 3.0.x
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/barber.gemspec
CHANGED
@@ -22,6 +22,5 @@ Gem::Specification.new do |gem|
|
|
22
22
|
gem.add_development_dependency "handlebars-source", "< 3.1"
|
23
23
|
gem.add_development_dependency "simplecov"
|
24
24
|
gem.add_development_dependency "mocha", "~> 1.0"
|
25
|
-
gem.add_development_dependency "appraisal"
|
26
25
|
gem.add_development_dependency "minitest", "~> 4.0"
|
27
26
|
end
|
@@ -2,19 +2,19 @@ module Barber
|
|
2
2
|
module Ember
|
3
3
|
class InlinePrecompiler
|
4
4
|
class << self
|
5
|
-
def call(template)
|
6
|
-
"Ember.Handlebars.template(#{compile(template)})"
|
5
|
+
def call(template, options = nil)
|
6
|
+
"Ember.Handlebars.template(#{compile(template, options)})"
|
7
7
|
end
|
8
8
|
|
9
|
-
def compile(template)
|
10
|
-
Barber::Ember::Precompiler.compile template
|
9
|
+
def compile(template, options = nil)
|
10
|
+
Barber::Ember::Precompiler.compile template, options
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
class FilePrecompiler < InlinePrecompiler
|
16
16
|
class << self
|
17
|
-
def call(template)
|
17
|
+
def call(template, options = nil)
|
18
18
|
"#{super};"
|
19
19
|
end
|
20
20
|
end
|
@@ -8,9 +8,9 @@ function require() {
|
|
8
8
|
|
9
9
|
// Precompiler
|
10
10
|
var Barber = {
|
11
|
-
precompile: function(string) {
|
11
|
+
precompile: function(string, options) {
|
12
12
|
var Compiler = exports.precompile ? exports : require(/* ember-template-compiler */);
|
13
13
|
|
14
|
-
return Compiler.precompile(string,
|
14
|
+
return Compiler.precompile(string, options).toString();
|
15
15
|
}
|
16
16
|
};
|
data/lib/barber/precompiler.rb
CHANGED
@@ -4,8 +4,8 @@ require 'json'
|
|
4
4
|
module Barber
|
5
5
|
class Precompiler
|
6
6
|
class << self
|
7
|
-
def compile(template)
|
8
|
-
instance.compile(template)
|
7
|
+
def compile(template, options = nil)
|
8
|
+
instance.compile(template, options)
|
9
9
|
end
|
10
10
|
|
11
11
|
def compiler_version
|
@@ -27,8 +27,8 @@ module Barber
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
def compile(template)
|
31
|
-
context.call precompile_function, sanitize(template)
|
30
|
+
def compile(template, options = nil)
|
31
|
+
context.call precompile_function, sanitize(template), options
|
32
32
|
rescue ExecJS::ProgramError => ex
|
33
33
|
raise Barber::PrecompilerError.new(template, ex)
|
34
34
|
end
|
data/lib/barber/precompilers.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
module Barber
|
2
2
|
class InlinePrecompiler
|
3
3
|
class << self
|
4
|
-
def call(template)
|
5
|
-
"Handlebars.template(#{compile(template)})"
|
4
|
+
def call(template, options = nil)
|
5
|
+
"Handlebars.template(#{compile(template, options)})"
|
6
6
|
end
|
7
7
|
|
8
|
-
def compile(template)
|
9
|
-
Barber::Precompiler.compile template
|
8
|
+
def compile(template, options = nil)
|
9
|
+
Barber::Precompiler.compile template, options
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
14
|
class FilePrecompiler < InlinePrecompiler
|
15
15
|
class << self
|
16
|
-
def call(template)
|
16
|
+
def call(template, options = nil)
|
17
17
|
"#{super};"
|
18
18
|
end
|
19
19
|
end
|
data/lib/barber/version.rb
CHANGED
@@ -3,18 +3,33 @@ require 'test_helper'
|
|
3
3
|
class EmberPrecompilersTest < MiniTest::Unit::TestCase
|
4
4
|
def template ; "{{hello}}" ; end
|
5
5
|
def compiled_template ; "function()" ; end
|
6
|
+
def compile_option ; {moduleName: "hello"} ; end
|
6
7
|
|
7
8
|
def test_precompiles_inline_templates
|
8
|
-
Barber::Ember::Precompiler.expects(:compile).with(template).returns(compiled_template)
|
9
|
+
Barber::Ember::Precompiler.expects(:compile).with(template, nil).returns(compiled_template)
|
9
10
|
|
10
11
|
result = Barber::Ember::InlinePrecompiler.call(template)
|
11
12
|
assert_equal "Ember.Handlebars.template(#{compiled_template})", result
|
12
13
|
end
|
13
14
|
|
15
|
+
def test_precompiles_inline_templates_with_compile_option
|
16
|
+
Barber::Ember::Precompiler.expects(:compile).with(template, compile_option).returns(compiled_template)
|
17
|
+
|
18
|
+
result = Barber::Ember::InlinePrecompiler.call(template, compile_option)
|
19
|
+
assert_equal "Ember.Handlebars.template(#{compiled_template})", result
|
20
|
+
end
|
21
|
+
|
14
22
|
def test_precompiles_template_files
|
15
|
-
Barber::Ember::Precompiler.expects(:compile).with(template).returns(compiled_template)
|
23
|
+
Barber::Ember::Precompiler.expects(:compile).with(template, nil).returns(compiled_template)
|
16
24
|
|
17
25
|
result = Barber::Ember::FilePrecompiler.call(template)
|
18
26
|
assert_equal "Ember.Handlebars.template(#{compiled_template});", result
|
19
27
|
end
|
28
|
+
|
29
|
+
def test_precompiles_template_files_with_option
|
30
|
+
Barber::Ember::Precompiler.expects(:compile).with(template, compile_option).returns(compiled_template)
|
31
|
+
|
32
|
+
result = Barber::Ember::FilePrecompiler.call(template, compile_option)
|
33
|
+
assert_equal "Ember.Handlebars.template(#{compiled_template});", result
|
34
|
+
end
|
20
35
|
end
|
data/test/precompilers_test.rb
CHANGED
@@ -3,18 +3,33 @@ require 'test_helper'
|
|
3
3
|
class PrecompilersTest < MiniTest::Unit::TestCase
|
4
4
|
def template ; "{{hello}}" ; end
|
5
5
|
def compiled_template ; "function()" ; end
|
6
|
+
def compile_option ; {moduleName: "hello"} ; end
|
6
7
|
|
7
8
|
def test_precompiles_inline_templates
|
8
|
-
Barber::Precompiler.expects(:compile).with(template).returns(compiled_template)
|
9
|
+
Barber::Precompiler.expects(:compile).with(template, nil).returns(compiled_template)
|
9
10
|
|
10
11
|
result = Barber::InlinePrecompiler.call(template)
|
11
12
|
assert_equal "Handlebars.template(#{compiled_template})", result
|
12
13
|
end
|
13
14
|
|
15
|
+
def test_precompiles_inline_templates_with_compile_option
|
16
|
+
Barber::Precompiler.expects(:compile).with(template, compile_option).returns(compiled_template)
|
17
|
+
|
18
|
+
result = Barber::InlinePrecompiler.call(template, compile_option)
|
19
|
+
assert_equal "Handlebars.template(#{compiled_template})", result
|
20
|
+
end
|
21
|
+
|
14
22
|
def test_precompiles_template_files
|
15
|
-
Barber::Precompiler.expects(:compile).with(template).returns(compiled_template)
|
23
|
+
Barber::Precompiler.expects(:compile).with(template, nil).returns(compiled_template)
|
16
24
|
|
17
25
|
result = Barber::FilePrecompiler.call(template)
|
18
26
|
assert_equal "Handlebars.template(#{compiled_template});", result
|
19
27
|
end
|
28
|
+
|
29
|
+
def test_precompiles_template_files_with_option
|
30
|
+
Barber::Precompiler.expects(:compile).with(template, compile_option).returns(compiled_template)
|
31
|
+
|
32
|
+
result = Barber::FilePrecompiler.call(template, compile_option)
|
33
|
+
assert_equal "Handlebars.template(#{compiled_template});", result
|
34
|
+
end
|
20
35
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: barber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tchak
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-12-
|
12
|
+
date: 2015-12-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: execjs
|
@@ -107,20 +107,6 @@ dependencies:
|
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '1.0'
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
|
-
name: appraisal
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
113
|
-
requirements:
|
114
|
-
- - ">="
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
version: '0'
|
117
|
-
type: :development
|
118
|
-
prerelease: false
|
119
|
-
version_requirements: !ruby/object:Gem::Requirement
|
120
|
-
requirements:
|
121
|
-
- - ">="
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: '0'
|
124
110
|
- !ruby/object:Gem::Dependency
|
125
111
|
name: minitest
|
126
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -145,19 +131,11 @@ extra_rdoc_files: []
|
|
145
131
|
files:
|
146
132
|
- ".gitignore"
|
147
133
|
- ".travis.yml"
|
148
|
-
- Appraisals
|
149
134
|
- Gemfile
|
150
135
|
- LICENSE
|
151
136
|
- README.md
|
152
137
|
- Rakefile
|
153
138
|
- barber.gemspec
|
154
|
-
- gemfiles/ember_1.0.gemfile
|
155
|
-
- gemfiles/ember_1.10.gemfile
|
156
|
-
- gemfiles/ember_1.13.gemfile
|
157
|
-
- gemfiles/ember_1.8.gemfile
|
158
|
-
- gemfiles/ember_1.9.gemfile
|
159
|
-
- gemfiles/ember_2.2.gemfile
|
160
|
-
- gemfiles/handlebars_3.0.gemfile
|
161
139
|
- lib/barber.rb
|
162
140
|
- lib/barber/ember/precompiler.rb
|
163
141
|
- lib/barber/ember/precompilers.rb
|
@@ -191,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
191
169
|
version: '0'
|
192
170
|
requirements: []
|
193
171
|
rubyforge_project:
|
194
|
-
rubygems_version: 2.
|
172
|
+
rubygems_version: 2.5.0
|
195
173
|
signing_key:
|
196
174
|
specification_version: 4
|
197
175
|
summary: Handlebars precompilation toolkit
|
data/Appraisals
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
appraise "ember-1.0" do
|
2
|
-
# Uses handlebars 1.0.12
|
3
|
-
gem "ember-source", "~> 1.0.0"
|
4
|
-
end
|
5
|
-
|
6
|
-
appraise "ember-1.8" do
|
7
|
-
# Uses handlebars 1.3.0
|
8
|
-
gem "ember-source", "~> 1.8.0"
|
9
|
-
end
|
10
|
-
|
11
|
-
appraise "ember-1.9" do
|
12
|
-
# Uses handlebars 2.0.0
|
13
|
-
gem "ember-source", "~> 1.9.0"
|
14
|
-
end
|
15
|
-
|
16
|
-
appraise "ember-1.10" do
|
17
|
-
# Uses HTMLBars
|
18
|
-
gem "ember-source", "~> 1.10.0"
|
19
|
-
end
|
20
|
-
|
21
|
-
appraise "ember-1.13" do
|
22
|
-
# Uses the latest of 1.x
|
23
|
-
gem "ember-source", "~> 1.13.0"
|
24
|
-
end
|
25
|
-
|
26
|
-
appraise "ember-2.2" do
|
27
|
-
# Uses the latest of 2.x
|
28
|
-
gem "ember-source", "~> 2.2.0"
|
29
|
-
end
|
30
|
-
|
31
|
-
appraise "handlebars-3.0" do
|
32
|
-
# Uses handlebars 3.0.x
|
33
|
-
gem "handlebars-source", "~> 3.0.0"
|
34
|
-
end
|
data/gemfiles/ember_1.0.gemfile
DELETED
data/gemfiles/ember_1.10.gemfile
DELETED
data/gemfiles/ember_1.13.gemfile
DELETED
data/gemfiles/ember_1.8.gemfile
DELETED
data/gemfiles/ember_1.9.gemfile
DELETED
data/gemfiles/ember_2.2.gemfile
DELETED