merbiful-release 0.2.2 → 0.2.3
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/Rakefile +1 -1
- data/lib/merbiful-release/body.rb +13 -3
- data/lib/merbiful-release/body.rb~ +12 -9
- metadata +1 -1
data/Rakefile
CHANGED
@@ -14,9 +14,19 @@ module Merbiful
|
|
14
14
|
self.body
|
15
15
|
else
|
16
16
|
controller.send(Merb::Template::METHOD_LIST[render_id] ||=
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
begin
|
18
|
+
filter = Merb::Template::EXTENSIONS[self.filter]
|
19
|
+
if filter.method(:compile_template).arity == 3
|
20
|
+
Merb::Template::EXTENSIONS[self.filter].compile_template(FAKE_IO_CLASS.new(self.body, render_id),
|
21
|
+
render_id,
|
22
|
+
Merb::InlineTemplates)
|
23
|
+
elsif filter.method(:compile_template).arity == 4
|
24
|
+
Merb::Template::EXTENSIONS[self.filter].compile_template(FAKE_IO_CLASS.new(self.body, render_id),
|
25
|
+
render_id,
|
26
|
+
[],
|
27
|
+
Merb::InlineTemplates)
|
28
|
+
end
|
29
|
+
end)
|
20
30
|
end
|
21
31
|
unless Merb.environment == "development"
|
22
32
|
caches.each do |destination, to_cache|
|
@@ -3,17 +3,26 @@ module Merbiful
|
|
3
3
|
|
4
4
|
module Body
|
5
5
|
|
6
|
+
FAKE_IO_CLASS = Struct.new(:read, :path)
|
7
|
+
|
8
|
+
def render_id
|
9
|
+
Merb::Template.template_name("#{self.class}##{self.id}")
|
10
|
+
end
|
11
|
+
|
6
12
|
def render(controller, caches = {})
|
7
13
|
rval = if self.filter.blank?
|
8
14
|
self.body
|
9
15
|
else
|
10
|
-
|
11
|
-
|
16
|
+
controller.send(Merb::Template::METHOD_LIST[render_id] ||=
|
17
|
+
Merb::Template::EXTENSIONS[self.filter].compile_template(FAKE_IO_CLASS.new(self.body, render_id),
|
18
|
+
render_id,
|
19
|
+
[],
|
20
|
+
Merb::InlineTemplates))
|
12
21
|
end
|
13
22
|
unless Merb.environment == "development"
|
14
23
|
caches.each do |destination, to_cache|
|
15
24
|
if to_cache
|
16
|
-
path =
|
25
|
+
path = destination.cached_path
|
17
26
|
Merb.logger.info("Flushing to #{path.inspect}")
|
18
27
|
path.parent.mkpath
|
19
28
|
path.open("w") do |out|
|
@@ -25,12 +34,6 @@ module Merbiful
|
|
25
34
|
return rval
|
26
35
|
end
|
27
36
|
|
28
|
-
def clear_cache(target)
|
29
|
-
return if target == "/"
|
30
|
-
path = Pathname.new(File.join(Merb.root, "public", target))
|
31
|
-
path.unlink if path.exist?
|
32
|
-
end
|
33
|
-
|
34
37
|
end
|
35
38
|
|
36
39
|
end
|