-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.rb
More file actions
43 lines (37 loc) · 1011 Bytes
/
Copy pathapp.rb
File metadata and controls
43 lines (37 loc) · 1011 Bytes
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
# Load env
require 'dotenv'
Dotenv.load
# Bundler
require "rubygems"
require "bundler/setup"
# Include required gems
%w{
mongo_mapper rack-flash sinatra/base mustache/sinatra
RedCloth chronic html_truncator tzinfo active_model/serializers
active_support/inflector pony dotenv
}.each {|req| require req }
## Connect to MongoDB
MongoMapper.setup(
{'production' => { 'uri' => ENV['MONGO_URI'] || 'mongodb://localhost:27017/roamtheblog' }},
'production'
)
## Setup Pony
Pony.options = {
:via => :smtp,
:via_options => {
:address => ENV['SMTP_HOST'],
:port => ENV['SMTP_PORT'] || '587',
:domain => ENV['SMTP_DOMAIN'],
:user_name => ENV['SMTP_USER'],
:password => ENV['SMTP_PASS'],
:authentication => :plain,
:enable_starttls_auto => true
}
}
# Require app libs
Dir["./lib/*.rb"].sort.each {|req| require req}
Dir["./models/*.rb"].sort.each {|req| require req}
Dir["./app/*.rb"].sort.each {|req| require req}
# Create defaults
User.create_default
Site.create_default