mack-distributed 0.8.0 → 0.8.0.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -5,8 +5,8 @@ module Mack
|
|
5
5
|
|
6
6
|
# render(:distributed, "distributed://host/resource")
|
7
7
|
def render
|
8
|
-
uri = Addressable::URI.parse(self.
|
9
|
-
raise InvalidAddressableURIFormat.new("#{self.
|
8
|
+
uri = Addressable::URI.parse(self._render_value)
|
9
|
+
raise InvalidAddressableURIFormat.new("#{self._render_value}") if uri.host.nil? or uri.path.nil?
|
10
10
|
|
11
11
|
app_name = uri.host
|
12
12
|
resource = File.join("app", "views", uri.path)
|
@@ -17,15 +17,15 @@ module Mack
|
|
17
17
|
Mack::Rendering::Engine::Registry.engines[:distributed].each do |e|
|
18
18
|
@engine = find_engine(e).new(self.view_template)
|
19
19
|
|
20
|
-
view_path = "#{resource}.#{self.
|
20
|
+
view_path = "#{resource}.#{self._options[:format]}.#{@engine.extension}"
|
21
21
|
raw = data.get(view_path)
|
22
22
|
break if !raw.nil?
|
23
23
|
end
|
24
24
|
|
25
|
-
raise Mack::Errors::ResourceNotFound.new("#{self.
|
25
|
+
raise Mack::Errors::ResourceNotFound.new("#{self._options[:distributed]}") if raw.nil?
|
26
26
|
|
27
|
-
old_render_value = self.view_template.
|
28
|
-
self.view_template.
|
27
|
+
old_render_value = self.view_template._render_value.dup
|
28
|
+
self.view_template._render_value = raw
|
29
29
|
Mack::Rendering::Type::Inline.new(self.view_template).render
|
30
30
|
# self.view_template.render_value = old_render_value
|
31
31
|
end
|
@@ -6,12 +6,12 @@ module Mack
|
|
6
6
|
alias_instance_method :render
|
7
7
|
|
8
8
|
def render
|
9
|
-
if !self.
|
9
|
+
if !self._options[:layout].starts_with?("distributed")
|
10
10
|
# this is the regular layout, so call the local_render method
|
11
11
|
_original_render
|
12
12
|
else
|
13
|
-
uri = Addressable::URI.parse(self.
|
14
|
-
raise InvalidAddressableURIFormat.new("#{self.
|
13
|
+
uri = Addressable::URI.parse(self._options[:layout])
|
14
|
+
raise InvalidAddressableURIFormat.new("#{self._options[:layout]}") if uri.host.nil? or uri.path.nil?
|
15
15
|
|
16
16
|
app_name = uri.host
|
17
17
|
resource = File.join("app", "views", "layouts", uri.path)
|
@@ -22,15 +22,15 @@ module Mack
|
|
22
22
|
Mack::Rendering::Engine::Registry.engines[:layout].each do |e|
|
23
23
|
@engine = find_engine(e).new(self.view_template)
|
24
24
|
|
25
|
-
layout_path = "#{resource}.#{self.
|
25
|
+
layout_path = "#{resource}.#{self._options[:format]}.#{@engine.extension}"
|
26
26
|
raw = data.get(layout_path)
|
27
27
|
break if !raw.nil?
|
28
28
|
end
|
29
29
|
|
30
|
-
raise Mack::Errors::ResourceNotFound.new("#{self.
|
30
|
+
raise Mack::Errors::ResourceNotFound.new("#{self._options[:distributed]}") if raw.nil?
|
31
31
|
|
32
|
-
old_render_value = self.view_template.
|
33
|
-
self.view_template.
|
32
|
+
old_render_value = self.view_template._render_value.dup
|
33
|
+
self.view_template._render_value = raw
|
34
34
|
Mack::Rendering::Type::Inline.new(self.view_template).render
|
35
35
|
end
|
36
36
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mack-distributed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.0
|
4
|
+
version: 0.8.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- markbates
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.8.0
|
33
|
+
version: 0.8.0.1
|
34
34
|
version:
|
35
35
|
description: Distributed Application Support for Mack Framework
|
36
36
|
email: mark@mackframework.com
|