Sha256: 47c85424affc441f7575a429fd5d77f34aeeb93da5aeeb6e88b01670e8d983f2

Contents?: true

Size: 1.62 KB

Versions: 4

Compression:

Stored size: 1.62 KB

Contents

module KktShoppe
  class Engine < ::Rails::Engine
    isolate_namespace KktShoppe
    
    if KktShoppe.respond_to?(:root)
      config.autoload_paths << File.join(KktShoppe.root, 'lib')
      config.assets.precompile += ['kkt_shoppe/sub.css', 'kkt_shoppe/printable.css']
    end
    
    # We don't want any automatic generators in the engine.
    config.generators do |g|
      g.orm             :active_record
      g.test_framework  false
      g.stylesheets     false
      g.javascripts     false
      g.helper          false
    end

    config.to_prepare do
      Dir.glob(Rails.root + "app/decorators/**/*_decorator*.rb").each do |c|
        require_dependency(c)
      end
    end
    
    initializer 'kkt_shoppe.initialize' do |app|
      # Add the default settings
      KktShoppe.add_settings_group :system_settings, [:store_name, :email_address, :currency_unit, :tax_name, :demo_mode]
      
      # Add middleware
      app.config.middleware.use KktShoppe::SettingsLoader
      
      # Load our migrations into the application's db/migrate path
      unless app.root.to_s.match root.to_s
        config.paths["db/migrate"].expanded.each do |expanded_path|
          app.config.paths["db/migrate"] << expanded_path
        end
      end      
      
      # Load view helpers for the base application
      ActiveSupport.on_load(:action_view) do
        require 'kkt_shoppe/view_helpers'
        ActionView::Base.send :include, KktShoppe::ViewHelpers
      end
      
      # Load default navigation
      require 'kkt_shoppe/default_navigation'
    end
    
    generators do
      require 'kkt_shoppe/setup_generator'
    end
    
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kkt_shoppe-1.2.1 lib/kkt_shoppe/engine.rb
kkt_shoppe-1.2.0 lib/kkt_shoppe/engine.rb
kkt_shoppe-1.1.1 lib/kkt_shoppe/engine.rb
kkt_shoppe-1.1.0 lib/kkt_shoppe/engine.rb