Sha256: 75687497979d3f4309bf7887923c04fe991b23e2e99531172a2e22e61e619524

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

require 'active_support/all'
require 'i18n'

require 'rack/builder'
require 'rack/commonlogger'
require 'better_errors'

require 'dugway/version'
require 'dugway/application'
require 'dugway/cart'
require 'dugway/liquifier'
require 'dugway/logger'
require 'dugway/request'
require 'dugway/store'
require 'dugway/template'
require 'dugway/theme'
require 'dugway/theme_font'
require 'dugway/extensions/time'

module Dugway
  class << self
    def application(options={})
      @logger = Logger.new if options[:log]
      @source_dir = File.join(Dir.pwd, 'source')
      @store = Store.new(options[:store] || 'dugway')
      @theme = Theme.new(options[:customization] || {})
      @cart = Cart.new

      I18n.load_path += Dir[File.join(File.dirname(__FILE__), 'data', 'locales', '*.yml').to_s]
      I18n.default_locale = 'en-US'
      I18n.locale = Dugway.store.locale

      Rack::Builder.app do
        use Rack::Session::Cookie, :secret => 'stopwarningmeaboutnothavingasecret'
        use BetterErrors::Middleware
        
        if options[:log]
          BetterErrors.logger = Dugway.logger
          use Rack::CommonLogger, Dugway.logger
        end
        
        run Application.new
      end
    end

    def store
      @store
    end

    def theme
      @theme
    end

    def cart
      @cart
    end

    def source_dir
      @source_dir
    end
    
    def logger
      @logger
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dugway-0.5.0 lib/dugway.rb