Sha256: ddf80d0ace908dfadf0ad0055f8c74d44110a10c80747e74f6bfbd9fdcf2d986

Contents?: true

Size: 891 Bytes

Versions: 5

Compression:

Stored size: 891 Bytes

Contents

# require 'locomotive/patches'
require 'locomotive/configuration'
require 'locomotive/liquid'
require 'locomotive/mongoid'

require 'mongo_session_store/mongoid'

module Locomotive
  
  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)
      
    after_configure
  end
  
  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 :mongoid_store, {
      :key => Locomotive.config.cookie_key,
      :domain => ".#{Locomotive.config.default_domain}"
    }
  end
    
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
locomotive_cms-0.0.2.4 lib/locomotive.rb
locomotive_cms-0.0.2.3 lib/locomotive.rb
locomotive_cms-0.0.2.2 lib/locomotive.rb
locomotive_cms-0.0.2.1 lib/locomotive.rb
locomotive_cms-0.0.2 lib/locomotive.rb