spree_core 3.6.6 → 3.7.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spree.js +60 -0
- data/app/finders/spree/countries/find.rb +31 -0
- data/app/finders/spree/credit_cards/find.rb +12 -0
- data/app/finders/spree/line_items/find_by_variant.rb +13 -0
- data/app/finders/spree/orders/find_current.rb +34 -0
- data/app/finders/spree/products/find.rb +93 -0
- data/app/finders/spree/taxons/find.rb +79 -0
- data/app/helpers/spree/base_helper.rb +7 -3
- data/app/helpers/spree/products_helper.rb +2 -1
- data/app/models/concerns/spree/adjustment_source.rb +11 -6
- data/app/models/concerns/spree/user_address.rb +2 -2
- data/app/models/concerns/spree/vat_price_calculation.rb +2 -1
- data/app/models/spree/ability.rb +2 -2
- data/app/models/spree/address.rb +23 -14
- data/app/models/spree/adjustable/adjustments_updater.rb +1 -1
- data/app/models/spree/adjustable/promotion_accumulator.rb +2 -1
- data/app/models/spree/adjustment.rb +18 -3
- data/app/models/spree/asset/support/active_storage.rb +1 -1
- data/app/models/spree/calculator.rb +1 -4
- data/app/models/spree/calculator/flexi_rate.rb +8 -11
- data/app/models/spree/calculator/returns/default_refund_amount.rb +3 -1
- data/app/models/spree/calculator/shipping/flexi_rate.rb +13 -13
- data/app/models/spree/country.rb +4 -0
- data/app/models/spree/credit_card.rb +8 -2
- data/app/models/spree/customer_return.rb +1 -0
- data/app/models/spree/fulfilment_changer.rb +117 -0
- data/app/models/spree/gateway.rb +1 -0
- data/app/models/spree/gateway/bogus.rb +3 -2
- data/app/models/spree/image.rb +13 -0
- data/app/models/spree/image/configuration/active_storage.rb +3 -3
- data/app/models/spree/inventory_unit.rb +1 -1
- data/app/models/spree/line_item.rb +3 -2
- data/app/models/spree/order.rb +72 -28
- data/app/models/spree/order/checkout.rb +10 -0
- data/app/models/spree/order/store_credit.rb +14 -35
- data/app/models/spree/order_contents.rb +22 -118
- data/app/models/spree/order_inventory.rb +6 -2
- data/app/models/spree/order_merger.rb +1 -3
- data/app/models/spree/order_promotion.rb +10 -0
- data/app/models/spree/order_updater.rb +11 -8
- data/app/models/spree/payment.rb +9 -3
- data/app/models/spree/payment/processing.rb +4 -4
- data/app/models/spree/preferences/store.rb +3 -3
- data/app/models/spree/product.rb +32 -0
- data/app/models/spree/product/scopes.rb +13 -34
- data/app/models/spree/product_property.rb +1 -1
- data/app/models/spree/promotion.rb +2 -0
- data/app/models/spree/promotion/actions/create_adjustment.rb +6 -1
- data/app/models/spree/promotion/actions/create_item_adjustments.rb +10 -2
- data/app/models/spree/promotion/actions/create_line_items.rb +3 -2
- data/app/models/spree/promotion/actions/free_shipping.rb +1 -0
- data/app/models/spree/promotion/rules/item_total.rb +2 -2
- data/app/models/spree/promotion_handler/coupon.rb +10 -6
- data/app/models/spree/promotion_handler/page.rb +1 -1
- data/app/models/spree/promotion_handler/promotion_duplicator.rb +4 -4
- data/app/models/spree/refund.rb +1 -1
- data/app/models/spree/reimbursement/reimbursement_type_engine.rb +1 -0
- data/app/models/spree/reimbursement_tax_calculator.rb +2 -2
- data/app/models/spree/return_item.rb +7 -4
- data/app/models/spree/return_item/eligibility_validator/default.rb +6 -6
- data/app/models/spree/return_item/exchange_variant_eligibility/same_product.rb +1 -1
- data/app/models/spree/shipment.rb +27 -34
- data/app/models/spree/shipping_method.rb +2 -0
- data/app/models/spree/shipping_rate.rb +31 -16
- data/app/models/spree/stock/adjuster.rb +1 -0
- data/app/models/spree/stock/estimator.rb +2 -0
- data/app/models/spree/stock/inventory_unit_builder.rb +5 -5
- data/app/models/spree/stock/packer.rb +1 -0
- data/app/models/spree/stock/quantifier.rb +16 -4
- data/app/models/spree/stock_item.rb +1 -0
- data/app/models/spree/stock_location.rb +1 -1
- data/app/models/spree/stock_movement.rb +1 -0
- data/app/models/spree/stock_transfer.rb +1 -1
- data/app/models/spree/store_credit.rb +5 -10
- data/app/models/spree/tax_rate.rb +3 -0
- data/app/models/spree/taxon.rb +2 -2
- data/app/models/spree/taxon_image.rb +18 -0
- data/app/models/spree/{taxon_icon → taxon_image}/configuration/active_storage.rb +2 -2
- data/app/models/spree/{taxon_icon → taxon_image}/configuration/paperclip.rb +1 -1
- data/app/models/spree/variant.rb +28 -2
- data/app/models/spree/zone.rb +5 -5
- data/app/paginators/spree/shared/paginate.rb +19 -0
- data/app/services/spree/cart/add_item.rb +43 -0
- data/app/services/spree/cart/create.rb +21 -0
- data/app/services/spree/cart/recalculate.rb +32 -0
- data/app/services/spree/cart/remove_item.rb +37 -0
- data/app/services/spree/cart/remove_line_item.rb +16 -0
- data/app/services/spree/cart/set_quantity.rb +22 -0
- data/app/services/spree/cart/update.rb +37 -0
- data/app/services/spree/checkout/add_store_credit.rb +51 -0
- data/app/services/spree/checkout/advance.rb +18 -0
- data/app/services/spree/checkout/complete.rb +23 -0
- data/app/services/spree/checkout/get_shipping_rates.rb +48 -0
- data/app/services/spree/checkout/next.rb +13 -0
- data/app/services/spree/checkout/remove_store_credit.rb +17 -0
- data/app/services/spree/checkout/update.rb +13 -0
- data/app/services/spree/compare_line_items.rb +21 -0
- data/app/services/spree/generate_token.rb +20 -0
- data/app/sorters/spree/products/sort.rb +58 -0
- data/config/locales/en.yml +20 -1
- data/db/default/spree/countries.rb +1 -1
- data/db/default/spree/default_reimbursement_type.rb +1 -1
- data/db/default/spree/roles.rb +2 -2
- data/db/default/spree/states.rb +2 -1
- data/db/default/spree/stores.rb +1 -1
- data/db/default/spree/zones.rb +5 -6
- data/db/migrate/20120831092320_spree_one_two.rb +36 -36
- data/db/migrate/20120831092359_spree_promo_one_two.rb +1 -1
- data/db/migrate/20130211190146_create_spree_stock_items.rb +1 -1
- data/db/migrate/20130211191120_create_spree_stock_locations.rb +1 -1
- data/db/migrate/20130301162924_create_shipping_method_categories.rb +1 -1
- data/db/migrate/20130304162240_create_spree_shipping_rates.rb +1 -1
- data/db/migrate/20130305143310_create_stock_movements.rb +1 -1
- data/db/migrate/20130418125341_create_spree_stock_transfers.rb +1 -1
- data/db/migrate/20140205120320_create_spree_payment_capture_events.rb +1 -1
- data/db/migrate/20140309023735_migrate_old_preferences.rb +5 -1
- data/db/migrate/20140309024355_create_spree_stores.rb +1 -1
- data/db/migrate/20140625214618_create_spree_refunds.rb +1 -1
- data/db/migrate/20140702140656_create_spree_return_authorization_inventory_unit.rb +1 -1
- data/db/migrate/20140713140455_create_spree_return_authorization_reasons.rb +1 -1
- data/db/migrate/20140713140527_create_spree_refund_reasons.rb +1 -1
- data/db/migrate/20140715182625_create_spree_promotion_categories.rb +1 -1
- data/db/migrate/20140718133010_create_spree_customer_returns.rb +1 -1
- data/db/migrate/20140725131539_create_spree_reimbursements.rb +1 -1
- data/db/migrate/20140731150017_create_spree_reimbursement_types.rb +1 -1
- data/db/migrate/20150118210639_create_spree_store_credits.rb +1 -1
- data/db/migrate/20150118211500_create_spree_store_credit_categories.rb +1 -1
- data/db/migrate/20150118212051_create_spree_store_credit_events.rb +1 -1
- data/db/migrate/20150118212101_create_spree_store_credit_types.rb +1 -1
- data/db/migrate/20150309161154_ensure_payments_have_numbers.rb +6 -2
- data/db/migrate/20180613080857_rename_guest_token_to_token_in_orders.rb +5 -0
- data/db/migrate/20180915160001_add_timestamps_to_spree_prices.rb +12 -0
- data/db/migrate/20181024100754_add_deleted_at_to_spree_credit_cards.rb +6 -0
- data/lib/generators/spree/custom_user/custom_user_generator.rb +1 -3
- data/lib/generators/spree/dummy/dummy_generator.rb +30 -33
- data/lib/generators/spree/dummy/templates/rails/database.yml +6 -1
- data/lib/generators/spree/dummy/templates/rails/test.rb +2 -0
- data/lib/generators/spree/dummy_model/dummy_model_generator.rb +1 -1
- data/lib/generators/spree/install/install_generator.rb +2 -1
- data/lib/spree/core.rb +2 -4
- data/lib/spree/core/controller_helpers/auth.rb +15 -5
- data/lib/spree/core/controller_helpers/common.rb +0 -11
- data/lib/spree/core/controller_helpers/order.rb +6 -6
- data/lib/spree/core/controller_helpers/respond_with.rb +3 -1
- data/lib/spree/core/controller_helpers/strong_parameters.rb +1 -0
- data/lib/spree/core/engine.rb +9 -3
- data/lib/spree/core/importer/order.rb +8 -12
- data/lib/spree/core/product_duplicator.rb +6 -1
- data/lib/spree/core/product_filters.rb +15 -14
- data/lib/spree/core/query_filters.rb +11 -0
- data/lib/spree/core/query_filters/comparable.rb +46 -0
- data/lib/spree/core/query_filters/date.rb +8 -0
- data/lib/spree/core/query_filters/number.rb +8 -0
- data/lib/spree/core/query_filters/text.rb +32 -0
- data/lib/spree/core/token_generator.rb +2 -2
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/i18n.rb +1 -1
- data/lib/spree/migrations.rb +2 -0
- data/lib/spree/money.rb +12 -12
- data/lib/spree/permitted_attributes.rb +11 -6
- data/lib/spree/service_module.rb +98 -0
- data/lib/spree/testing_support/capybara_config.rb +20 -0
- data/lib/spree/testing_support/capybara_ext.rb +6 -3
- data/lib/spree/testing_support/factories.rb +1 -1
- data/lib/spree/testing_support/factories/address_factory.rb +10 -9
- data/lib/spree/testing_support/factories/adjustment_factory.rb +8 -6
- data/lib/spree/testing_support/factories/country_factory.rb +4 -4
- data/lib/spree/testing_support/factories/credit_card_factory.rb +7 -5
- data/lib/spree/testing_support/factories/customer_return_factory.rb +1 -1
- data/lib/spree/testing_support/factories/image_factory.rb +7 -1
- data/lib/spree/testing_support/factories/inventory_unit_factory.rb +5 -4
- data/lib/spree/testing_support/factories/line_item_factory.rb +3 -2
- data/lib/spree/testing_support/factories/options_factory.rb +2 -3
- data/lib/spree/testing_support/factories/order_factory.rb +16 -12
- data/lib/spree/testing_support/factories/order_promotion_factory.rb +6 -0
- data/lib/spree/testing_support/factories/payment_factory.rb +9 -7
- data/lib/spree/testing_support/factories/payment_method_factory.rb +8 -8
- data/lib/spree/testing_support/factories/price_factory.rb +2 -2
- data/lib/spree/testing_support/factories/product_factory.rb +10 -10
- data/lib/spree/testing_support/factories/promotion_category_factory.rb +1 -1
- data/lib/spree/testing_support/factories/promotion_factory.rb +14 -4
- data/lib/spree/testing_support/factories/property_factory.rb +2 -2
- data/lib/spree/testing_support/factories/prototype_factory.rb +3 -3
- data/lib/spree/testing_support/factories/refund_factory.rb +6 -6
- data/lib/spree/testing_support/factories/reimbursement_factory.rb +1 -1
- data/lib/spree/testing_support/factories/reimbursement_type_factory.rb +2 -2
- data/lib/spree/testing_support/factories/return_authorization_factory.rb +4 -3
- data/lib/spree/testing_support/factories/role_factory.rb +1 -1
- data/lib/spree/testing_support/factories/shipment_factory.rb +3 -3
- data/lib/spree/testing_support/factories/shipping_method_factory.rb +4 -4
- data/lib/spree/testing_support/factories/state_factory.rb +2 -5
- data/lib/spree/testing_support/factories/stock_factory.rb +3 -3
- data/lib/spree/testing_support/factories/stock_item_factory.rb +1 -1
- data/lib/spree/testing_support/factories/stock_location_factory.rb +7 -7
- data/lib/spree/testing_support/factories/stock_movement_factory.rb +3 -3
- data/lib/spree/testing_support/factories/store_credit_category_factory.rb +2 -2
- data/lib/spree/testing_support/factories/store_credit_type_factory.rb +1 -1
- data/lib/spree/testing_support/factories/store_factory.rb +5 -4
- data/lib/spree/testing_support/factories/tax_rate_factory.rb +2 -1
- data/lib/spree/testing_support/factories/user_factory.rb +4 -4
- data/lib/spree/testing_support/factories/variant_factory.rb +15 -15
- data/lib/spree/testing_support/factories/zone_factory.rb +3 -3
- data/lib/spree/testing_support/image_helpers.rb +19 -0
- data/lib/tasks/core.rake +21 -4
- data/lib/tasks/exchanges.rake +4 -4
- data/spree_core.gemspec +3 -3
- data/vendor/assets/javascripts/fetch.umd.js +531 -0
- data/vendor/assets/javascripts/polyfill.min.js +1 -0
- metadata +50 -17
- data/app/assets/javascripts/spree.js.coffee +0 -59
- data/app/models/spree/taxon_icon.rb +0 -5
- data/lib/generators/spree/dummy/templates/initializers/custom_user.rb +0 -1
- data/lib/spree/core/environment.rb +0 -15
- data/lib/spree/core/environment/calculators.rb +0 -11
- data/lib/spree/core/environment_extension.rb +0 -28
- data/lib/spree/core/validators/email.rb +0 -8
- data/lib/spree/promo/environment.rb +0 -9
@@ -5,7 +5,7 @@ class CreateSpreeRefundReasons < ActiveRecord::Migration[4.2]
|
|
5
5
|
t.boolean :active, default: true
|
6
6
|
t.boolean :mutable, default: true
|
7
7
|
|
8
|
-
t.timestamps null: false
|
8
|
+
t.timestamps null: false, precision: 6
|
9
9
|
end
|
10
10
|
|
11
11
|
add_column :spree_refunds, :refund_reason_id, :integer
|
@@ -2,7 +2,7 @@ class CreateSpreePromotionCategories < ActiveRecord::Migration[4.2]
|
|
2
2
|
def change
|
3
3
|
create_table :spree_promotion_categories do |t|
|
4
4
|
t.string :name
|
5
|
-
t.timestamps null: false
|
5
|
+
t.timestamps null: false, precision: 6
|
6
6
|
end
|
7
7
|
|
8
8
|
add_column :spree_promotions, :promotion_category_id, :integer
|
@@ -7,7 +7,7 @@ class CreateSpreeReimbursements < ActiveRecord::Migration[4.2]
|
|
7
7
|
t.integer :order_id
|
8
8
|
t.decimal :total, precision: 10, scale: 2
|
9
9
|
|
10
|
-
t.timestamps null: false
|
10
|
+
t.timestamps null: false, precision: 6
|
11
11
|
end
|
12
12
|
|
13
13
|
add_index :spree_reimbursements, :customer_return_id
|
@@ -13,7 +13,7 @@ class CreateSpreeStoreCredits < ActiveRecord::Migration[4.2]
|
|
13
13
|
t.integer :originator_id
|
14
14
|
t.string :originator_type
|
15
15
|
t.integer :type_id
|
16
|
-
t.timestamps null: false
|
16
|
+
t.timestamps null: false, precision: 6
|
17
17
|
end
|
18
18
|
|
19
19
|
add_index :spree_store_credits, :deleted_at
|
@@ -9,7 +9,7 @@ class CreateSpreeStoreCreditEvents < ActiveRecord::Migration[4.2]
|
|
9
9
|
t.integer :originator_id
|
10
10
|
t.string :originator_type
|
11
11
|
t.datetime :deleted_at
|
12
|
-
t.timestamps null: false
|
12
|
+
t.timestamps null: false, precision: 6
|
13
13
|
end
|
14
14
|
add_index :spree_store_credit_events, :store_credit_id
|
15
15
|
add_index :spree_store_credit_events, [:originator_id, :originator_type], name: :spree_store_credit_events_originator
|
@@ -3,7 +3,7 @@ class CreateSpreeStoreCreditTypes < ActiveRecord::Migration[4.2]
|
|
3
3
|
create_table :spree_store_credit_types do |t|
|
4
4
|
t.string :name
|
5
5
|
t.integer :priority
|
6
|
-
t.timestamps null: false
|
6
|
+
t.timestamps null: false, precision: 6
|
7
7
|
end
|
8
8
|
add_index :spree_store_credit_types, :priority
|
9
9
|
end
|
@@ -2,8 +2,12 @@ class EnsurePaymentsHaveNumbers < ActiveRecord::Migration[4.2]
|
|
2
2
|
def change
|
3
3
|
add_index :spree_payments, :number unless index_exists?(:spree_payments, :number)
|
4
4
|
Spree::Payment.where(number: nil).find_each do |payment|
|
5
|
-
|
6
|
-
|
5
|
+
begin
|
6
|
+
payment.save! # to generate a new number we need to save the record
|
7
|
+
rescue ActiveRecord::RecordNotSaved
|
8
|
+
Rails.logger.error("Payment with ID = #{payment.id} couldn't be saved")
|
9
|
+
Rails.logger.error(payment.errors.full_messages.to_sentence)
|
10
|
+
end
|
7
11
|
end
|
8
12
|
end
|
9
13
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class AddTimestampsToSpreePrices < ActiveRecord::Migration[5.2]
|
2
|
+
def up
|
3
|
+
add_timestamps :spree_prices, default: Time.current
|
4
|
+
change_column_default :spree_prices, :created_at, nil
|
5
|
+
change_column_default :spree_prices, :updated_at, nil
|
6
|
+
end
|
7
|
+
|
8
|
+
def down
|
9
|
+
remove_column :spree_prices, :created_at
|
10
|
+
remove_column :spree_prices, :updated_at
|
11
|
+
end
|
12
|
+
end
|
@@ -7,17 +7,15 @@ module Spree
|
|
7
7
|
|
8
8
|
def self.source_paths
|
9
9
|
paths = superclass.source_paths
|
10
|
-
paths << File.expand_path('
|
10
|
+
paths << File.expand_path('templates', __dir__)
|
11
11
|
paths.flatten
|
12
12
|
end
|
13
13
|
|
14
14
|
def check_for_constant
|
15
|
-
|
16
15
|
klass
|
17
16
|
rescue NameError
|
18
17
|
@shell.say "Couldn't find #{class_name}. Are you sure that this class exists within your application and is loaded?", :red
|
19
18
|
exit(1)
|
20
|
-
|
21
19
|
end
|
22
20
|
|
23
21
|
def generate
|
@@ -1,17 +1,17 @@
|
|
1
|
-
require
|
1
|
+
require 'rails/generators/rails/app/app_generator'
|
2
2
|
require 'active_support/core_ext/hash'
|
3
3
|
require 'spree/core/version'
|
4
4
|
|
5
5
|
module Spree
|
6
6
|
class DummyGenerator < Rails::Generators::Base
|
7
|
-
desc
|
7
|
+
desc 'Creates blank Rails application, installs Spree and all sample data'
|
8
8
|
|
9
9
|
class_option :lib_name, default: ''
|
10
10
|
class_option :database, default: ''
|
11
11
|
|
12
12
|
def self.source_paths
|
13
|
-
paths =
|
14
|
-
paths << File.expand_path('
|
13
|
+
paths = superclass.source_paths
|
14
|
+
paths << File.expand_path('templates', __dir__)
|
15
15
|
paths.flatten
|
16
16
|
end
|
17
17
|
|
@@ -39,23 +39,22 @@ module Spree
|
|
39
39
|
opts[:skip_test] = true
|
40
40
|
opts[:skip_yarn] = true
|
41
41
|
|
42
|
-
puts
|
42
|
+
puts 'Generating dummy Rails application...'
|
43
43
|
invoke Rails::Generators::AppGenerator,
|
44
|
-
[
|
44
|
+
[File.expand_path(dummy_path, destination_root)], opts
|
45
45
|
end
|
46
46
|
|
47
47
|
def test_dummy_config
|
48
48
|
@lib_name = options[:lib_name]
|
49
49
|
@database = options[:database]
|
50
50
|
|
51
|
-
template
|
52
|
-
template
|
53
|
-
template
|
54
|
-
template
|
55
|
-
template
|
56
|
-
template
|
57
|
-
template
|
58
|
-
template "initializers/devise.rb", "#{dummy_path}/config/initializers/devise.rb", force: true
|
51
|
+
template 'rails/database.yml', "#{dummy_path}/config/database.yml", force: true
|
52
|
+
template 'rails/boot.rb', "#{dummy_path}/config/boot.rb", force: true
|
53
|
+
template 'rails/application.rb', "#{dummy_path}/config/application.rb", force: true
|
54
|
+
template 'rails/routes.rb', "#{dummy_path}/config/routes.rb", force: true
|
55
|
+
template 'rails/test.rb', "#{dummy_path}/config/environments/test.rb", force: true
|
56
|
+
template 'rails/script/rails', "#{dummy_path}/spec/dummy/script/rails", force: true
|
57
|
+
template 'initializers/devise.rb', "#{dummy_path}/config/initializers/devise.rb", force: true
|
59
58
|
end
|
60
59
|
|
61
60
|
def test_dummy_inject_extension_requirements
|
@@ -70,20 +69,19 @@ module Spree
|
|
70
69
|
|
71
70
|
def test_dummy_clean
|
72
71
|
inside dummy_path do
|
73
|
-
remove_file
|
74
|
-
remove_file
|
75
|
-
remove_file
|
76
|
-
remove_file
|
77
|
-
remove_file
|
78
|
-
remove_file
|
79
|
-
remove_file
|
80
|
-
remove_file
|
81
|
-
remove_file
|
82
|
-
remove_file
|
83
|
-
remove_file
|
84
|
-
remove_file
|
72
|
+
remove_file '.gitignore'
|
73
|
+
remove_file 'doc'
|
74
|
+
remove_file 'Gemfile'
|
75
|
+
remove_file 'lib/tasks'
|
76
|
+
remove_file 'app/assets/images/rails.png'
|
77
|
+
remove_file 'app/assets/javascripts/application.js'
|
78
|
+
remove_file 'public/index.html'
|
79
|
+
remove_file 'public/robots.txt'
|
80
|
+
remove_file 'README'
|
81
|
+
remove_file 'test'
|
82
|
+
remove_file 'vendor'
|
83
|
+
remove_file 'spec'
|
85
84
|
end
|
86
|
-
|
87
85
|
end
|
88
86
|
|
89
87
|
def inject_content_security_policy
|
@@ -94,8 +92,8 @@ module Spree
|
|
94
92
|
end
|
95
93
|
end
|
96
94
|
|
97
|
-
|
98
|
-
|
95
|
+
attr_reader :lib_name
|
96
|
+
attr_reader :database
|
99
97
|
|
100
98
|
protected
|
101
99
|
|
@@ -119,15 +117,14 @@ end
|
|
119
117
|
|
120
118
|
def application_definition
|
121
119
|
@application_definition ||= begin
|
122
|
-
|
123
120
|
dummy_application_path = File.expand_path("#{dummy_path}/config/application.rb", destination_root)
|
124
|
-
unless options[:pretend] || !File.
|
121
|
+
unless options[:pretend] || !File.exist?(dummy_application_path)
|
125
122
|
contents = File.read(dummy_application_path)
|
126
123
|
contents[(contents.index("module #{module_name}"))..-1]
|
127
124
|
end
|
128
125
|
end
|
129
126
|
end
|
130
|
-
alias
|
127
|
+
alias store_application_definition! application_definition
|
131
128
|
|
132
129
|
def camelized
|
133
130
|
@camelized ||= name.gsub(/\W/, '_').squeeze('_').camelize
|
@@ -138,7 +135,7 @@ end
|
|
138
135
|
end
|
139
136
|
|
140
137
|
def gemfile_path
|
141
|
-
core_gems = [
|
138
|
+
core_gems = ['spree/core', 'spree/api', 'spree/backend', 'spree/frontend']
|
142
139
|
|
143
140
|
if core_gems.include?(lib_name)
|
144
141
|
'../../../../../Gemfile'
|
@@ -6,6 +6,7 @@ end %>
|
|
6
6
|
end %>
|
7
7
|
<% db_password = ENV['DB_PASSWORD'] %>
|
8
8
|
<% db_username = ENV['DB_USERNAME'] %>
|
9
|
+
<% db_host = ENV['DB_HOST'] %>
|
9
10
|
<% case ENV['DB']
|
10
11
|
when 'sqlite' %>
|
11
12
|
development:
|
@@ -28,6 +29,11 @@ mysql: &mysql
|
|
28
29
|
<% unless db_password.blank? %>
|
29
30
|
password: <%= db_password %>
|
30
31
|
<% end %>
|
32
|
+
<% unless db_host.blank? %>
|
33
|
+
host: <%= db_host %>
|
34
|
+
<% end %>
|
35
|
+
reconnect: true
|
36
|
+
pool: 5
|
31
37
|
|
32
38
|
development:
|
33
39
|
<<: *mysql
|
@@ -39,7 +45,6 @@ production:
|
|
39
45
|
<<: *mysql
|
40
46
|
database: <%= database_prefix %><%= lib_name %>_spree_production
|
41
47
|
<% when 'postgres' %>
|
42
|
-
<% db_host = ENV['DB_HOST'] %>
|
43
48
|
postgres: &postgres
|
44
49
|
adapter: postgresql
|
45
50
|
<% unless db_username.blank? %>
|
@@ -22,7 +22,7 @@ module Spree
|
|
22
22
|
paths = superclass.source_paths
|
23
23
|
paths << File.expand_path('../templates', "../../#{__FILE__}")
|
24
24
|
paths << File.expand_path('../templates', "../#{__FILE__}")
|
25
|
-
paths << File.expand_path('
|
25
|
+
paths << File.expand_path('templates', __dir__)
|
26
26
|
paths.flatten
|
27
27
|
end
|
28
28
|
|
@@ -44,6 +44,7 @@ module Spree
|
|
44
44
|
|
45
45
|
def additional_tweaks
|
46
46
|
return unless File.exist? 'public/robots.txt'
|
47
|
+
|
47
48
|
append_file 'public/robots.txt', <<-ROBOTS.strip_heredoc
|
48
49
|
User-agent: *
|
49
50
|
Disallow: /checkout
|
data/lib/spree/core.rb
CHANGED
@@ -70,11 +70,7 @@ end
|
|
70
70
|
|
71
71
|
require 'spree/core/version'
|
72
72
|
|
73
|
-
require 'spree/core/environment_extension'
|
74
|
-
require 'spree/core/environment/calculators'
|
75
|
-
require 'spree/core/environment'
|
76
73
|
require 'spree/core/number_generator'
|
77
|
-
require 'spree/promo/environment'
|
78
74
|
require 'spree/migrations'
|
79
75
|
require 'spree/core/engine'
|
80
76
|
|
@@ -82,8 +78,10 @@ require 'spree/i18n'
|
|
82
78
|
require 'spree/localized_number'
|
83
79
|
require 'spree/money'
|
84
80
|
require 'spree/permitted_attributes'
|
81
|
+
require 'spree/service_module'
|
85
82
|
|
86
83
|
require 'spree/core/importer'
|
84
|
+
require 'spree/core/query_filters'
|
87
85
|
require 'spree/core/product_duplicator'
|
88
86
|
require 'spree/core/controller_helpers/auth'
|
89
87
|
require 'spree/core/controller_helpers/common'
|
@@ -6,7 +6,7 @@ module Spree
|
|
6
6
|
include Spree::Core::TokenGenerator
|
7
7
|
|
8
8
|
included do
|
9
|
-
before_action :
|
9
|
+
before_action :set_token
|
10
10
|
helper_method :try_spree_current_user
|
11
11
|
|
12
12
|
rescue_from CanCan::AccessDenied do |_exception|
|
@@ -24,10 +24,20 @@ module Spree
|
|
24
24
|
session['spree_user_return_to'] = nil
|
25
25
|
end
|
26
26
|
|
27
|
-
def
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
def set_token
|
28
|
+
cookies.permanent.signed[:token] ||= cookies.signed[:guest_token]
|
29
|
+
cookies.permanent.signed[:token] ||= {
|
30
|
+
value: generate_token,
|
31
|
+
httponly: true
|
32
|
+
}
|
33
|
+
cookies.permanent.signed[:guest_token] ||= cookies.permanent.signed[:token]
|
34
|
+
end
|
35
|
+
|
36
|
+
def current_oauth_token
|
37
|
+
user = try_spree_current_user
|
38
|
+
return unless user
|
39
|
+
|
40
|
+
@current_oauth_token ||= Doorkeeper::AccessToken.active_for(user).last || Doorkeeper::AccessToken.create!(resource_owner_id: user.id)
|
31
41
|
end
|
32
42
|
|
33
43
|
def store_location
|
@@ -40,17 +40,6 @@ module Spree
|
|
40
40
|
current_store.seo_title
|
41
41
|
end
|
42
42
|
|
43
|
-
def render_404(_exception = nil)
|
44
|
-
ActiveSupport::Deprecation.warn(<<-EOS, caller)
|
45
|
-
#render_404 will be removed in Spree 3.6
|
46
|
-
You should switch to 404 handled by rails
|
47
|
-
EOS
|
48
|
-
respond_to do |type|
|
49
|
-
type.html { render status: :not_found, file: "#{::Rails.root}/public/404", formats: [:html], layout: nil }
|
50
|
-
type.all { head :not_found }
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
43
|
private
|
55
44
|
|
56
45
|
def set_user_language
|