2010-09-28 07:46:12 +00:00
|
|
|
require 'mimetype_fu'
|
2011-01-18 15:06:36 +00:00
|
|
|
require 'devise'
|
2010-10-15 00:05:21 +00:00
|
|
|
|
2010-09-28 06:04:40 +00:00
|
|
|
require 'locomotive/version'
|
2010-10-14 12:37:14 +00:00
|
|
|
require 'locomotive/core_ext'
|
2010-04-22 23:52:11 +00:00
|
|
|
require 'locomotive/configuration'
|
2010-06-14 13:04:01 +00:00
|
|
|
require 'locomotive/logger'
|
2010-05-30 23:57:33 +00:00
|
|
|
require 'locomotive/liquid'
|
2010-06-01 00:06:46 +00:00
|
|
|
require 'locomotive/mongoid'
|
2010-06-29 22:09:47 +00:00
|
|
|
require 'locomotive/carrierwave'
|
2010-06-14 13:04:01 +00:00
|
|
|
require 'locomotive/heroku'
|
2010-06-30 13:18:17 +00:00
|
|
|
require 'locomotive/custom_fields'
|
2010-07-06 00:05:47 +00:00
|
|
|
require 'locomotive/httparty'
|
2010-07-13 00:46:17 +00:00
|
|
|
require 'locomotive/inherited_resources'
|
2010-07-13 23:37:02 +00:00
|
|
|
require 'locomotive/admin_responder'
|
2010-07-29 23:21:48 +00:00
|
|
|
require 'locomotive/routing'
|
|
|
|
require 'locomotive/regexps'
|
|
|
|
require 'locomotive/render'
|
2010-09-22 22:59:30 +00:00
|
|
|
require 'locomotive/import'
|
2010-09-28 22:08:11 +00:00
|
|
|
require 'locomotive/delayed_job'
|
2010-10-11 14:26:46 +00:00
|
|
|
require 'locomotive/middlewares'
|
2010-09-28 09:19:55 +00:00
|
|
|
require 'locomotive/session_store'
|
2010-06-10 22:07:59 +00:00
|
|
|
|
2010-04-11 23:59:18 +00:00
|
|
|
module Locomotive
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-06-14 13:04:01 +00:00
|
|
|
include Locomotive::Heroku
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-04-11 23:59:18 +00:00
|
|
|
class << self
|
|
|
|
attr_accessor :config
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-04-11 23:59:18 +00:00
|
|
|
def config
|
|
|
|
self.config = Configuration.new unless @config
|
|
|
|
@config
|
|
|
|
end
|
|
|
|
end
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-04-11 23:59:18 +00:00
|
|
|
def self.configure
|
|
|
|
self.config ||= Configuration.new
|
|
|
|
yield(self.config)
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-06-03 15:32:40 +00:00
|
|
|
after_configure
|
2010-04-11 23:59:18 +00:00
|
|
|
end
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-06-03 15:32:40 +00:00
|
|
|
def self.after_configure
|
|
|
|
raise '[Error] Locomotive needs a default domain name' if Locomotive.config.default_domain.blank?
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-06-14 13:04:01 +00:00
|
|
|
ActionMailer::Base.default_url_options[:host] = self.config.default_domain + (Rails.env.development? ? ':3000' : '')
|
2010-06-03 15:32:40 +00:00
|
|
|
|
2010-06-16 14:43:29 +00:00
|
|
|
# cookies stored in mongodb (mongoid_store)
|
2010-06-10 22:07:59 +00:00
|
|
|
Rails.application.config.session_store :mongoid_store, {
|
2010-06-16 14:43:29 +00:00
|
|
|
:key => Locomotive.config.cookie_key
|
2010-06-03 15:32:40 +00:00
|
|
|
}
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-06-14 13:04:01 +00:00
|
|
|
# Heroku support
|
|
|
|
self.enable_heroku if self.heroku?
|
2011-01-18 15:06:36 +00:00
|
|
|
|
|
|
|
# Devise
|
|
|
|
Devise.mailer_sender = self.config.mailer_sender
|
2010-06-14 13:04:01 +00:00
|
|
|
end
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-06-14 13:04:01 +00:00
|
|
|
def self.logger(message)
|
|
|
|
if Locomotive.config.enable_logs == true
|
|
|
|
Rails.logger.info(message)
|
|
|
|
end
|
2010-06-03 15:32:40 +00:00
|
|
|
end
|
2010-07-23 20:09:54 +00:00
|
|
|
|
|
|
|
end
|