2010-04-22 23:52:11 +00:00
|
|
|
# require 'locomotive/patches'
|
|
|
|
require 'locomotive/configuration'
|
2010-05-30 23:57:33 +00:00
|
|
|
require 'locomotive/liquid'
|
2010-06-01 00:06:46 +00:00
|
|
|
require 'locomotive/mongoid'
|
2010-04-22 23:52:11 +00:00
|
|
|
|
2010-04-11 23:59:18 +00:00
|
|
|
module Locomotive
|
2010-06-03 15:32:40 +00:00
|
|
|
|
2010-04-11 23:59:18 +00:00
|
|
|
class << self
|
|
|
|
attr_accessor :config
|
|
|
|
|
|
|
|
def config
|
|
|
|
self.config = Configuration.new unless @config
|
|
|
|
@config
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.configure
|
|
|
|
self.config ||= Configuration.new
|
|
|
|
yield(self.config)
|
2010-06-03 15:32:40 +00:00
|
|
|
|
|
|
|
after_configure
|
2010-04-11 23:59:18 +00:00
|
|
|
end
|
|
|
|
|
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?
|
|
|
|
|
|
|
|
ActionMailer::Base.default_url_options[:host] = Locomotive.config.default_domain + (Rails.env.development? ? ':3000' : '')
|
|
|
|
|
|
|
|
Rails.application.config.session_store :cookie_store, {
|
|
|
|
:key => Locomotive.config.cookie_key,
|
|
|
|
:domain => ".#{Locomotive.config.default_domain}"
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2010-04-11 23:59:18 +00:00
|
|
|
end
|