Skip to content

Commit

Permalink
Remove code from the spree engine that is not needed in OFN
Browse files Browse the repository at this point in the history
  • Loading branch information
luisramos0 committed Aug 21, 2020
1 parent d3ff61a commit 78ece5e
Showing 1 changed file with 2 additions and 62 deletions.
64 changes: 2 additions & 62 deletions lib/spree/core/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@ class Engine < ::Rails::Engine
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
Expand All @@ -37,27 +33,6 @@ class Engine < ::Rails::Engine
::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,
Expand All @@ -71,41 +46,6 @@ class Engine < ::Rails::Engine
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 += [
Expand Down

0 comments on commit 78ece5e

Please sign in to comment.