solidus_core 2.11.10 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of solidus_core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spree.js.erb +0 -51
- data/app/helpers/spree/store_helper.rb +0 -11
- data/app/mailers/spree/carton_mailer.rb +1 -5
- data/app/models/concerns/spree/adjustment_source.rb +0 -15
- data/app/models/concerns/spree/calculated_adjustments.rb +0 -18
- data/app/models/concerns/spree/soft_deletable.rb +2 -4
- data/app/models/concerns/spree/user_address_book.rb +0 -37
- data/app/models/concerns/spree/user_methods.rb +2 -11
- data/app/models/spree/ability.rb +0 -37
- data/app/models/spree/address/name.rb +2 -20
- data/app/models/spree/address.rb +8 -186
- data/app/models/spree/adjustment.rb +0 -28
- data/app/models/spree/base.rb +0 -53
- data/app/models/spree/calculator/flexi_rate.rb +0 -5
- data/app/models/spree/calculator.rb +0 -7
- data/app/models/spree/country.rb +1 -6
- data/app/models/spree/credit_card.rb +0 -27
- data/app/models/spree/customer_return.rb +1 -4
- data/app/models/spree/image.rb +0 -7
- data/app/models/spree/inventory_unit.rb +0 -21
- data/app/models/spree/line_item.rb +2 -45
- data/app/models/spree/order.rb +4 -137
- data/app/models/spree/order_cancellations.rb +4 -24
- data/app/models/spree/order_updater.rb +2 -11
- data/app/models/spree/payment/cancellation.rb +1 -1
- data/app/models/spree/payment.rb +0 -3
- data/app/models/spree/payment_create.rb +1 -13
- data/app/models/spree/payment_method/credit_card.rb +1 -3
- data/app/models/spree/payment_method.rb +2 -103
- data/app/models/spree/product/scopes.rb +0 -27
- data/app/models/spree/product.rb +0 -40
- data/app/models/spree/promotion/actions/create_adjustment.rb +0 -3
- data/app/models/spree/promotion/actions/create_item_adjustments.rb +0 -3
- data/app/models/spree/promotion/actions/create_quantity_adjustments.rb +0 -3
- data/app/models/spree/promotion/rules/taxon.rb +2 -15
- data/app/models/spree/promotion.rb +2 -6
- data/app/models/spree/promotion_action.rb +2 -9
- data/app/models/spree/promotion_code/batch_builder.rb +0 -14
- data/app/models/spree/refund.rb +0 -52
- data/app/models/spree/reimbursement.rb +3 -41
- data/app/models/spree/reimbursement_performer.rb +2 -8
- data/app/models/spree/reimbursement_type/credit.rb +1 -4
- data/app/models/spree/reimbursement_type/reimbursement_helpers.rb +1 -2
- data/app/models/spree/reimbursement_type/store_credit.rb +1 -4
- data/app/models/spree/return_authorization.rb +1 -4
- data/app/models/spree/return_item.rb +3 -22
- data/app/models/spree/shipment.rb +1 -54
- data/app/models/spree/shipping_method.rb +0 -25
- data/app/models/spree/shipping_rate.rb +0 -2
- data/app/models/spree/state.rb +0 -4
- data/app/models/spree/stock/simple_coordinator.rb +6 -15
- data/app/models/spree/stock/splitter/base.rb +2 -7
- data/app/models/spree/stock_item.rb +1 -7
- data/app/models/spree/store.rb +0 -12
- data/app/models/spree/store_credit_category.rb +0 -32
- data/app/models/spree/tax_calculator/shipping_rate.rb +1 -12
- data/app/models/spree/tax_rate.rb +0 -27
- data/app/models/spree/taxon/active_storage_attachment.rb +0 -5
- data/app/models/spree/taxon/paperclip_attachment.rb +0 -5
- data/app/models/spree/taxon.rb +0 -11
- data/app/models/spree/user_address.rb +0 -5
- data/app/models/spree/variant.rb +2 -46
- data/config/locales/en.yml +0 -8
- data/db/migrate/20180416083007_add_apply_to_all_to_variant_property_rule.rb +1 -1
- data/lib/generators/solidus/install/install_generator.rb +12 -1
- data/lib/generators/solidus/install/templates/config/initializers/spree.rb.tt +3 -39
- data/lib/generators/spree/dummy/dummy_generator.rb +2 -1
- data/lib/generators/spree/dummy/templates/rails/database.yml +6 -1
- data/lib/generators/spree/dummy/templates/rails/storage.yml +3 -0
- data/lib/generators/spree/dummy/templates/rails/test.rb +2 -0
- data/lib/spree/app_configuration.rb +6 -65
- data/lib/spree/core/class_constantizer.rb +2 -0
- data/lib/spree/core/controller_helpers/auth.rb +1 -14
- data/lib/spree/core/controller_helpers/order.rb +2 -22
- data/lib/spree/core/controller_helpers/payment_parameters.rb +0 -54
- data/lib/spree/core/controller_helpers/pricing.rb +0 -8
- data/lib/spree/core/controller_helpers/strong_parameters.rb +0 -4
- data/lib/spree/core/engine.rb +0 -35
- data/lib/spree/core/environment_extension.rb +0 -9
- data/lib/spree/core/product_filters.rb +0 -40
- data/lib/spree/core/role_configuration.rb +0 -14
- data/lib/spree/core/search/base.rb +0 -26
- data/lib/spree/core/state_machines.rb +2 -11
- data/lib/spree/core/validators/email.rb +1 -1
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/core.rb +9 -8
- data/lib/spree/deprecation.rb +1 -1
- data/lib/spree/event/configuration.rb +0 -5
- data/lib/spree/event/subscriber.rb +0 -18
- data/lib/spree/event/subscriber_registry.rb +3 -1
- data/lib/spree/event.rb +0 -31
- data/lib/spree/i18n.rb +0 -22
- data/lib/spree/money.rb +3 -18
- data/lib/spree/permitted_attributes.rb +9 -54
- data/lib/spree/testing_support/capybara_ext.rb +0 -30
- data/lib/spree/testing_support/controller_requests.rb +0 -82
- data/lib/spree/testing_support/dummy_app/migrations.rb +0 -3
- data/lib/spree/testing_support/dummy_app.rb +7 -14
- data/lib/spree/testing_support/factories/order_factory.rb +0 -1
- data/lib/spree/testing_support/factories/refund_factory.rb +0 -1
- data/lib/spree/testing_support/order_walkthrough.rb +0 -3
- data/lib/spree/testing_support/preferences.rb +0 -25
- data/lib/tasks/upgrade.rake +7 -5
- data/solidus_core.gemspec +2 -5
- metadata +8 -49
- data/app/mailers/spree/test_mailer.rb +0 -13
- data/app/models/concerns/spree/user_payment_source.rb +0 -26
- data/app/models/spree/calculator/free_shipping.rb +0 -22
- data/app/models/spree/calculator/percent_per_item.rb +0 -51
- data/app/models/spree/calculator/price_sack.rb +0 -28
- data/app/models/spree/gateway/bogus.rb +0 -13
- data/app/models/spree/gateway/bogus_simple.rb +0 -13
- data/app/models/spree/gateway.rb +0 -14
- data/app/models/spree/order/checkout.rb +0 -244
- data/app/models/spree/order_capturing.rb +0 -50
- data/app/models/spree/promotion_handler/free_shipping.rb +0 -9
- data/lib/generators/spree/install/install_generator.rb +0 -15
- data/lib/solidus/migrations/rename_gateways.rb +0 -41
- data/lib/spree/core/current_store.rb +0 -24
- data/lib/spree/paranoia_deprecations.rb +0 -41
- data/lib/spree/promo/environment.rb +0 -12
- data/lib/spree/testing_support/bar_ability.rb +0 -19
- data/lib/tasks/core.rake +0 -104
- data/lib/tasks/email.rake +0 -12
- data/lib/tasks/migrations/copy_order_bill_address_to_credit_card.rake +0 -119
- data/lib/tasks/migrations/migrate_address_names.rake +0 -158
- data/lib/tasks/migrations/migrate_default_billing_addresses_to_address_book.rake +0 -26
- data/lib/tasks/migrations/migrate_shipping_rate_taxes.rake +0 -22
- data/lib/tasks/migrations/migrate_user_addresses.rake +0 -34
- data/lib/tasks/migrations/rename_gateways.rake +0 -23
- data/lib/tasks/order_capturing.rake +0 -27
data/lib/spree/core/engine.rb
CHANGED
@@ -56,41 +56,6 @@ module Spree
|
|
56
56
|
end
|
57
57
|
|
58
58
|
config.after_initialize do
|
59
|
-
if Spree::Config.raise_with_invalid_currency == true
|
60
|
-
Spree::Deprecation.warn(
|
61
|
-
'Spree::Config.raise_with_invalid_currency set to true is ' \
|
62
|
-
'deprecated. Please note that by switching this value, ' \
|
63
|
-
'Spree::LineItem::CurrencyMismatch will not be raised anymore.',
|
64
|
-
caller
|
65
|
-
)
|
66
|
-
end
|
67
|
-
if Spree::Config.consider_actionless_promotion_active == true
|
68
|
-
Spree::Deprecation.warn(
|
69
|
-
'Spree::Config.consider_actionless_promotion_active set to true is ' \
|
70
|
-
'deprecated. Please note that by switching this value, ' \
|
71
|
-
'promotions with no actions will be considered active.',
|
72
|
-
caller
|
73
|
-
)
|
74
|
-
end
|
75
|
-
if Spree::Config.run_order_validations_on_order_updater != true
|
76
|
-
Spree::Deprecation.warn(
|
77
|
-
'Spree::Config.run_order_validations_on_order_updater set to false is ' \
|
78
|
-
'deprecated and will not be possibile in Solidus 3.0. Please switch this ' \
|
79
|
-
'value to true and check that everything works as expected.',
|
80
|
-
caller
|
81
|
-
)
|
82
|
-
end
|
83
|
-
|
84
|
-
if Spree::Config.use_legacy_address_state_validator != false
|
85
|
-
Spree::Deprecation.warn(<<~DEPRECATION.squish, caller)
|
86
|
-
Spree::Config.use_legacy_address_state_validator set to true has been
|
87
|
-
deprecated and will be removed in Solidus 3.0. The Spree::Address state
|
88
|
-
validation has been extracted into a configurable external class.
|
89
|
-
Switch Spree::Config.use_legacy_address_state_validator to false to start
|
90
|
-
using the external validation class.
|
91
|
-
DEPRECATION
|
92
|
-
end
|
93
|
-
|
94
59
|
# Load in mailer previews for apps to use in development.
|
95
60
|
# We need to make sure we call `Preview.all` before requiring our
|
96
61
|
# previews, otherwise any previews the app attempts to add need to be
|
@@ -22,15 +22,6 @@ module Spree
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
25
|
-
|
26
|
-
def add_class(name)
|
27
|
-
Spree::Deprecation.warn(
|
28
|
-
'This method is deprecated. ' \
|
29
|
-
"Please use `#{self.class}.add_class_set(#{name.inspect})` instead.",
|
30
|
-
caller,
|
31
|
-
)
|
32
|
-
singleton_class.send(:add_class_set, name)
|
33
|
-
end
|
34
25
|
end
|
35
26
|
end
|
36
27
|
end
|
@@ -153,46 +153,6 @@ module Spree
|
|
153
153
|
labels: brands.sort.map { |key| [key, key] }
|
154
154
|
}
|
155
155
|
end
|
156
|
-
|
157
|
-
# Provide filtering on the immediate children of a taxon
|
158
|
-
#
|
159
|
-
# This doesn't fit the pattern of the examples above, so there's a few changes.
|
160
|
-
# Firstly, it uses an existing scope which was not built for filtering - and so
|
161
|
-
# has no need of a conditions mapping, and secondly, it has a mapping of name
|
162
|
-
# to the argument type expected by the other scope.
|
163
|
-
#
|
164
|
-
# This technique is useful for filtering on objects (by passing ids) or with a
|
165
|
-
# scope that can be used directly (eg. testing only ever on a single property).
|
166
|
-
#
|
167
|
-
# This scope selects products in any of the active taxons or their children.
|
168
|
-
#
|
169
|
-
def self.taxons_below(taxon)
|
170
|
-
Spree::Deprecation.warn "taxons_below is deprecated in solidus_core. Please add it to your own application to continue using it."
|
171
|
-
return Spree::Core::ProductFilters.all_taxons if taxon.nil?
|
172
|
-
{
|
173
|
-
name: 'Taxons under ' + taxon.name,
|
174
|
-
scope: :taxons_id_in_tree_any,
|
175
|
-
labels: taxon.children.sort_by(&:position).map { |element| [element.name, element.id] },
|
176
|
-
conds: nil
|
177
|
-
}
|
178
|
-
end
|
179
|
-
|
180
|
-
# Filtering by the list of all taxons
|
181
|
-
#
|
182
|
-
# Similar idea as above, but we don't want the descendants' products, hence
|
183
|
-
# it uses one of the auto-generated scopes from Ransack.
|
184
|
-
#
|
185
|
-
# idea: expand the format to allow nesting of labels?
|
186
|
-
def self.all_taxons
|
187
|
-
Spree::Deprecation.warn "all_taxons is deprecated in solidus_core. Please add it to your own application to continue using it."
|
188
|
-
taxons = Spree::Taxonomy.all.flat_map { |element| [element.root] + element.root.descendants }
|
189
|
-
{
|
190
|
-
name: 'All taxons',
|
191
|
-
scope: :taxons_id_equals_any,
|
192
|
-
labels: taxons.sort_by(&:name).map { |element| [element.name, element.id] },
|
193
|
-
conds: nil # not needed
|
194
|
-
}
|
195
|
-
end
|
196
156
|
end
|
197
157
|
end
|
198
158
|
end
|
@@ -31,20 +31,6 @@ module Spree
|
|
31
31
|
|
32
32
|
attr_accessor :roles
|
33
33
|
|
34
|
-
class << self
|
35
|
-
def instance
|
36
|
-
Spree::Deprecation.warn "Spree::RoleConfiguration.instance is DEPRECATED use Spree::Config.roles instead"
|
37
|
-
Spree::Config.roles
|
38
|
-
end
|
39
|
-
|
40
|
-
# Yields the instance of the singleton, used for configuration
|
41
|
-
# @yieldparam instance [Spree::RoleConfiguration]
|
42
|
-
def configure
|
43
|
-
Spree::Deprecation.warn "Spree::RoleConfiguration.configure is deprecated. Call Spree::Config.roles.assign_permissions instead"
|
44
|
-
yield(Spree::Config.roles)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
34
|
# Given a CanCan::Ability, and a user, determine what permissions sets can
|
49
35
|
# be activated on the ability, then activate them.
|
50
36
|
#
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'spree/deprecation'
|
4
|
-
|
5
3
|
module Spree
|
6
4
|
module Core
|
7
5
|
module Search
|
@@ -16,17 +14,6 @@ module Spree
|
|
16
14
|
prepare(params)
|
17
15
|
end
|
18
16
|
|
19
|
-
def current_currency=(currency)
|
20
|
-
self.pricing_options = Spree::Config.pricing_options_class.new(
|
21
|
-
pricing_options.desired_attributes.merge(currency: currency)
|
22
|
-
)
|
23
|
-
end
|
24
|
-
|
25
|
-
def current_currency
|
26
|
-
pricing_options.currency
|
27
|
-
end
|
28
|
-
deprecate :current_currency, :current_currency=, deprecator: Spree::Deprecation
|
29
|
-
|
30
17
|
def retrieve_products
|
31
18
|
@products = get_base_scope
|
32
19
|
curr_page = @properties[:page] || 1
|
@@ -37,19 +24,6 @@ module Spree
|
|
37
24
|
@products = @products.page(curr_page).per(@properties[:per_page])
|
38
25
|
end
|
39
26
|
|
40
|
-
def method_missing(name)
|
41
|
-
if @properties.key?(name)
|
42
|
-
Spree::Deprecation.warn "Accessing Searcher's #{name} property using #{self.class.name}##{name} is deprecated without replacement"
|
43
|
-
@properties[name]
|
44
|
-
else
|
45
|
-
super
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def respond_to_missing?(name)
|
50
|
-
@properties.key?(name) || super(name)
|
51
|
-
end
|
52
|
-
|
53
27
|
protected
|
54
28
|
|
55
29
|
def get_base_scope
|
@@ -68,17 +68,8 @@ module Spree
|
|
68
68
|
|
69
69
|
def order
|
70
70
|
@order ||= begin
|
71
|
-
|
72
|
-
|
73
|
-
"Spree::Order state machine defined in Spree::Order::Checkout is deprecated. " \
|
74
|
-
"Future versions of Solidus will use Spree::Core::StateMachines::Order}",
|
75
|
-
caller
|
76
|
-
)
|
77
|
-
'Spree::Order::Checkout'
|
78
|
-
else
|
79
|
-
require 'spree/core/state_machines/order'
|
80
|
-
'Spree::Core::StateMachines::Order'
|
81
|
-
end
|
71
|
+
require 'spree/core/state_machines/order'
|
72
|
+
'Spree::Core::StateMachines::Order'
|
82
73
|
end
|
83
74
|
|
84
75
|
@order.constantize
|
@@ -16,7 +16,7 @@ module Spree
|
|
16
16
|
|
17
17
|
def validate_each(record, attribute, value)
|
18
18
|
unless EMAIL_REGEXP.match? value
|
19
|
-
record.errors.add(attribute, :invalid, { value: value }.merge!(options))
|
19
|
+
record.errors.add(attribute, :invalid, **{ value: value }.merge!(options))
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
data/lib/spree/core/version.rb
CHANGED
data/lib/spree/core.rb
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "action_controller/railtie"
|
4
|
+
require "action_mailer/railtie"
|
5
|
+
require "action_view/railtie"
|
6
|
+
require "active_job/railtie"
|
7
|
+
require "active_model/railtie"
|
8
|
+
require "active_record/railtie"
|
9
|
+
require "active_storage/engine"
|
10
|
+
require "sprockets/railtie"
|
11
|
+
|
4
12
|
require 'acts_as_list'
|
5
13
|
require 'awesome_nested_set'
|
6
14
|
require 'cancan'
|
@@ -9,12 +17,10 @@ require 'kaminari/activerecord'
|
|
9
17
|
require 'mail'
|
10
18
|
require 'monetize'
|
11
19
|
require 'paperclip'
|
12
|
-
require 'paranoia'
|
13
20
|
require 'ransack'
|
14
21
|
require 'state_machines-activerecord'
|
15
22
|
|
16
23
|
require 'spree/deprecation'
|
17
|
-
require 'spree/paranoia_deprecations'
|
18
24
|
|
19
25
|
# This is required because ActiveModel::Validations#invalid? conflicts with the
|
20
26
|
# invalid state of a Payment. In the future this should be removed.
|
@@ -47,9 +53,6 @@ module Spree
|
|
47
53
|
|
48
54
|
module Core
|
49
55
|
class GatewayError < RuntimeError; end
|
50
|
-
|
51
|
-
include ActiveSupport::Deprecation::DeprecatedConstantAccessor
|
52
|
-
deprecate_constant 'DestroyWithOrdersError', ActiveRecord::DeleteRestrictionError, deprecator: Spree::Deprecation
|
53
56
|
end
|
54
57
|
end
|
55
58
|
|
@@ -61,7 +64,6 @@ require 'spree/core/environment_extension'
|
|
61
64
|
require 'spree/core/environment/calculators'
|
62
65
|
require 'spree/core/environment/promotions'
|
63
66
|
require 'spree/core/environment'
|
64
|
-
require 'spree/promo/environment'
|
65
67
|
require 'spree/migrations'
|
66
68
|
require 'spree/migration_helpers'
|
67
69
|
require 'spree/event'
|
@@ -75,7 +77,6 @@ require 'spree/permitted_attributes'
|
|
75
77
|
require 'spree/core/importer'
|
76
78
|
require 'spree/core/permalinks'
|
77
79
|
require 'spree/core/product_duplicator'
|
78
|
-
require 'spree/core/current_store'
|
79
80
|
require 'spree/core/controller_helpers/auth'
|
80
81
|
require 'spree/core/controller_helpers/common'
|
81
82
|
require 'spree/core/controller_helpers/current_host'
|
data/lib/spree/deprecation.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'active_support/deprecation'
|
4
4
|
|
5
5
|
module Spree
|
6
|
-
Deprecation = ActiveSupport::Deprecation.new('
|
6
|
+
Deprecation = ActiveSupport::Deprecation.new('4.0', 'Solidus')
|
7
7
|
|
8
8
|
# This DeprecatedInstanceVariableProxy transforms instance variable to
|
9
9
|
# deprecated instance variable.
|
@@ -7,11 +7,6 @@ module Spree
|
|
7
7
|
@subscriber_registry ||= Spree::Event::SubscriberRegistry.new
|
8
8
|
end
|
9
9
|
|
10
|
-
def subscribers
|
11
|
-
Spree::Deprecation.warn("`Spree::Config.events.subscribers` is deprecated. Please use `Spree::Config.events.subscriber_registry`.", caller)
|
12
|
-
subscriber_registry.send(:registry).keys.map { |module_name| module_name.constantize }
|
13
|
-
end
|
14
|
-
|
15
10
|
attr_writer :adapter, :suffix, :autoload_subscribers
|
16
11
|
|
17
12
|
def autoload_subscribers
|
@@ -59,14 +59,6 @@ module Spree
|
|
59
59
|
# end
|
60
60
|
# end
|
61
61
|
def event_action(method_name, event_name: nil)
|
62
|
-
mattr_writer "#{method_name}_handler"
|
63
|
-
|
64
|
-
define_method "#{method_name}_handler" do
|
65
|
-
Spree::Deprecation.warn("#{name}.#{method_name}_handler and #{name}.#{method_name}_handler= from the old events mapping interface are deprecated. Please use the new mapping stored in Spree::Event.subscribers.", caller)
|
66
|
-
|
67
|
-
class_variable_get("@@#{method_name}_handler")
|
68
|
-
end
|
69
|
-
|
70
62
|
event_actions[method_name] = (event_name || method_name).to_s
|
71
63
|
end
|
72
64
|
|
@@ -89,16 +81,6 @@ module Spree
|
|
89
81
|
def deactivate(event_action_name = nil)
|
90
82
|
Spree::Event.subscriber_registry.deactivate_subscriber(self, event_action_name)
|
91
83
|
end
|
92
|
-
|
93
|
-
def subscribe!
|
94
|
-
Spree::Deprecation.warn("#{self}.subscribe! is deprecated. Please use `#{self}.activate`.", caller)
|
95
|
-
activate
|
96
|
-
end
|
97
|
-
|
98
|
-
def unsubscribe!
|
99
|
-
Spree::Deprecation.warn("#{self}.unsubscribe! is deprecated. Please use `#{self}.deactivate`.", caller)
|
100
|
-
deactivate
|
101
|
-
end
|
102
84
|
end
|
103
85
|
end
|
104
86
|
end
|
@@ -35,7 +35,9 @@ module Spree
|
|
35
35
|
subscription = Spree::Event.subscribe(event_name) { |event| subscriber.send(event_action, event) }
|
36
36
|
|
37
37
|
# deprecated mappings, to be removed when Solidus 2.10 is not supported anymore:
|
38
|
-
subscriber.
|
38
|
+
if subscriber.respond_to?("#{event_action}_handler=")
|
39
|
+
subscriber.send("#{event_action}_handler=", subscription)
|
40
|
+
end
|
39
41
|
|
40
42
|
registry[subscriber.name][event_action] = subscription
|
41
43
|
end
|
data/lib/spree/event.rb
CHANGED
@@ -29,20 +29,6 @@ module Spree
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
# @deprecated Loads all Solidus' core and application's event subscribers files.
|
33
|
-
# The latter are loaded automatically only when the preference
|
34
|
-
# Spree::Config.events.autoload_subscribers is set to a truthy value.
|
35
|
-
#
|
36
|
-
# Files must be placed under the directory `app/subscribers` and their
|
37
|
-
# name must end with `_subscriber.rb`.
|
38
|
-
#
|
39
|
-
# Loading the files has the side effect of adding their module to the
|
40
|
-
# list in Spree::Event.subscribers.
|
41
|
-
def require_subscriber_files
|
42
|
-
Spree::Deprecation.warn("#{self}.require_subscriber_files is deprecated and will be removed in Solidus 3.0.", caller)
|
43
|
-
subscriber_registry.send(:require_subscriber_files)
|
44
|
-
end
|
45
|
-
|
46
32
|
# Subscribe to an event with the given name. The provided block is executed
|
47
33
|
# every time the subscribed event is fired.
|
48
34
|
#
|
@@ -114,23 +100,6 @@ module Spree
|
|
114
100
|
Spree::Config.events.adapter
|
115
101
|
end
|
116
102
|
|
117
|
-
# The suffix used for namespacing Solidus events, defaults to
|
118
|
-
# `.spree`
|
119
|
-
#
|
120
|
-
# @see Spree::Event::Configuration#suffix
|
121
|
-
def suffix
|
122
|
-
Spree::Deprecation.warn "This method is deprecated and will be removed. Please use Event::Adapters::ActiveSupportNotifications#suffix"
|
123
|
-
Spree::Config.events.suffix
|
124
|
-
end
|
125
|
-
|
126
|
-
# @deprecated
|
127
|
-
# @!attribute [r] subscribers
|
128
|
-
# @return [Array<Spree::Event::Subscriber>] A list of subscribers used to support class reloading for Spree::Event::Subscriber instances
|
129
|
-
def subscribers
|
130
|
-
Spree::Deprecation.warn("`#{self}.subscribers` is deprecated. Please use `#{self}.subscriber_registry` instead.", caller)
|
131
|
-
Spree::Config.events.subscribers
|
132
|
-
end
|
133
|
-
|
134
103
|
# @!attribute [r] subscribers
|
135
104
|
# @return <Spree::Event::SubscriberRegistry> The registry for supporting class reloading for Spree::Event::Subscriber instances
|
136
105
|
def subscriber_registry
|
data/lib/spree/i18n.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'i18n'
|
4
|
-
require 'active_support/core_ext/array/extract_options'
|
5
|
-
require 'action_view'
|
6
4
|
|
7
5
|
module Spree
|
8
6
|
def self.i18n_available_locales
|
@@ -11,29 +9,9 @@ module Spree
|
|
11
9
|
end
|
12
10
|
end
|
13
11
|
|
14
|
-
class TranslationHelperWrapper # :nodoc:
|
15
|
-
include ActionView::Helpers::TranslationHelper
|
16
|
-
end
|
17
|
-
|
18
12
|
# This value is used as a count for the pluralization helpers related to I18n
|
19
13
|
# ex: Spree::Order.model_name.human(count: Spree::I18N_GENERIC_PLURAL)
|
20
14
|
# Related to Solidus issue #1164, this is needed to avoid problems with
|
21
15
|
# some pluralization calculators
|
22
16
|
I18N_GENERIC_PLURAL = 2.1
|
23
|
-
|
24
|
-
class << self
|
25
|
-
# Add spree namespace and delegate to Rails TranslationHelper for some nice
|
26
|
-
# extra functionality. e.g return reasonable strings for missing translations
|
27
|
-
|
28
|
-
def translate(key, options = {})
|
29
|
-
Spree::Deprecation.warn <<-WARN.squish
|
30
|
-
Spree.t & Spree.translate have been deprecated.
|
31
|
-
Instead use I18n.t('spree.your_translation_key')
|
32
|
-
WARN
|
33
|
-
options[:scope] = [:spree, *options[:scope]]
|
34
|
-
TranslationHelperWrapper.new.translate(key, **options)
|
35
|
-
end
|
36
|
-
|
37
|
-
alias_method :t, :translate
|
38
|
-
end
|
39
17
|
end
|
data/lib/spree/money.rb
CHANGED
@@ -6,7 +6,6 @@ module Spree
|
|
6
6
|
class Money
|
7
7
|
include Comparable
|
8
8
|
DifferentCurrencyError = Class.new(StandardError)
|
9
|
-
RUBY_NUMERIC_STRING = /\A-?\d+(\.\d+)?\z/
|
10
9
|
|
11
10
|
class <<self
|
12
11
|
attr_accessor :default_formatting_rules
|
@@ -37,15 +36,8 @@ module Spree
|
|
37
36
|
@money = amount
|
38
37
|
else
|
39
38
|
currency = (options[:currency] || Spree::Config[:currency])
|
40
|
-
|
41
|
-
|
42
|
-
else
|
43
|
-
@money = Spree::Money.parse_to_money(amount, currency)
|
44
|
-
Spree::Deprecation.warn <<-WARN.squish, caller
|
45
|
-
Spree::Money was initialized with #{amount.inspect}, which will not be supported in the future.
|
46
|
-
Instead use Spree::Money.new(#{@money.to_s.inspect}, options) or Spree::Money.parse(#{amount.inspect})
|
47
|
-
WARN
|
48
|
-
end
|
39
|
+
|
40
|
+
@money = Monetize.from_string(amount, currency)
|
49
41
|
end
|
50
42
|
@options = Spree::Money.default_formatting_rules.merge(options)
|
51
43
|
end
|
@@ -80,14 +72,7 @@ module Spree
|
|
80
72
|
def to_html(options = { html_wrap: true })
|
81
73
|
output = format(options)
|
82
74
|
# Maintain compatibility by checking html option renamed to html_wrap.
|
83
|
-
if options[:
|
84
|
-
Spree::Deprecation.warn <<-WARN.squish, caller
|
85
|
-
Spree::Money#to_html called with Spree::Money#to_html(html: #{options[:html].inspect}),
|
86
|
-
which will not be supported in the future.
|
87
|
-
Instead use :html_wrap e.g. Spree::Money#to_html(html_wrap: #{options[:html].inspect})
|
88
|
-
WARN
|
89
|
-
end
|
90
|
-
if options[:html_wrap] || options[:html]
|
75
|
+
if options[:html_wrap]
|
91
76
|
output = output.html_safe
|
92
77
|
end
|
93
78
|
output
|