stache 0.9.0 → 0.9.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.9.1
2
+
3
+ * soften our hardcore stance on missing properties.
4
+
1
5
  # 0.9.0
2
6
 
3
7
  /!\ /!\ Breaking Changes.
@@ -18,7 +18,9 @@ module Stache
18
18
 
19
19
  handlebars.register_helper('helperMissing') do |name, *args|
20
20
  meth, *params, options = args
21
- if self.respond_to?(meth)
21
+ if params.size == 0
22
+ ""
23
+ elsif self.respond_to?(meth)
22
24
  self.send(meth, *params)
23
25
  else
24
26
  raise "Could not find property '\#\{meth\}'"
@@ -33,8 +35,6 @@ module Stache
33
35
  options = partial_renderer.instance_variable_get('@options')
34
36
  vars.merge!(options[:context] || {}) if options
35
37
 
36
- Rails.logger.info vars.inspect
37
-
38
38
  handlebars.partial_missing do |name|
39
39
  search_path = '#{template.virtual_path}'.split("/")[0..-2]
40
40
  file = (search_path + [name]).join("/")
@@ -1,3 +1,3 @@
1
1
  module Stache
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
@@ -31,5 +31,12 @@ describe HandlebarsController do
31
31
  response.body.should =~ /Here's a capitalized string: Lowercase/
32
32
  end
33
33
 
34
+ it "doesn't blow up if it is missing data" do
35
+ get :with_missing_data
36
+ assert_response 200
37
+
38
+ response.body.should =~ /I should not \./
39
+ end
40
+
34
41
 
35
42
  end
@@ -15,4 +15,8 @@ class HandlebarsController < ApplicationController
15
15
  @some_text = "lowercase"
16
16
  end
17
17
 
18
+ def with_missing_data
19
+ #with_missing_data.html.hbs
20
+ end
21
+
18
22
  end
@@ -0,0 +1 @@
1
+ I should not {{blow_up}}.
@@ -10,4 +10,6 @@ Dummy::Application.routes.draw do
10
10
  get 'handlebars/with_partials', :to => 'handlebars#with_partials'
11
11
 
12
12
  get 'handlebars/with_helpers', :to => 'handlebars#with_helpers'
13
+
14
+ get 'handlebars/with_missing_data', :to => 'handlebars#with_missing_data'
13
15
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: stache
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.9.0
5
+ version: 0.9.1
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: 2012-05-16 00:00:00 Z
13
+ date: 2012-05-17 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: mustache
@@ -143,6 +143,7 @@ files:
143
143
  - spec/dummy/app/views/handlebars/_eaten_by_a.html.hbs
144
144
  - spec/dummy/app/views/handlebars/index.html.hbs
145
145
  - spec/dummy/app/views/handlebars/with_helpers.html.hbs
146
+ - spec/dummy/app/views/handlebars/with_missing_data.html.hbs
146
147
  - spec/dummy/app/views/handlebars/with_partials.html.hbs
147
148
  - spec/dummy/app/views/layouts/application.html.erb
148
149
  - spec/dummy/app/views/stache/_eaten_by_a.html.mustache
@@ -229,6 +230,7 @@ test_files:
229
230
  - spec/dummy/app/views/handlebars/_eaten_by_a.html.hbs
230
231
  - spec/dummy/app/views/handlebars/index.html.hbs
231
232
  - spec/dummy/app/views/handlebars/with_helpers.html.hbs
233
+ - spec/dummy/app/views/handlebars/with_missing_data.html.hbs
232
234
  - spec/dummy/app/views/handlebars/with_partials.html.hbs
233
235
  - spec/dummy/app/views/layouts/application.html.erb
234
236
  - spec/dummy/app/views/stache/_eaten_by_a.html.mustache