barber 0.6.0 → 0.7.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: a38a106b33feac920e7c648fbad7bb24211cb156
4
- data.tar.gz: 5d54053e5d0b0fd65804cc97b63130f6583fa475
3
+ metadata.gz: 3b161286814792680bb32b76fc78204223cd7b9c
4
+ data.tar.gz: 1ff091c2f4b109b41d5b6d3a02110e74c179734f
5
5
  SHA512:
6
- metadata.gz: 793de24bc133c75fa6350078a240247884f20b8a0fad642f42988e9c4bc65a680fdf5d43a0428dc98672f3b255a63af761a40ab1714b0d0adc039910cafb53d8
7
- data.tar.gz: d7ca65767cf9fbfc63d3fef071e0b03683367fa767ccd3bf15f6d53ffa819cf7d9252635e75b9e59a30e7997ba4d2588aae69a581783970304ffa10c3d3a8e84
6
+ metadata.gz: 2e5d864ca502f27db60cdd529d987cd961ca7f1ed6a9ed2a9079756c621686332e954eea6b01b6a7a05c2fae1cc2aa278bfcaf15153cabbee82d7fa0376360b7
7
+ data.tar.gz: dd9fc53964221a9559f3ebac87ccedb557baa5e1977751bd530920efa8fb5ac22b9a29227fcc5f49f8928479369757b117b5c7015382ebd5f057309a68d696db
@@ -1,6 +1,8 @@
1
1
  rvm:
2
2
  - "1.9.3"
3
3
  - "2.0.0"
4
+ - "2.1"
5
+ - "2.2"
4
6
  - jruby-19mode
5
7
  - rbx-19mode
6
8
  before_script:
data/Appraisals CHANGED
@@ -15,5 +15,10 @@ end
15
15
 
16
16
  appraise "ember-1.10" do
17
17
  # Uses HTMLBars
18
- gem "ember-source", "~> 1.10.0.beta.2"
18
+ gem "ember-source", "~> 1.10.0"
19
+ end
20
+
21
+ appraise "handlebars-3.0" do
22
+ # Uses handlebars 3.0.x
23
+ gem "handlebars-source", "~> 3.0.0"
19
24
  end
@@ -16,11 +16,12 @@ Gem::Specification.new do |gem|
16
16
  gem.version = Barber::VERSION
17
17
 
18
18
  gem.add_dependency "execjs"
19
- gem.add_dependency "handlebars-source", [">= 1.0.0.rc.4"]
20
19
  gem.add_dependency "ember-source"
21
20
 
22
21
  gem.add_development_dependency "rake"
22
+ gem.add_development_dependency "handlebars-source", [">= 1.0.0.rc.4", "< 3.1"]
23
23
  gem.add_development_dependency "simplecov"
24
24
  gem.add_development_dependency "mocha", "~> 1.0"
25
25
  gem.add_development_dependency "appraisal"
26
+ gem.add_development_dependency "minitest", "~> 4.0"
26
27
  end
@@ -3,6 +3,6 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "therubyrhino", :platform => :jruby
6
- gem "ember-source", "~> 1.10.0.beta.2"
6
+ gem "ember-source", "~> 1.10.0"
7
7
 
8
8
  gemspec :path => "../"
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- barber (0.5.0)
4
+ barber (0.6.0)
5
5
  ember-source
6
6
  execjs
7
- handlebars-source (>= 1.0.0.rc.4)
7
+ handlebars-source (>= 1.0.0.rc.4, < 3.1)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
@@ -14,20 +14,20 @@ GEM
14
14
  rake
15
15
  thor (>= 0.14.0)
16
16
  docile (1.1.5)
17
- ember-source (1.10.0.beta.2)
18
- handlebars-source (~> 2.0)
19
- execjs (2.2.2)
20
- handlebars-source (2.0.0)
17
+ ember-source (1.10.0)
18
+ execjs (2.3.0)
19
+ handlebars-source (3.0.0)
21
20
  metaclass (0.0.4)
21
+ minitest (4.7.5)
22
22
  mocha (1.1.0)
23
23
  metaclass (~> 0.0.1)
24
24
  multi_json (1.10.1)
25
25
  rake (10.4.2)
26
- simplecov (0.9.1)
26
+ simplecov (0.9.2)
27
27
  docile (~> 1.1.0)
28
28
  multi_json (~> 1.0)
29
- simplecov-html (~> 0.8.0)
30
- simplecov-html (0.8.0)
29
+ simplecov-html (~> 0.9.0)
30
+ simplecov-html (0.9.0)
31
31
  thor (0.19.1)
32
32
 
33
33
  PLATFORMS
@@ -36,7 +36,8 @@ PLATFORMS
36
36
  DEPENDENCIES
37
37
  appraisal
38
38
  barber!
39
- ember-source (~> 1.10.0.beta.2)
39
+ ember-source (~> 1.10.0)
40
+ minitest (~> 4.0)
40
41
  mocha (~> 1.0)
41
42
  rake
42
43
  simplecov
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- barber (0.5.0)
4
+ barber (0.6.0)
5
5
  ember-source
6
6
  execjs
7
- handlebars-source (>= 1.0.0.rc.4)
7
+ handlebars-source (>= 1.0.0.rc.4, < 3.1)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
@@ -16,18 +16,19 @@ GEM
16
16
  docile (1.1.5)
17
17
  ember-source (1.8.0)
18
18
  handlebars-source (~> 1.0)
19
- execjs (2.2.2)
19
+ execjs (2.3.0)
20
20
  handlebars-source (1.3.0)
21
21
  metaclass (0.0.4)
22
+ minitest (4.7.5)
22
23
  mocha (1.1.0)
23
24
  metaclass (~> 0.0.1)
24
25
  multi_json (1.10.1)
25
26
  rake (10.4.2)
26
- simplecov (0.9.1)
27
+ simplecov (0.9.2)
27
28
  docile (~> 1.1.0)
28
29
  multi_json (~> 1.0)
29
- simplecov-html (~> 0.8.0)
30
- simplecov-html (0.8.0)
30
+ simplecov-html (~> 0.9.0)
31
+ simplecov-html (0.9.0)
31
32
  thor (0.19.1)
32
33
 
33
34
  PLATFORMS
@@ -37,6 +38,7 @@ DEPENDENCIES
37
38
  appraisal
38
39
  barber!
39
40
  ember-source (= 1.8.0)
41
+ minitest (~> 4.0)
40
42
  mocha (~> 1.0)
41
43
  rake
42
44
  simplecov
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- barber (0.5.0)
4
+ barber (0.6.0)
5
5
  ember-source
6
6
  execjs
7
- handlebars-source (>= 1.0.0.rc.4)
7
+ handlebars-source (>= 1.0.0.rc.4, < 3.1)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
@@ -16,18 +16,19 @@ GEM
16
16
  docile (1.1.5)
17
17
  ember-source (1.9.1)
18
18
  handlebars-source (~> 2.0)
19
- execjs (2.2.2)
19
+ execjs (2.3.0)
20
20
  handlebars-source (2.0.0)
21
21
  metaclass (0.0.4)
22
+ minitest (4.7.5)
22
23
  mocha (1.1.0)
23
24
  metaclass (~> 0.0.1)
24
25
  multi_json (1.10.1)
25
26
  rake (10.4.2)
26
- simplecov (0.9.1)
27
+ simplecov (0.9.2)
27
28
  docile (~> 1.1.0)
28
29
  multi_json (~> 1.0)
29
- simplecov-html (~> 0.8.0)
30
- simplecov-html (0.8.0)
30
+ simplecov-html (~> 0.9.0)
31
+ simplecov-html (0.9.0)
31
32
  thor (0.19.1)
32
33
 
33
34
  PLATFORMS
@@ -37,6 +38,7 @@ DEPENDENCIES
37
38
  appraisal
38
39
  barber!
39
40
  ember-source (~> 1.9.0)
41
+ minitest (~> 4.0)
40
42
  mocha (~> 1.0)
41
43
  rake
42
44
  simplecov
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- barber (0.5.0)
4
+ barber (0.6.0)
5
5
  ember-source
6
6
  execjs
7
- handlebars-source (>= 1.0.0.rc.4)
7
+ handlebars-source (>= 1.0.0.rc.4, < 3.1)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
@@ -16,18 +16,19 @@ GEM
16
16
  docile (1.1.5)
17
17
  ember-source (1.0.0.rc4)
18
18
  handlebars-source (= 1.0.0.rc4)
19
- execjs (2.2.2)
19
+ execjs (2.3.0)
20
20
  handlebars-source (1.0.0.rc4)
21
21
  metaclass (0.0.4)
22
+ minitest (4.7.5)
22
23
  mocha (1.1.0)
23
24
  metaclass (~> 0.0.1)
24
25
  multi_json (1.10.1)
25
26
  rake (10.4.2)
26
- simplecov (0.9.1)
27
+ simplecov (0.9.2)
27
28
  docile (~> 1.1.0)
28
29
  multi_json (~> 1.0)
29
- simplecov-html (~> 0.8.0)
30
- simplecov-html (0.8.0)
30
+ simplecov-html (~> 0.9.0)
31
+ simplecov-html (0.9.0)
31
32
  thor (0.19.1)
32
33
 
33
34
  PLATFORMS
@@ -37,6 +38,7 @@ DEPENDENCIES
37
38
  appraisal
38
39
  barber!
39
40
  ember-source (= 1.0.0.rc4)
41
+ minitest (~> 4.0)
40
42
  mocha (~> 1.0)
41
43
  rake
42
44
  simplecov
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "therubyrhino", :platform => :jruby
6
+ gem "handlebars-source", "~> 3.0.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,44 @@
1
+ PATH
2
+ remote: ../
3
+ specs:
4
+ barber (0.6.0)
5
+ ember-source
6
+ execjs
7
+ handlebars-source (>= 1.0.0.rc.4, < 3.1)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ appraisal (1.0.2)
13
+ bundler
14
+ rake
15
+ thor (>= 0.14.0)
16
+ docile (1.1.5)
17
+ ember-source (1.10.0)
18
+ execjs (2.3.0)
19
+ handlebars-source (3.0.0)
20
+ metaclass (0.0.4)
21
+ minitest (4.7.5)
22
+ mocha (1.1.0)
23
+ metaclass (~> 0.0.1)
24
+ multi_json (1.10.1)
25
+ rake (10.4.2)
26
+ simplecov (0.9.2)
27
+ docile (~> 1.1.0)
28
+ multi_json (~> 1.0)
29
+ simplecov-html (~> 0.9.0)
30
+ simplecov-html (0.9.0)
31
+ thor (0.19.1)
32
+
33
+ PLATFORMS
34
+ ruby
35
+
36
+ DEPENDENCIES
37
+ appraisal
38
+ barber!
39
+ handlebars-source (~> 3.0.0)
40
+ minitest (~> 4.0)
41
+ mocha (~> 1.0)
42
+ rake
43
+ simplecov
44
+ therubyrhino
@@ -1,6 +1,5 @@
1
1
  require "barber/version"
2
2
 
3
- require 'handlebars/source'
4
3
  require 'ember/source'
5
4
 
6
5
  require "barber/precompiler"
@@ -11,7 +11,7 @@ module Barber
11
11
  end
12
12
 
13
13
  def sources
14
- [precompiler, handlebars, ember_template_precompiler]
14
+ super + [ember_template_precompiler]
15
15
  end
16
16
  end
17
17
  end
@@ -9,7 +9,7 @@ function require() {
9
9
  // Precompiler
10
10
  var Barber = {
11
11
  precompile: function(string) {
12
- var Compiler = exports.precompile ? exports : require(/* htmlbars */);
12
+ var Compiler = exports.precompile ? exports : require(/* ember-template-compiler */);
13
13
 
14
14
  return Compiler.precompile(string, false).toString();
15
15
  }
@@ -1,6 +1,9 @@
1
1
  // Precompiler
2
2
  var Barber = {
3
3
  precompile: function(string) {
4
+ if (typeof Handlebars === 'undefined') {
5
+ throw '`Handlebars` is missing. `gem "handlebars-source"` is required in your `Gemfile`.';
6
+ }
4
7
  return Handlebars.precompile(string).toString();
5
8
  }
6
9
  };
@@ -20,7 +20,9 @@ module Barber
20
20
  end
21
21
 
22
22
  def sources
23
- [precompiler, handlebars]
23
+ sources = [precompiler]
24
+ sources << handlebars if handlebars_available?
25
+ sources
24
26
  end
25
27
 
26
28
  def handlebars
@@ -75,7 +77,21 @@ module Barber
75
77
  end
76
78
 
77
79
  def source
78
- @source ||= sources.map(&:read).join("\n;\n")
80
+ # hbs 3 has no reference to `window`.
81
+ @source ||= <<-SOURCE
82
+ if (typeof window === 'undefined') {
83
+ window = this;
84
+ };
85
+ #{sources.map(&:read).join("\n;\n")}
86
+ SOURCE
87
+ end
88
+
89
+ def handlebars_available?
90
+ require "handlebars/source" # handlebars precompilation is optional feature.
91
+ rescue LoadError
92
+ # noop
93
+ ensure
94
+ return !!defined?(Handlebars::Source)
79
95
  end
80
96
  end
81
97
  end
@@ -1,3 +1,3 @@
1
1
  module Barber
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
@@ -86,6 +86,19 @@ class PrecompilerTest < MiniTest::Unit::TestCase
86
86
  assert_equal "Foo", custom_compiler.compile("{{hello}}")
87
87
  end
88
88
 
89
+ def test_has_an_easy_to_customize_public_interface
90
+ custom_compiler = Class.new Barber::Precompiler do
91
+ # Stub for non-handlebars environment
92
+ def handlebars_available?
93
+ false
94
+ end
95
+ end
96
+
97
+ assert_raises Barber::PrecompilerError do
98
+ custom_compiler.compile('{{hello}}')
99
+ end
100
+ end
101
+
89
102
  private
90
103
  def compile(template)
91
104
  Barber::Precompiler.compile template
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.6.0
4
+ version: 0.7.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: 2014-12-28 00:00:00.000000000 Z
12
+ date: 2015-03-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: execjs
@@ -26,27 +26,27 @@ dependencies:
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
- name: handlebars-source
29
+ name: ember-source
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: 1.0.0.rc.4
34
+ version: '0'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: 1.0.0.rc.4
41
+ version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
- name: ember-source
43
+ name: rake
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
- type: :runtime
49
+ type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
@@ -54,19 +54,25 @@ dependencies:
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
- name: rake
57
+ name: handlebars-source
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: '0'
62
+ version: 1.0.0.rc.4
63
+ - - "<"
64
+ - !ruby/object:Gem::Version
65
+ version: '3.1'
63
66
  type: :development
64
67
  prerelease: false
65
68
  version_requirements: !ruby/object:Gem::Requirement
66
69
  requirements:
67
70
  - - ">="
68
71
  - !ruby/object:Gem::Version
69
- version: '0'
72
+ version: 1.0.0.rc.4
73
+ - - "<"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.1'
70
76
  - !ruby/object:Gem::Dependency
71
77
  name: simplecov
72
78
  requirement: !ruby/object:Gem::Requirement
@@ -109,6 +115,20 @@ dependencies:
109
115
  - - ">="
110
116
  - !ruby/object:Gem::Version
111
117
  version: '0'
118
+ - !ruby/object:Gem::Dependency
119
+ name: minitest
120
+ requirement: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '4.0'
125
+ type: :development
126
+ prerelease: false
127
+ version_requirements: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '4.0'
112
132
  description: Handlebars precompilation
113
133
  email:
114
134
  - paul@chavard.net
@@ -133,6 +153,8 @@ files:
133
153
  - gemfiles/ember_1.9.gemfile.lock
134
154
  - gemfiles/ember_rc4.gemfile
135
155
  - gemfiles/ember_rc4.gemfile.lock
156
+ - gemfiles/handlebars_3.0.gemfile
157
+ - gemfiles/handlebars_3.0.gemfile.lock
136
158
  - lib/barber.rb
137
159
  - lib/barber/ember/precompiler.rb
138
160
  - lib/barber/ember/precompilers.rb
@@ -165,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
187
  version: '0'
166
188
  requirements: []
167
189
  rubyforge_project:
168
- rubygems_version: 2.2.2
190
+ rubygems_version: 2.4.5
169
191
  signing_key:
170
192
  specification_version: 4
171
193
  summary: Handlebars precompilation toolkit