public
Description: A planet-style feed aggregator built in Ruby with Sinatra and DataMapper
Homepage:
Clone URL: git://github.com/zapnap/mogo.git
mogo / environment.rb
100644 46 lines (40 sloc) 1.678 kb
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
require 'rubygems'
require 'dm-core'
require 'dm-validations'
require 'dm-aggregates'
require 'dm-is-searchable'
require 'dm-sphinx-adapter'
require 'dm-timestamps'
require 'dm-is-paginated'
require 'merb-pagination'
require 'haml'
require 'ostruct'
require 'columbus'
require 'feedzirra'
require 'columbus'
 
require 'sinatra' unless defined?(Sinatra)
require 'sinatra/authorization'
 
configure do
  SiteConfig = OpenStruct.new(
                 :title => 'Planet Mogo', # title of application
                 :url_base => 'http://localhost:4567/', # base URL for your site
                 :per_page => 10, # number of entries to display per page
                 :admin_login => 'admin', # admin username
                 :admin_password => 'password', # CHANGE ME
                 :search => false # disabled by default
               )
 
  if SiteConfig.search
    # change me if you're enabling search functionality
    # tested with MySQL - fill in username, password, database name
    DataMapper.setup(:default, "mysql://root@localhost/mogo")
    DataMapper.setup(:search, "sphinx://localhost:3312")
  else
    # otherwise we use a standard sqlite3 database named after the current environment
    DataMapper.setup(:default, "sqlite3:///#{File.expand_path(File.dirname(__FILE__))}/#{Sinatra::Base.environment}.db")
  end
 
  # load models
  $LOAD_PATH.unshift("#{File.dirname(__FILE__)}/lib")
  Dir.glob("#{File.dirname(__FILE__)}/lib/*.rb") { |lib| require File.basename(lib, '.*') }
 
  # prevent Object#id warnings
  Object.send(:undef_method, :id)
end