stache 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -2
- data/lib/stache/asset_helper.rb +1 -1
- data/lib/stache/version.rb +1 -1
- data/spec/stache/asset_helper_spec.rb +6 -6
- metadata +9 -12
data/README.md
CHANGED
@@ -13,7 +13,7 @@ Stache.configure do |c|
|
|
13
13
|
c.template_base_path = "..." # this is probably the one you'll want to change
|
14
14
|
# it defaults to app/templates
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
# or if the block style ain't yer thang, just:
|
18
18
|
Stache.template_base_path = File.join(Rails.root, "app", "şablon")
|
19
19
|
```
|
@@ -79,9 +79,10 @@ So: thanks a ton to those guys.
|
|
79
79
|
## Contributors
|
80
80
|
|
81
81
|
* [afeld](https://github.com/afeld) provided 1.8.7 compatibility fixes.
|
82
|
+
* [subwindow](https://github.com/subwindow) provided some much needed love for Stache::View exception handling.
|
82
83
|
|
83
84
|
## Note on Patches/Pull Requests
|
84
|
-
|
85
|
+
|
85
86
|
* Fork the project.
|
86
87
|
* Make your feature addition or bug fix.
|
87
88
|
* Add tests for it. This is important so I don't break it in a
|
data/lib/stache/asset_helper.rb
CHANGED
@@ -11,7 +11,7 @@ module Stache
|
|
11
11
|
base_path = Stache.template_base_path.join(*exploded)
|
12
12
|
template_path = locate_template_for(base_path, file)
|
13
13
|
if template_path
|
14
|
-
template = ::File.open(template_path, "rb")
|
14
|
+
template = ::File.open(template_path, "rb" , :encoding => Rails.configuration.encoding)
|
15
15
|
content_tag(:script, template.read.html_safe, :type => "text/html", :id => "#{file.dasherize.underscore}_template")
|
16
16
|
else
|
17
17
|
raise ActionView::MissingTemplate.new(potential_paths(base_path, file), file, [base_path], false, { :handlers => [:mustache] })
|
data/lib/stache/version.rb
CHANGED
@@ -9,11 +9,11 @@ describe Stache::AssetHelper do
|
|
9
9
|
def helper
|
10
10
|
@helper ||= MyViewContext.new
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
describe "#template_include_tag" do
|
14
14
|
it "renders a script tag with the template contents" do
|
15
15
|
File.stub!(:file?).with(Rails.root.join("app/views/widgets/_oh_herro.html.mustache").to_s).and_return(true)
|
16
|
-
File.stub!(:open).with(Rails.root.join("app/views/widgets/_oh_herro.html.mustache"), "rb").
|
16
|
+
File.stub!(:open).with(Rails.root.join("app/views/widgets/_oh_herro.html.mustache"), "rb", {:encoding=>"utf-8"}).
|
17
17
|
and_return(StringIO.new("{{ awyeah }}"))
|
18
18
|
|
19
19
|
helper.template_include_tag("widgets/oh_herro").should == "<script id=\"oh_herro_template\" type=\"text/html\">{{ awyeah }}</script>"
|
@@ -23,23 +23,23 @@ describe Stache::AssetHelper do
|
|
23
23
|
c.template_base_path = "/tmp/whee"
|
24
24
|
end
|
25
25
|
File.stub!(:file?).with("/tmp/whee/_whooo.html.mustache").and_return(true)
|
26
|
-
File.stub!(:open).with(Pathname.new("/tmp/whee/_whooo.html.mustache"), "rb").
|
26
|
+
File.stub!(:open).with(Pathname.new("/tmp/whee/_whooo.html.mustache"), "rb", {:encoding=>"utf-8"}).
|
27
27
|
and_return(StringIO.new("{{ awyeah }}"))
|
28
|
-
|
28
|
+
|
29
29
|
helper.template_include_tag("whooo").should == "<script id=\"whooo_template\" type=\"text/html\">{{ awyeah }}</script>"
|
30
30
|
end
|
31
31
|
it "raises if it cannot find the template" do
|
32
32
|
-> { helper.template_include_tag("arrrgh") }.should raise_error(ActionView::MissingTemplate)
|
33
33
|
end
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
describe "#locate_template_for" do
|
37
37
|
it "tries permutations of partial names and file extensions to find the requested file" do
|
38
38
|
File.should_receive(:file?).with("/tmp/whee/_whooo.html.mustache")
|
39
39
|
File.should_receive(:file?).with("/tmp/whee/_whooo.mustache")
|
40
40
|
File.should_receive(:file?).with("/tmp/whee/whooo.html.mustache")
|
41
41
|
File.should_receive(:file?).with("/tmp/whee/whooo.mustache").and_return(true)
|
42
|
-
|
42
|
+
|
43
43
|
helper.locate_template_for(Pathname.new("/tmp/whee"), "whooo").should == Pathname.new("/tmp/whee/whooo.mustache")
|
44
44
|
end
|
45
45
|
it "returns nil if it cannot find anything" do
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: stache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Matt Wilson
|
@@ -14,6 +14,7 @@ date: 2011-08-12 00:00:00 Z
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: mustache
|
17
|
+
prerelease: false
|
17
18
|
requirement: &id001 !ruby/object:Gem::Requirement
|
18
19
|
none: false
|
19
20
|
requirements:
|
@@ -21,10 +22,10 @@ dependencies:
|
|
21
22
|
- !ruby/object:Gem::Version
|
22
23
|
version: "0"
|
23
24
|
type: :runtime
|
24
|
-
prerelease: false
|
25
25
|
version_requirements: *id001
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: rails
|
28
|
+
prerelease: false
|
28
29
|
requirement: &id002 !ruby/object:Gem::Requirement
|
29
30
|
none: false
|
30
31
|
requirements:
|
@@ -32,10 +33,10 @@ dependencies:
|
|
32
33
|
- !ruby/object:Gem::Version
|
33
34
|
version: 3.1.0
|
34
35
|
type: :development
|
35
|
-
prerelease: false
|
36
36
|
version_requirements: *id002
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: rspec
|
39
|
+
prerelease: false
|
39
40
|
requirement: &id003 !ruby/object:Gem::Requirement
|
40
41
|
none: false
|
41
42
|
requirements:
|
@@ -43,10 +44,10 @@ dependencies:
|
|
43
44
|
- !ruby/object:Gem::Version
|
44
45
|
version: "0"
|
45
46
|
type: :development
|
46
|
-
prerelease: false
|
47
47
|
version_requirements: *id003
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: rspec-rails
|
50
|
+
prerelease: false
|
50
51
|
requirement: &id004 !ruby/object:Gem::Requirement
|
51
52
|
none: false
|
52
53
|
requirements:
|
@@ -54,10 +55,10 @@ dependencies:
|
|
54
55
|
- !ruby/object:Gem::Version
|
55
56
|
version: "0"
|
56
57
|
type: :development
|
57
|
-
prerelease: false
|
58
58
|
version_requirements: *id004
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: bundler
|
61
|
+
prerelease: false
|
61
62
|
requirement: &id005 !ruby/object:Gem::Requirement
|
62
63
|
none: false
|
63
64
|
requirements:
|
@@ -65,10 +66,10 @@ dependencies:
|
|
65
66
|
- !ruby/object:Gem::Version
|
66
67
|
version: "0"
|
67
68
|
type: :development
|
68
|
-
prerelease: false
|
69
69
|
version_requirements: *id005
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: bueller
|
72
|
+
prerelease: false
|
72
73
|
requirement: &id006 !ruby/object:Gem::Requirement
|
73
74
|
none: false
|
74
75
|
requirements:
|
@@ -76,10 +77,10 @@ dependencies:
|
|
76
77
|
- !ruby/object:Gem::Version
|
77
78
|
version: "0"
|
78
79
|
type: :development
|
79
|
-
prerelease: false
|
80
80
|
version_requirements: *id006
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: rake
|
83
|
+
prerelease: false
|
83
84
|
requirement: &id007 !ruby/object:Gem::Requirement
|
84
85
|
none: false
|
85
86
|
requirements:
|
@@ -87,10 +88,10 @@ dependencies:
|
|
87
88
|
- !ruby/object:Gem::Version
|
88
89
|
version: "0"
|
89
90
|
type: :development
|
90
|
-
prerelease: false
|
91
91
|
version_requirements: *id007
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: rcov
|
94
|
+
prerelease: false
|
94
95
|
requirement: &id008 !ruby/object:Gem::Requirement
|
95
96
|
none: false
|
96
97
|
requirements:
|
@@ -98,7 +99,6 @@ dependencies:
|
|
98
99
|
- !ruby/object:Gem::Version
|
99
100
|
version: "0"
|
100
101
|
type: :development
|
101
|
-
prerelease: false
|
102
102
|
version_requirements: *id008
|
103
103
|
description: A rails 3.x compatible template handler, configurable.
|
104
104
|
email: mhw@hypomodern.com
|
@@ -186,9 +186,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
186
186
|
requirements:
|
187
187
|
- - ">="
|
188
188
|
- !ruby/object:Gem::Version
|
189
|
-
hash: 542671315864466060
|
190
|
-
segments:
|
191
|
-
- 0
|
192
189
|
version: "0"
|
193
190
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
194
191
|
none: false
|