Module: Vesper

Defined in:
lib/vesper.rb,
lib/vesper/version.rb

Constant Summary collapse

VERSION =
"1.1.1"

Class Method Summary collapse

Class Method Details

.load_appObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/vesper.rb', line 5

def self.load_app
  require 'bundler'
  Bundler.require

  set :environment, ENV['env']         if ENV['env']
  set :environment, ENV['environment'] if ENV['environment']
  set :environment, ENV['rack_env']    if ENV['rack_env']

  Tilt.register Tilt::ERBTemplate, 'html'

  set :views, './views'
  set :public_folder, './public'

  Dir["./plugins/**/pre-boot.rb"].each {|file| require file}
  
  [
    'config',
    'plugins/**/config',
    'plugins/**/application',
    'application'
  ].each {|dir| Dir["./#{dir}/**/*.rb"].each {|file| require file}}

  Dir["./plugins/**/post-boot.rb"].each {|file| require file}
  
  configure :development do
    get('/?') { erb :'../public/index', layout: false }
  end
  
  configure :production do
    error(400) { redirect '/errors/400.html' }
    error(401) { redirect '/errors/401.html' }
    error(403) { redirect '/errors/403.html' }
    error(404) { redirect '/errors/404.html' }
    error(408) { redirect '/errors/408.html' }
    error(500) { redirect '/errors/500.html' }
    error(502) { redirect '/errors/502.html' }
  end
  
end

.load_tasksObject



45
46
47
48
# File 'lib/vesper.rb', line 45

def self.load_tasks
  Dir["./plugins/**/tasks/*"].each {|file| require file}
  Dir["./tasks/**/*"].each {|file| require file}
end