module Tarpaulin
Tarpaulin
is a module containing all of the great Tarpaulin
classes that do such an excellent job. These are snippets of code common to my Camping apps
-
custom class Logger
-
catch all class
Endless
-
Tarpaulin
main module and helpers and include modules -
Tilt
template for ClearSilver
included into top-level TheApp module
overrides r404, defines r403 tells Tarpaulin
which Controller in TheApp handles static files
don't need to require anything as these are modules that are included elsewhere and those elsewhere require stuff :)
-
use included and then call TheApp for stuff we need (like link_controller)
-
what is the difference between #R, #R, #D, #URL ???
-
use decent error pages, 403, 404, and Ruby Inspect (html version) in dev mode
-
do link_ methods need to use #R or some variant?
Constants
- VERSION
Public Class Methods
# File lib/tarpaulin/camping.rb, line 16 def self.included(mod) $DEBUG and $stderr.puts "mod is #{@mod}" @mod = mod $DEBUG and $stderr.puts "now it is #{@mod}" end
Public Instance Methods
check for Context
, only show a.inspect in dev mode
# File lib/tarpaulin/camping.rb, line 23 def r403(f=nil, &block) #$stderr.puts "in 403" h = {'Content-Type' => 'text/html; charset=utf-8'} a = eval("Context::determine{}", block) if f.nil? f = block.call end extra = (ENV['MODE'] == 'development') ? "<br><hr>#{a.inspect}" : '' html_msg = "<!DOCTYPE html><html lang='en'><head>"+ "<title>« Uh oh »</title><body><span class='error'>"+ "Site error (BEEP!) 403: Invalid Path: #{f}#{extra}</span></body>" r(403, html_msg, h) end
# File lib/tarpaulin/camping.rb, line 37 def r404(f=nil, &block) # compat with Camping #$stderr.puts "in 404" h = {'Content-Type' => 'text/html; charset=utf-8'} a = eval("Context::determine{}", block) if f.nil? f = block.call end extra = (ENV['MODE'] == 'development') ? "<br><hr>#{a.inspect}" : '' html_msg = "<!DOCTYPE html><html lang='en'><head>"+ "<title>« Uh oh »</title><body><span class='error'>"+ "Site error (BEEP!) 404: File not found: #{f}#{extra}</span></body>" r(404, html_msg, h) end