Sha256: 47bf9396e529e0c78d9d37ddbecb5be0543f29eef9705d0c964d18e01d2e9682

Contents?: true

Size: 1.71 KB

Versions: 12

Compression:

Stored size: 1.71 KB

Contents

module SpreeCore
  class Engine < Rails::Engine

    config.autoload_paths += %W(#{config.root}/lib)
    # TODO - register state monitor observer?

    def self.activate

      Spree::ThemeSupport::HookListener.subclasses.each do |hook_class|
        Spree::ThemeSupport::Hook.add_listener(hook_class)
      end

      #register all payment methods (unless we're in middle of rake task since migrations cannot be run for this first time without this check)
      if File.basename( $0 ) != "rake"
        [
          Gateway::Bogus,
          Gateway::AuthorizeNet,
          Gateway::AuthorizeNetCim,
          Gateway::Eway,
          Gateway::Linkpoint,
          Gateway::PayPal,
          Gateway::SagePay,
          Gateway::Beanstream,
          Gateway::Braintree,
          PaymentMethod::Check
        ].each{|gw|
          begin
            gw.register
          rescue Exception => e
            $stderr.puts "Error registering gateway #{gw}: #{e}"
          end
        }

        #register all calculators
        [
          Calculator::FlatPercentItemTotal,
          Calculator::FlatRate,
          Calculator::FlexiRate,
          Calculator::PerItem,
          Calculator::SalesTax,
          Calculator::Vat,
          Calculator::PriceBucket
        ].each{|c_model|
          begin
            c_model.register if c_model.table_exists?
          rescue Exception => e
            $stderr.puts "Error registering calculator #{c_model}"
          end
        }

      end

    end

    config.to_prepare &method(:activate).to_proc

    # filter sensitive information during logging
    initializer "spree.params.filter" do |app|
      app.config.filter_parameters += [:password, :password_confirmation, :number]
    end

  end
end

Version data entries

12 entries across 12 versions & 6 rubygems

Version Path
apispree_core-0.0.0 lib/spree_core/railtie.rb
My-Commerce_core-1.1.0 lib/spree_core/railtie.rb
My-Commerce_core-1.0.0 lib/spree_core/railtie.rb
MyCommerceapi-1.0.0 core/lib/spree_core/railtie.rb
MyCommerce-0.0.3 core/lib/spree_core/railtie.rb
rfcommerce_core-0.0.3 lib/spree_core/railtie.rb
spree_core-0.60.6 lib/spree_core/railtie.rb
spree_core-0.60.5 lib/spree_core/railtie.rb
spree_core-0.60.4 lib/spree_core/railtie.rb
spree_core-0.60.3 lib/spree_core/railtie.rb
spree_core-0.60.2 lib/spree_core/railtie.rb
spree_core-0.60.1 lib/spree_core/railtie.rb