mack-distributed 0.8.0.101 → 0.8.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.
@@ -9,8 +9,9 @@ configatron.mack.distributed.set_default(:share_routes, false)
9
9
  configatron.mack.distributed.set_default(:share_objects, false)
10
10
  configatron.mack.distributed.set_default(:share_views, false)
11
11
  configatron.mack.distributed.set_default(:app_name, nil)
12
- configatron.mack.distributed.set_default(:site_domain, 'http://localhost:3000')
12
+ configatron.mack.distributed.set_default(:site_domain, nil)
13
13
  configatron.mack.distributed.set_default(:timeout, 0)
14
+ configatron.mack.distributed.set_default(:enable_view_cache, false)
14
15
 
15
16
  # load *.rb files
16
17
  Dir.glob(File.join(base, "**", "*.rb")).each do |f|
@@ -18,3 +19,4 @@ Dir.glob(File.join(base, "**", "*.rb")).each do |f|
18
19
  end
19
20
 
20
21
  Mack::Distributed::View.register
22
+
@@ -3,28 +3,38 @@ module Mack
3
3
  class ViewCache < Cachetastic::Caches::Base
4
4
 
5
5
  class << self
6
- include Mack::ViewHelpers::LinkHelpers
6
+ include Mack::ViewHelpers
7
7
 
8
8
  def get(path)
9
- raw = super(path) do
10
- raw = ""
11
- if File.exists?(path)
12
- raw = File.read(path)
13
-
14
- # preprocess the raw content so we can resolve css/javascript/image path
15
- arr = raw.scan(/<%=.*?%>/)
16
- arr.each do |scriptlet|
17
- if scriptlet.match(/stylesheet/) or scriptlet.match(/javascript/) or scriptlet.match(/image/)
18
- res = ERB.new(scriptlet).result(binding)
19
- raw.gsub!(scriptlet, res)
20
- end
21
- end # if arr.each
22
- end # if File.exists?
23
-
24
- set(path, raw)
25
- end # super(key)
9
+ if configatron.mack.distributed.enable_view_cache
10
+ raw = super(path) do
11
+ get_raw_data(path, true)
12
+ end
13
+ else
14
+ raw = get_raw_data(path, false)
15
+ end
16
+
26
17
  return raw
27
18
  end # def get
19
+
20
+ private
21
+ def get_raw_data(path, cache_data = true)
22
+ if File.exists?(path)
23
+ raw = File.read(path)
24
+
25
+ # preprocess the raw content so we can resolve css/javascript/image path
26
+ arr = raw.scan(/<%=.*?%>/)
27
+ arr.each do |scriptlet|
28
+ if scriptlet.match(/stylesheet/) or scriptlet.match(/javascript/) or scriptlet.match(/image/)
29
+ res = ERB.new(scriptlet).result(binding)
30
+ raw.gsub!(scriptlet, res)
31
+ end
32
+ end # if arr.each
33
+ end # if File.exists?
34
+
35
+ set(path, raw) if cache_data
36
+ raw
37
+ end # get_raw_data
28
38
  end # class << self
29
39
 
30
40
  end # ViewCache
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.101
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - markbates
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-11 00:00:00 -04:00
12
+ date: 2008-10-26 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - "="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.8.0.101
33
+ version: 0.8.1
34
34
  version:
35
35
  description: Distributed Application Support for Mack Framework
36
36
  email: mark@mackframework.com