From 58a476751b4aefd19573385d9dad670f652e0ccc Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Wed, 19 Aug 2020 04:13:36 +0100 Subject: [PATCH] Remove code from the spree engine that is not needed in OFN --- lib/spree/core/engine.rb | 64 ++-------------------------------------- 1 file changed, 2 insertions(+), 62 deletions(-) diff --git a/lib/spree/core/engine.rb b/lib/spree/core/engine.rb index aaf2e536ff..30a66922e1 100644 --- a/lib/spree/core/engine.rb +++ b/lib/spree/core/engine.rb @@ -18,12 +18,8 @@ module Spree end end - # We need to reload the routes here due to how Spree sets them up. - # The different facets of Spree (backend, frontend, etc.) append/prepend - # routes to Core *after* Core has been loaded. - # - # So we wait until after initialization is complete to do one final reload. - # This then makes the appended/prepended routes available to the application. + # We reload the routes here + # so that the appended/prepended routes are available to the application. config.after_initialize do Rails.application.routes_reloader.reload! end @@ -37,27 +33,6 @@ module Spree ::ActiveRecord::Base.include Spree::Preferences::Preferable end - initializer "spree.register.calculators" do |app| - app.config.spree.calculators.shipping_methods = [ - Spree::Calculator::Shipping::FlatPercentItemTotal, - Spree::Calculator::Shipping::FlatRate, - Spree::Calculator::Shipping::FlexiRate, - Spree::Calculator::Shipping::PerItem, - Spree::Calculator::Shipping::PriceSack - ] - - app.config.spree.calculators.tax_rates = [ - Spree::Calculator::DefaultTax - ] - end - - initializer "spree.register.stock_splitters" do |app| - app.config.spree.stock_splitters = [ - Spree::Stock::Splitter::ShippingCategory, - Spree::Stock::Splitter::Backordered - ] - end - initializer "spree.register.payment_methods" do |app| app.config.spree.payment_methods = [ Spree::Gateway::Bogus, @@ -71,41 +46,6 @@ module Spree Mail.register_interceptor(Spree::Core::MailInterceptor) end - # We need to define promotions rules here so extensions and existing apps - # can add their custom classes on their initializer files - initializer 'spree.promo.environment' do |app| - app.config.spree.add_class('promotions') - app.config.spree.promotions = Spree::Promo::Environment.new - app.config.spree.promotions.rules = [] - end - - initializer 'spree.promo.register.promotion.calculators' do |app| - app.config.spree.calculators.add_class('promotion_actions_create_adjustments') - app.config.spree.calculators.promotion_actions_create_adjustments = [ - Spree::Calculator::FlatPercentItemTotal, - Spree::Calculator::FlatRate, - Spree::Calculator::FlexiRate, - Spree::Calculator::PerItem, - Spree::Calculator::PercentPerItem, - Spree::Calculator::FreeShipping - ] - end - - initializer 'spree.promo.register.promotion.calculators' do - Rails.application.config.spree.promotions.rules.concat [ - Spree::Promotion::Rules::ItemTotal, - Spree::Promotion::Rules::Product, - Spree::Promotion::Rules::User, - Spree::Promotion::Rules::FirstOrder, - Spree::Promotion::Rules::UserLoggedIn - ] - end - - initializer 'spree.promo.register.promotions.actions' do |app| - app.config.spree.promotions.actions = [Spree::Promotion::Actions::CreateAdjustment, - Spree::Promotion::Actions::CreateLineItems] - end - # filter sensitive information during logging initializer "spree.params.filter" do |app| app.config.filter_parameters += [