handlebars 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 +4 -4
- data/.travis.yml +6 -0
- data/README.mdown +8 -8
- data/handlebars.gemspec +1 -2
- data/lib/handlebars/context.rb +4 -10
- data/lib/handlebars/version.rb +1 -1
- data/spec/handlebars_spec.rb +7 -0
- metadata +7 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e02cf1f5fb51ccaa464dc52fa3430bbcf0eebff0
|
4
|
+
data.tar.gz: ff84310db2c0686cf8005eb1bf2ae14ab8d7cc7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8eaa9163c0700702d1ef3cd14600b45301ea198671d85d4f84dde3f71d4ac0b74c33cfd370d975b55e890580215dccb3dbdc2ec6011366e7915351d8457b138f
|
7
|
+
data.tar.gz: 66295c89522a5d2047a1317901b7cb72a2bd2ea6db72238530e5d10234f9b0dcae51bbf6d07bce3af91e7ae8c42e7944803f54a34e1f9e3641e080f1a777b516
|
data/.travis.yml
ADDED
data/README.mdown
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
-
|
2
1
|
## Handlebars.rb
|
3
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/handlebars.png)](http://badge.fury.io/rb/handlebars)
|
4
|
+
[![Build Status](https://travis-ci.org/cowboyd/handlebars.rb.png?branch=master)](https://travis-ci.org/cowboyd/handlebars.rb)
|
5
|
+
[![Dependency Status](https://gemnasium.com/cowboyd/handlebars.rb.png)](https://gemnasium.com/cowboyd/handlebars.rb)
|
6
|
+
|
7
|
+
|
4
8
|
This uses [therubyracer][1] to bind to the _actual_ JavaScript implementation of
|
5
9
|
[Handlebars.js][2] so that you can use it from ruby.
|
6
10
|
|
@@ -54,7 +58,7 @@ Partials can also be dynamically looked up by defining a partial_missing behavio
|
|
54
58
|
"unable to find >#{name}"
|
55
59
|
end
|
56
60
|
handlebars.compile("{{>missing}}").call #=> unable to find >missing
|
57
|
-
|
61
|
+
|
58
62
|
Missing partials can also be returned as a function:
|
59
63
|
|
60
64
|
count = 0
|
@@ -68,14 +72,10 @@ Missing partials can also be returned as a function:
|
|
68
72
|
t.call #=> 1 miss(es) when trying to look up a partial
|
69
73
|
t.call #=> 2 miss(es) when tyring to look up a partial
|
70
74
|
|
71
|
-
##
|
75
|
+
## Test
|
72
76
|
|
73
|
-
|
74
|
-
cd handlebars.rb #go to it
|
75
|
-
git submodule update --init #pull down handlebars.js
|
76
|
-
rspec spec/ #test it
|
77
|
+
rspec spec/
|
77
78
|
|
78
79
|
|
79
80
|
[1]: http://github.com/cowboyd/therubyracer "The Ruby Racer"
|
80
81
|
[2]: http://github.com/wycats/handlebars.js "Handlebars JavaScript templating library"
|
81
|
-
|
data/handlebars.gemspec
CHANGED
@@ -20,8 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
|
22
22
|
s.add_dependency "therubyracer", "~> 0.12.0"
|
23
|
-
s.add_dependency "
|
24
|
-
s.add_dependency "handlebars-source", "~> 1.0.12"
|
23
|
+
s.add_dependency "handlebars-source", "~> 1.3.0"
|
25
24
|
s.add_development_dependency "rake"
|
26
25
|
s.add_development_dependency "rspec", "~> 2.0"
|
27
26
|
end
|
data/lib/handlebars/context.rb
CHANGED
@@ -1,13 +1,11 @@
|
|
1
1
|
require 'handlebars/source'
|
2
|
-
require 'commonjs'
|
3
2
|
require 'v8'
|
4
3
|
|
5
4
|
module Handlebars
|
6
5
|
class Context
|
7
6
|
def initialize
|
8
|
-
@js =
|
9
|
-
|
10
|
-
]
|
7
|
+
@js = V8::Context.new
|
8
|
+
@js.load(Handlebars::Source.bundled_path)
|
11
9
|
|
12
10
|
@partials = handlebars.partials = Handlebars::Partials.new
|
13
11
|
end
|
@@ -33,11 +31,7 @@ module Handlebars
|
|
33
31
|
end
|
34
32
|
|
35
33
|
def handlebars
|
36
|
-
@js.
|
37
|
-
end
|
38
|
-
|
39
|
-
def runtime
|
40
|
-
@js.runtime
|
34
|
+
@js.eval('Handlebars')
|
41
35
|
end
|
42
36
|
|
43
37
|
def []=(key, value)
|
@@ -55,7 +49,7 @@ module Handlebars
|
|
55
49
|
private
|
56
50
|
|
57
51
|
def data
|
58
|
-
handlebars[:_rubydata] ||=
|
52
|
+
handlebars[:_rubydata] ||= handlebars.create()
|
59
53
|
end
|
60
54
|
end
|
61
55
|
end
|
data/lib/handlebars/version.rb
CHANGED
data/spec/handlebars_spec.rb
CHANGED
@@ -17,6 +17,13 @@ describe(Handlebars::Context) do
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
describe "allows Handlebars whitespace operator" do
|
21
|
+
let(:t) {compile("whitespace {{~word~}} be replaced.")}
|
22
|
+
it "consumes all whitespace characters before/after the tag with the whitespace operator" do
|
23
|
+
t.call(:word => "should").should eql "whitespaceshouldbe replaced."
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
20
27
|
describe "registering Helpers" do
|
21
28
|
before do
|
22
29
|
subject.register_helper('alsowith') do |this, context, block|
|
metadata
CHANGED
@@ -1,35 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: handlebars
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charles Lowell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
-
|
12
|
-
-----BEGIN CERTIFICATE-----
|
13
|
-
MIIDPjCCAiagAwIBAgIBADANBgkqhkiG9w0BAQUFADBFMRAwDgYDVQQDDAdjb3di
|
14
|
-
b3lkMRwwGgYKCZImiZPyLGQBGRYMdGhlZnJvbnRzaWRlMRMwEQYKCZImiZPyLGQB
|
15
|
-
GRYDbmV0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|
30
|
-
IhdyRVup4qLcqYSTPsm6u7VA
|
31
|
-
-----END CERTIFICATE-----
|
32
|
-
date: 2013-09-30 00:00:00.000000000 Z
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-24 00:00:00.000000000 Z
|
33
12
|
dependencies:
|
34
13
|
- !ruby/object:Gem::Dependency
|
35
14
|
name: therubyracer
|
@@ -45,34 +24,20 @@ dependencies:
|
|
45
24
|
- - ~>
|
46
25
|
- !ruby/object:Gem::Version
|
47
26
|
version: 0.12.0
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: commonjs
|
50
|
-
requirement: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ~>
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 0.2.3
|
55
|
-
type: :runtime
|
56
|
-
prerelease: false
|
57
|
-
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.2.3
|
62
27
|
- !ruby/object:Gem::Dependency
|
63
28
|
name: handlebars-source
|
64
29
|
requirement: !ruby/object:Gem::Requirement
|
65
30
|
requirements:
|
66
31
|
- - ~>
|
67
32
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.0
|
33
|
+
version: 1.3.0
|
69
34
|
type: :runtime
|
70
35
|
prerelease: false
|
71
36
|
version_requirements: !ruby/object:Gem::Requirement
|
72
37
|
requirements:
|
73
38
|
- - ~>
|
74
39
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.0
|
40
|
+
version: 1.3.0
|
76
41
|
- !ruby/object:Gem::Dependency
|
77
42
|
name: rake
|
78
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,6 +77,7 @@ extra_rdoc_files: []
|
|
112
77
|
files:
|
113
78
|
- .gitignore
|
114
79
|
- .rspec
|
80
|
+
- .travis.yml
|
115
81
|
- Changelog.md
|
116
82
|
- Gemfile
|
117
83
|
- README.mdown
|
@@ -144,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
110
|
version: '0'
|
145
111
|
requirements: []
|
146
112
|
rubyforge_project: handlebars
|
147
|
-
rubygems_version: 2.0.
|
113
|
+
rubygems_version: 2.0.3
|
148
114
|
signing_key:
|
149
115
|
specification_version: 4
|
150
116
|
summary: Ruby bindings for the handlebars.js templating library
|