-
Notifications
You must be signed in to change notification settings - Fork 1
/
thoughts.rb
57 lines (43 loc) · 1.52 KB
/
thoughts.rb
1
2
3
4
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
require 'rubygems'
require 'sinatra'
%w[sequel maruku splam splam/rule splam/rules openid].each do |prereq|
$LOAD_PATH.unshift File.dirname(__FILE__) + "/vendor/#{prereq}/lib"
require prereq
end
$LOAD_PATH.unshift File.dirname(__FILE__) + "/vendor/rack-openid/lib"
require "rack/openid"
$LOAD_PATH.unshift File.dirname(__FILE__) + "/vendor/sinatra-cache/lib"
require "sinatra/cache"
require "builder"
configure :test do
db = Sequel::DATABASES.first || Sequel.connect('sqlite:/')
require 'sequel/extensions/migration'
Sequel::Migrator.apply(db, 'db/migrations', 0, nil)
Sequel::Migrator.apply(db, 'db/migrations')
db[:blogs].insert(:title =>'my test blog', :tagline => 'testing 1,2,3', :theme => 'default', :domain => 'http://test.com')
end
configure :production, :development do
logger = Logger.new("log/#{Sinatra::Application.environment}.log")
Sequel.connect('sqlite://db/blog.db',:loggers => [logger])
set :logging, false
set :logger, logger
use Rack::CommonLogger, logger
end
configure do
%w[blog post comment tag tagging user].each do |model|
require "models/#{model}"
end
if Blog.default
set :public, 'themes/' + Blog.default.theme + '/public'
set :views, 'themes/' + Blog.default.theme + '/views'
end
enable :sessions
set :cache_enabled, true
set :cache_output_dir, 'cache'
use Rack::OpenID
require "sequel/extensions/pagination"
end
layout 'layout'
load 'controllers/helpers.rb'
load 'controllers/admin_routes.rb'
load 'controllers/blog_routes.rb'