forked from mutewinter/Showbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenvironment.rb
35 lines (29 loc) · 940 Bytes
/
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
require 'rubygems'
require 'bundler/setup'
require 'dm-core'
require 'dm-timestamps'
require 'dm-validations'
require 'dm-aggregates'
require 'dm-migrations'
require 'haml'
require 'sass'
require 'sinatra' unless defined?(Sinatra)
LIVE_URL = 'http://5by5.tv/live/data.json'
configure do
# load models
Dir.glob("#{File.dirname(__FILE__)}/lib/models/*.rb") { |lib| require lib }
end
configure(:production, :development) do
DataMapper::Logger.new(STDOUT, :debug) if development?
current_directory = File.expand_path(File.dirname(__FILE__))
sqlite_file = File.join(current_directory, 'db', "#{Sinatra::Base.environment}.db")
DataMapper.setup(:default, (ENV["SHOWBOT_DATABASE_URL"] ||
"sqlite3:///#{sqlite_file}"))
DataMapper.finalize
end
configure :test do
puts 'Test configuration in use'
DataMapper.setup(:default, "sqlite3::memory:")
DataMapper.auto_migrate!
DataMapper.finalize
end