Module: Tarpaulin

Defined in:
lib/tarpaulin.rb,
lib/tarpaulin/camping.rb

Overview

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 :)

Defined Under Namespace

Modules: Helpers

Constant Summary collapse

VERSION =
IO.read(version_file).strip
nil

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



15
16
17
# File 'lib/tarpaulin/camping.rb', line 15

def self.link_controller
  @@link
end


12
13
14
# File 'lib/tarpaulin/camping.rb', line 12

def self.link_controller=(link)
  @@link = link 
end

Instance Method Details

#r403(f = nil, &block) ⇒ Object

check for Context, only show a.inspect in dev mode



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/tarpaulin/camping.rb', line 20

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
  html_msg = "<!DOCTYPE html><html lang='en'><head>"+
             "<title>&#171; Uh oh &#187;</title><body><span class='error'>"+
             "Site error (BEEP!) 403: Invalid Path: #{f}<br>#{a.inspect}</span></body>"
  r(403, html_msg, h)
end

#r404(f = nil, &block) ⇒ Object

compat with Camping



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/tarpaulin/camping.rb', line 33

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
  html_msg = "<!DOCTYPE html><html lang='en'><head>"+
             "<title>&#171; Uh oh &#187;</title><body><span class='error'>"+
             "Site error (BEEP!) 404: File not found: #{f}<br>#{a.inspect}</span></body>"
  r(404, html_msg, h)
end