Sha256: 7e3d5788043ae52d4ec34a2bdfae8bc842f3e976dd8f833d93594f749d4e903e

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

module SpreePaymentCalculator
  class Engine < Rails::Engine
    engine_name 'spree_payment_calculator'

    config.autoload_paths += %W(#{config.root}/lib)

    # use rspec for tests
    config.generators do |g|
      g.test_framework :rspec
    end

    def self.activate
      Dir.glob(File.join(File.dirname(__FILE__), "../../app/**/*_decorator*.rb")) do |c|
        Rails.configuration.cache_classes ? require(c) : load(c)
      end
      
      Dir.glob(File.join(File.dirname(__FILE__), "../../app/overrides/*.rb")) do |c|
        Rails.application.config.cache_classes ? require(c) : load(c)
      end
      
      Dir.glob(File.join(File.dirname(__FILE__), "../../lib/spree/environment/calculator.rb")) do |c|
        Rails.application.config.cache_classes ? require(c) : load(c)
      end
    end
    initializer 'spree.register.calculators' do |app|
      app.config.spree.calculators.payment_methods = [
        PaymentCalculator::PriceSack,
        PaymentCalculator::FlatPercentItemTotal,
        PaymentCalculator::FlatRate,
        PaymentCalculator::FlexiRate,
        PaymentCalculator::PerItem
      ]
    end

    config.to_prepare &method(:activate).to_proc
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_payment_calculator-0.70.0 lib/spree_payment_calculator/engine.rb