stache 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.2
4
+ - 1.9.3
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 (yes, even Rails *3.1*) 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.
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 early code, ripped out from an upcoming project. It probably has some rough edges.
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
@@ -14,4 +14,4 @@ module Stache
14
14
  end
15
15
 
16
16
  ActionView::Template.register_template_handler(:mustache, Stache::Handler)
17
- ActionView::Base.send :include, Stache::AssetHelper
17
+ ActionView::Base.send :include, Stache::AssetHelper
@@ -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}.html.mustache"),
25
- path.join("_#{candidate_file_name}.mustache"),
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
@@ -5,7 +5,7 @@ module Stache
5
5
  end
6
6
 
7
7
  config.to_prepare do
8
- ApplicationController.send(:append_view_path, 'app/templates')
8
+ ApplicationController.send(:append_view_path, Stache.template_base_path)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module Stache
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -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
- -> { helper.template_include_tag("arrrgh") }.should raise_error(ActionView::MissingTemplate)
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 extensions to find the requested file" do
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 = '2011-08-12'
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.1
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: 2011-08-12 00:00:00 Z
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