handlebars_assets 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/MIT-LICENSE +20 -0
- data/lib/handlebars_assets/tilt_handlebars.rb +7 -5
- data/lib/handlebars_assets/version.rb +1 -1
- data/test/handlebars_assets/tilt_handlebars_test.rb +7 -5
- metadata +15 -14
data/Gemfile.lock
CHANGED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Les Hill
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -20,11 +20,13 @@ module HandlebarsAssets
|
|
20
20
|
else
|
21
21
|
template_name = scope.logical_path.inspect
|
22
22
|
<<-TEMPLATE
|
23
|
-
function(
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
(function() {
|
24
|
+
this.HandlebarsTemplates || (this.HandlebarsTemplates = {});
|
25
|
+
this.HandlebarsTemplates[#{template_name}] = Handlebars.template(#{compiled_hbs});
|
26
|
+
return function(context) {
|
27
|
+
return HandlebarsTemplates[#{template_name}](context);
|
28
|
+
};
|
29
|
+
}).call(this);
|
28
30
|
TEMPLATE
|
29
31
|
end
|
30
32
|
end
|
@@ -10,11 +10,9 @@ module HandlebarsAssets
|
|
10
10
|
end
|
11
11
|
template = HandlebarsAssets::TiltHandlebars.new('/myapp/app/assets/templates/x11.jst.hbs') { "This is {{handlebars}}" }
|
12
12
|
assert_equal <<END_EXPECTED, template.render(scope, {})
|
13
|
-
function(
|
14
|
-
|
15
|
-
|
16
|
-
this.HandlebarsTemplates || (this.HandlebarsTemplates = {});
|
17
|
-
this.HandlebarsTemplates["x11"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
13
|
+
(function() {
|
14
|
+
this.HandlebarsTemplates || (this.HandlebarsTemplates = {});
|
15
|
+
this.HandlebarsTemplates["x11"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
18
16
|
helpers = helpers || Handlebars.helpers;
|
19
17
|
var buffer = "", stack1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
|
20
18
|
|
@@ -25,6 +23,10 @@ module HandlebarsAssets
|
|
25
23
|
else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "handlebars", { hash: {} }); }
|
26
24
|
buffer += escapeExpression(stack1);
|
27
25
|
return buffer;});
|
26
|
+
return function(context) {
|
27
|
+
return HandlebarsTemplates["x11"](context);
|
28
|
+
};
|
29
|
+
}).call(this);
|
28
30
|
END_EXPECTED
|
29
31
|
end
|
30
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: handlebars_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-12-
|
12
|
+
date: 2011-12-12 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: execjs
|
16
|
-
requirement: &
|
16
|
+
requirement: &70153366989600 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.2.9
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70153366989600
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: tilt
|
27
|
-
requirement: &
|
27
|
+
requirement: &70153366988980 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70153366988980
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: sprockets
|
38
|
-
requirement: &
|
38
|
+
requirement: &70153366988440 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.0.3
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70153366988440
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: activesupport
|
49
|
-
requirement: &
|
49
|
+
requirement: &70153366987940 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 3.1.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70153366987940
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: therubyracer
|
60
|
-
requirement: &
|
60
|
+
requirement: &70153366987520 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70153366987520
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
|
-
requirement: &
|
71
|
+
requirement: &70153366985780 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70153366985780
|
80
80
|
description: Compile Handlebars templates in the Rails asset pipeline.
|
81
81
|
email:
|
82
82
|
- leshill@gmail.com
|
@@ -89,6 +89,7 @@ files:
|
|
89
89
|
- Gemfile
|
90
90
|
- Gemfile.lock
|
91
91
|
- HISTORY.md
|
92
|
+
- MIT-LICENSE
|
92
93
|
- README.md
|
93
94
|
- Rakefile
|
94
95
|
- handlebars_assets.gemspec
|