From 8b1bf6ea29a358332a0c90f07f9aa789b0a5645c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 16 Jan 2013 22:20:38 +0100 Subject: cache instance :debug lookup in @debug --- lib/zorglub/node.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/zorglub/node.rb b/lib/zorglub/node.rb index 4328a66..e204326 100644 --- a/lib/zorglub/node.rb +++ b/lib/zorglub/node.rb @@ -258,6 +258,7 @@ module Zorglub @request = Rack::Request.new env @response = Rack::Response.new @cli_vals ={} + @debug = app.opt :debug @engine = self.class.engine @layout = ( options[:partial] ? nil : self.class.layout ) @view = r(options[:method]) @@ -298,9 +299,9 @@ module Zorglub Dir.mkdir app.static_base_path Dir.mkdir File.dirname path File.open(path, 'w') {|f| f.write("@mime:"+@mime+"\n"); f.write(@content); } - puts " * cache file created : #{path}" if app.opt :debug + puts " * cache file created : #{path}" if @debug else - puts " * use cache file : #{path}" if app.opt :debug + puts " * use cache file : #{path}" if @debug content = File.open(path, 'r') {|f| f.read } @content = content.sub /^@mime:(.*)\n/,'' @mime = $1 @@ -309,9 +310,12 @@ module Zorglub # def compile_page! e, @options[:ext] = app.engine_proc_ext @engine, @options[:ext] - v, l, debug = view, layout, app.opt(:debug) - puts " * "+((l and File.exists?(l)) ? 'use layout' : 'not found layout')+" : "+(l ? l : '') if debug - puts " * "+((v and File.exists?(v)) ? 'use view ' : 'not found view ')+" : "+(v ? v : '') if debug + v, l = view, layout + if @debug + puts " * "+(e ? 'use engine' : 'no engine ')+" : "+(e ? e.to_s : '') + puts " * "+((l and File.exists?(l)) ? 'use layout' : 'no layout ')+" : "+(l ? l : '') + puts " * "+((v and File.exists?(v)) ? 'use view ' : 'no view ')+" : "+(v ? v : '') + end @state = (@options[:partial] ? :partial : :view) @content, mime = e.call v, self if e and v and File.exists? v @mime = mime unless mime.nil? -- cgit v1.1-2-g2b99