Sha256: 140e03036381ce1f481761f8aa0ac407b6ce71d31d4298c8ef6a42670b2a9b4f

Contents?: true

Size: 1.66 KB

Versions: 11

Compression:

Stored size: 1.66 KB

Contents

# Set our encodings to ensure we're always dealing with UTF-8 data.
# Users experiencing problems with their templates should ensure they are saved as UTF-8.
old_verbose, $VERBOSE = $VERBOSE, nil
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
$VERBOSE = old_verbose

require 'active_support/all'
require 'i18n'
require 'bigcartel-currency-locales'
require 'bigcartel/theme/fonts'

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/extensions/time'

module Dugway
  class << self
    def application(options={})
      @options = options

      BigCartel::CurrencyLocales.insert
      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 ||= Store.new(options && options[:store] || 'dugway')
    end

    def theme
      @theme ||= Theme.new(options && options[:customization] || {})
    end

    def cart
      @cart ||= Cart.new
    end

    def source_dir
      @source_dir ||= File.join(Dir.pwd, 'source')
    end

    def logger
      @logger ||= Logger.new
    end

    def options
      @options
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
dugway-0.10.2 lib/dugway.rb
dugway-0.10.1 lib/dugway.rb
dugway-0.10.0 lib/dugway.rb
dugway-0.9.0 lib/dugway.rb
dugway-0.8.4 lib/dugway.rb
dugway-0.8.3 lib/dugway.rb
dugway-0.8.2 lib/dugway.rb
dugway-0.8.1 lib/dugway.rb
dugway-0.8.0 lib/dugway.rb
dugway-0.7.1 lib/dugway.rb
dugway-0.7.0 lib/dugway.rb