stache 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +4 -0
- data/CHANGELOG.md +8 -0
- data/README.md +4 -2
- data/lib/stache.rb +1 -1
- data/lib/stache/asset_helper.rb +3 -5
- data/lib/stache/railtie.rb +2 -2
- data/lib/stache/version.rb +1 -1
- data/spec/stache/asset_helper_spec.rb +20 -4
- data/stache.gemspec +2 -2
- metadata +3 -2
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# 0.2.2
|
2
|
+
|
3
|
+
* Saner, consistent handling of template extensions: partials and full templates both use configured value at `Stache.template_extension`. Thanks @ajacksified!
|
4
|
+
|
5
|
+
# 0.2.1
|
6
|
+
|
7
|
+
* Addresses #9: fix 'incompatible character encodings' error
|
8
|
+
|
1
9
|
# 0.2.0
|
2
10
|
|
3
11
|
* Patch to properly reraise NameError/LoadError that occurs upon loading a Stache::View
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# stache
|
2
2
|
|
3
|
-
A Rails 3.x
|
3
|
+
A Rails 3.x compatible Mustache Template Handler, with support for partials and a couple extra niceties to make sharing the raw templates with client-side javascript a little easier.
|
4
4
|
|
5
5
|
## Usage
|
6
6
|
|
@@ -58,7 +58,7 @@ end
|
|
58
58
|
|
59
59
|
## Of Note
|
60
60
|
|
61
|
-
This is
|
61
|
+
This is code that was ripped out of a research project. It probably has some rough edges.
|
62
62
|
|
63
63
|
TODO:
|
64
64
|
|
@@ -80,6 +80,8 @@ So: thanks a ton to those guys.
|
|
80
80
|
|
81
81
|
* [afeld](https://github.com/afeld) provided 1.8.7 compatibility fixes.
|
82
82
|
* [subwindow](https://github.com/subwindow) provided some much needed love for Stache::View exception handling.
|
83
|
+
* [solotimes](https://github.com/solotimes) provided better support for non-standard encodings.
|
84
|
+
* [ajacksified](https://github.com/ajacksified) cleaned up template extension handling.
|
83
85
|
|
84
86
|
## Note on Patches/Pull Requests
|
85
87
|
|
data/lib/stache.rb
CHANGED
data/lib/stache/asset_helper.rb
CHANGED
@@ -21,10 +21,8 @@ module Stache
|
|
21
21
|
|
22
22
|
def potential_paths(path, candidate_file_name)
|
23
23
|
[
|
24
|
-
path.join("_#{candidate_file_name}.
|
25
|
-
path.join("
|
26
|
-
path.join("#{candidate_file_name}.html.mustache"),
|
27
|
-
path.join("#{candidate_file_name}.mustache")
|
24
|
+
path.join("_#{candidate_file_name}.#{Stache.template_extension}"),
|
25
|
+
path.join("#{candidate_file_name}.#{Stache.template_extension}")
|
28
26
|
]
|
29
27
|
end
|
30
28
|
|
@@ -32,4 +30,4 @@ module Stache
|
|
32
30
|
potential_paths(path, candidate_file_name).find { |file| File.file?(file.to_s) }
|
33
31
|
end
|
34
32
|
end
|
35
|
-
end
|
33
|
+
end
|
data/lib/stache/railtie.rb
CHANGED
data/lib/stache/version.rb
CHANGED
@@ -29,21 +29,37 @@ describe Stache::AssetHelper do
|
|
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
|
+
lambda { 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
|
-
it "tries permutations of partial names and file
|
37
|
+
it "tries permutations of partial names and default file extension to find the requested file" do
|
38
38
|
File.should_receive(:file?).with("/tmp/whee/_whooo.html.mustache")
|
39
|
+
File.should_receive(:file?).with("/tmp/whee/whooo.html.mustache").and_return(true)
|
40
|
+
|
41
|
+
helper.locate_template_for(Pathname.new("/tmp/whee"), "whooo").should == Pathname.new("/tmp/whee/whooo.html.mustache")
|
42
|
+
end
|
43
|
+
|
44
|
+
it "tries permutations of partial names and configured file extension to find the requested file" do
|
45
|
+
Stache.configure do |config|
|
46
|
+
@current_extension = config.template_extension
|
47
|
+
config.template_extension = 'mustache'
|
48
|
+
end
|
49
|
+
|
39
50
|
File.should_receive(:file?).with("/tmp/whee/_whooo.mustache")
|
40
|
-
File.should_receive(:file?).with("/tmp/whee/whooo.html.mustache")
|
41
51
|
File.should_receive(:file?).with("/tmp/whee/whooo.mustache").and_return(true)
|
42
52
|
|
43
53
|
helper.locate_template_for(Pathname.new("/tmp/whee"), "whooo").should == Pathname.new("/tmp/whee/whooo.mustache")
|
54
|
+
|
55
|
+
Stache.configure do |config|
|
56
|
+
config.template_extension = @current_extension
|
57
|
+
end
|
44
58
|
end
|
59
|
+
|
60
|
+
|
45
61
|
it "returns nil if it cannot find anything" do
|
46
62
|
helper.locate_template_for(Pathname.new("/tmp/whee"), "whooo").should be_nil
|
47
63
|
end
|
48
64
|
end
|
49
|
-
end
|
65
|
+
end
|
data/stache.gemspec
CHANGED
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
|
|
5
5
|
s.name = 'stache'
|
6
6
|
s.version = Stache::VERSION
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
|
-
s.date = '
|
8
|
+
s.date = '2012-01-06'
|
9
9
|
s.authors = ['Matt Wilson']
|
10
10
|
s.email = 'mhw@hypomodern.com'
|
11
11
|
s.homepage = 'http://github.com/agoragames/stache'
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
25
25
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
26
26
|
s.require_paths = ['lib']
|
27
|
-
|
27
|
+
|
28
28
|
s.add_dependency 'mustache'
|
29
29
|
|
30
30
|
s.add_development_dependency 'rails', '~>3.1.0'
|
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.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Matt Wilson
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
13
|
+
date: 2012-01-06 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: mustache
|
@@ -114,6 +114,7 @@ files:
|
|
114
114
|
- .gitignore
|
115
115
|
- .rspec
|
116
116
|
- .rvmrc
|
117
|
+
- .travis.yml
|
117
118
|
- CHANGELOG.md
|
118
119
|
- Gemfile
|
119
120
|
- LICENSE
|