lib/nitro/caching/output.rb in nitro-0.30.0 vs lib/nitro/caching/output.rb in nitro-0.31.0
- old
+ new
@@ -4,10 +4,12 @@
# Adds support for caching.
module Caching
+ setting :output_cache_root, :default => 'public', :doc => 'The directory where cached pages are generated'
+
# The Output caching subsystem stores whole pages in the
# filesystem to be served directly be the front web server
# (Lighttpd, Apache, etc) for optimal performance.
#
# Nitro promotes coding your application in such a way as to
@@ -20,13 +22,10 @@
module Output
def self.included(base) # :nodoc:
base.extend(ClassMethods)
- base.module_eval do
- cattr_accessor :output_cache_root, 'public'
- end
end
module ClassMethods
def do_cache_output(path, content)
@@ -52,10 +51,10 @@
def output_cache_path(path)
filename = ((path.empty? || path == '/') ? 'index.html' : path.dup)
# filename.gsub!(/\/$/, '')
filename << '/index.html' unless (filename.split('/').last || filename).include? '.'
- return output_cache_root + '/' + filename
+ return Caching.output_cache_root + '/' + filename
end
end
private