-
Notifications
You must be signed in to change notification settings - Fork 1
/
environment.rb
37 lines (29 loc) · 1.06 KB
/
environment.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
require 'rubygems'
require 'bundler/setup'
require 'dm-core'
require 'dm-timestamps'
require 'dm-validations'
require 'dm-aggregates'
require 'dm-migrations'
require 'haml'
require 'ostruct'
require 'sinatra' unless defined?(Sinatra)
configure do
SiteConfig = OpenStruct.new(
:title => 'Chirpr',
:author => 'Red Hat, Inc.',
:url_base => 'http://localhost:8080/',
:twitter_key => ENV['oauth_key'],
:twitter_secret => ENV['oauth_secret'],
:twitter_callback => ENV['oauth_callback']
)
# load models
$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/lib")
Dir.glob("#{File.dirname(__FILE__)}/lib/*.rb") { |lib| require File.basename(lib, '.*') }
DataMapper.setup(:default, (ENV["DATABASE_URL"] || "postgres://chirpr:chirpr@localhost/chirpr"))
unless ENV['oauth_key'] && ENV['oauth_secret']
puts "ENV['oauth_key'] and ENV['oauth_secret'] not set. Can't do much without them."
end
enable :sessions
set :views, "#{File.dirname(__FILE__)}/views"
end