curly-templates 0.3.0 → 0.3.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/curly-templates.gemspec +1 -1
- data/lib/curly.rb +1 -1
- data/lib/curly/presenter.rb +6 -3
- data/spec/presenter_spec.rb +16 -0
- metadata +2 -2
data/curly-templates.gemspec
CHANGED
data/lib/curly.rb
CHANGED
data/lib/curly/presenter.rb
CHANGED
@@ -119,7 +119,7 @@ module Curly
|
|
119
119
|
end
|
120
120
|
|
121
121
|
def presenter_for_path(path)
|
122
|
-
presenter_name_for_path(path).constantize
|
122
|
+
presenter_name_for_path(path).constantize rescue nil
|
123
123
|
end
|
124
124
|
|
125
125
|
# A list of methods available to templates rendered with the presenter.
|
@@ -177,8 +177,11 @@ module Curly
|
|
177
177
|
|
178
178
|
def compute_cache_key
|
179
179
|
dependency_cache_keys = dependencies.map do |path|
|
180
|
-
presenter = presenter_for_path(path)
|
181
|
-
|
180
|
+
if presenter = presenter_for_path(path)
|
181
|
+
presenter.cache_key
|
182
|
+
else
|
183
|
+
path
|
184
|
+
end
|
182
185
|
end
|
183
186
|
|
184
187
|
[name, version, dependency_cache_keys].flatten.join("/")
|
data/spec/presenter_spec.rb
CHANGED
@@ -32,6 +32,10 @@ describe Curly::Presenter do
|
|
32
32
|
|
33
33
|
Curly::Presenter.presenter_for_path("foo/bar").should == presenter
|
34
34
|
end
|
35
|
+
|
36
|
+
it "returns nil if there is no presenter for the given path" do
|
37
|
+
Curly::Presenter.presenter_for_path("foo/bar").should be_nil
|
38
|
+
end
|
35
39
|
end
|
36
40
|
|
37
41
|
describe ".version" do
|
@@ -78,5 +82,17 @@ describe Curly::Presenter do
|
|
78
82
|
cache_key = Foo::BarPresenter.cache_key
|
79
83
|
cache_key.should == "Foo::BarPresenter/42/Foo::BumPresenter/1337"
|
80
84
|
end
|
85
|
+
|
86
|
+
it "uses the view path of a dependency if there is no presenter for it" do
|
87
|
+
presenter = Class.new(Curly::Presenter) do
|
88
|
+
version 42
|
89
|
+
depends_on 'foo/bum'
|
90
|
+
end
|
91
|
+
|
92
|
+
stub_const("Foo::BarPresenter", presenter)
|
93
|
+
|
94
|
+
cache_key = Foo::BarPresenter.cache_key
|
95
|
+
cache_key.should == "Foo::BarPresenter/42/foo/bum"
|
96
|
+
end
|
81
97
|
end
|
82
98
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: curly-templates
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -142,7 +142,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
142
142
|
version: '0'
|
143
143
|
segments:
|
144
144
|
- 0
|
145
|
-
hash:
|
145
|
+
hash: -1940230651346147654
|
146
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
147
|
none: false
|
148
148
|
requirements:
|