solidus_core 3.0.6 → 3.1.0
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.
- checksums.yaml +4 -4
- data/app/helpers/spree/base_helper.rb +1 -1
- data/app/helpers/spree/products_helper.rb +1 -1
- data/app/models/concerns/spree/active_storage_adapter/attachment.rb +2 -4
- data/app/models/concerns/spree/default_price.rb +63 -10
- data/app/models/spree/adjustment.rb +6 -5
- data/app/models/spree/customer_return.rb +3 -2
- data/app/models/spree/image/active_storage_attachment.rb +2 -7
- data/app/models/spree/image/paperclip_attachment.rb +2 -2
- data/app/models/spree/line_item.rb +2 -2
- data/app/models/spree/order.rb +11 -6
- data/app/models/spree/order_shipping.rb +9 -6
- data/app/models/spree/price.rb +1 -1
- data/app/models/spree/product/scopes.rb +5 -5
- data/app/models/spree/product.rb +12 -1
- data/app/models/spree/promotion/rules/item_total.rb +50 -6
- data/app/models/spree/promotion.rb +2 -2
- data/app/models/spree/promotion_code.rb +3 -3
- data/app/models/spree/refund.rb +0 -8
- data/app/models/spree/shipping_rate_tax.rb +1 -1
- data/app/models/spree/stock/availability.rb +11 -3
- data/app/models/spree/stock/simple_coordinator.rb +0 -10
- data/app/models/spree/stock_location.rb +1 -1
- data/app/models/spree/store_credit.rb +6 -9
- data/app/models/spree/tax_calculator/shipping_rate.rb +1 -1
- data/app/models/spree/taxon/active_storage_attachment.rb +2 -2
- data/app/models/spree/taxon/paperclip_attachment.rb +3 -3
- data/app/models/spree/variant/price_selector.rb +16 -3
- data/app/models/spree/variant.rb +26 -16
- data/config/locales/en.yml +2 -0
- data/db/migrate/20210312061050_change_column_null_on_prices.rb +7 -0
- data/lib/generators/solidus/install/install_generator.rb +1 -1
- data/lib/generators/solidus/install/templates/config/initializers/spree.rb.tt +3 -1
- data/lib/generators/solidus/update/templates/config/initializers/new_solidus_defaults.rb.tt +30 -0
- data/lib/generators/solidus/update/update_generator.rb +112 -0
- data/lib/generators/spree/dummy/templates/rails/application.rb.tt +0 -1
- data/lib/generators/spree/dummy/templates/rails/database.yml +78 -35
- data/lib/spree/app_configuration.rb +62 -0
- data/lib/spree/core/engine.rb +7 -16
- data/lib/spree/core/product_filters.rb +1 -1
- data/lib/spree/core/search/base.rb +1 -1
- data/lib/spree/core/state_machines/order.rb +1 -1
- data/lib/spree/core/validators/email.rb +1 -1
- data/lib/spree/core/version.rb +5 -1
- data/lib/spree/core/versioned_value.rb +75 -0
- data/lib/spree/core.rb +17 -0
- data/lib/spree/permitted_attributes.rb +1 -1
- data/lib/spree/preferences/configuration.rb +62 -0
- data/lib/spree/preferences/preferable.rb +8 -0
- data/lib/spree/preferences/preferable_class_methods.rb +5 -3
- data/lib/spree/preferences/preference_differentiator.rb +28 -0
- data/lib/spree/testing_support/blacklist_urls.rb +1 -1
- data/lib/spree/testing_support/dummy_app/database.yml +42 -22
- data/lib/spree/testing_support/dummy_app.rb +33 -19
- data/lib/tasks/solidus/delete_prices_with_nil_amount.rake +8 -0
- metadata +11 -8
- data/app/models/spree/tax/shipping_rate_taxer.rb +0 -24
- data/lib/tasks/solidus/check_orders_with_invalid_email.rake +0 -18
- data/lib/tasks/upgrade.rake +0 -15
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Spree
|
|
4
|
+
module Core
|
|
5
|
+
# Wrapper for a value that can be different depending on the Solidus version
|
|
6
|
+
#
|
|
7
|
+
# Some configuration defaults can be added or changed when a new Solidus
|
|
8
|
+
# version is released. This class encapsulates getting the correct value for a
|
|
9
|
+
# given Solidus version.
|
|
10
|
+
#
|
|
11
|
+
# The way it works is you provide an initial value in time, plus the version
|
|
12
|
+
# boundary where it got changed. Then you can fetch the value providing the
|
|
13
|
+
# desired Solidus version:
|
|
14
|
+
#
|
|
15
|
+
# @example
|
|
16
|
+
# value = VersionedValue.new(true, "3.0.0" => false)
|
|
17
|
+
# value.call("2.7.0") # => true
|
|
18
|
+
# value.call("3.0.0") # => false
|
|
19
|
+
# value.call("3.1.0") # => false
|
|
20
|
+
#
|
|
21
|
+
# Remember that you must provide the exact boundary when a value got changed,
|
|
22
|
+
# which could easily be during a pre-release:
|
|
23
|
+
#
|
|
24
|
+
# @example
|
|
25
|
+
# value = VersionedValue.new(true, "3.0.0" => false)
|
|
26
|
+
# value.call("3.0.0.alpha") # => true
|
|
27
|
+
#
|
|
28
|
+
# value = VersionedValue.new(true, "3.0.0.alpha" => false)
|
|
29
|
+
# value.call("3.0.0.alpha") # => false
|
|
30
|
+
#
|
|
31
|
+
# Multiple boundaries can also be provided:
|
|
32
|
+
#
|
|
33
|
+
# @example
|
|
34
|
+
# value = VersionedValue.new(0, "2.0.0" => 1, "3.0.0" => 2)
|
|
35
|
+
# value.call("1.0.0") # => 0
|
|
36
|
+
# value.call("2.1.0") # => 1
|
|
37
|
+
# value.call("3.0.0") # => 2
|
|
38
|
+
class VersionedValue
|
|
39
|
+
attr_reader :boundaries
|
|
40
|
+
|
|
41
|
+
# @param initial_value [Any]
|
|
42
|
+
# @param boundary [Hash<String, Any>] Map from version number to new value
|
|
43
|
+
def initialize(initial_value, boundaries = {})
|
|
44
|
+
@boundaries = Hash[
|
|
45
|
+
{ '0' => initial_value }
|
|
46
|
+
.merge(boundaries)
|
|
47
|
+
.transform_keys { |version| to_gem_version(version) }
|
|
48
|
+
.sort
|
|
49
|
+
]
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# @param solidus_version [String]
|
|
53
|
+
def call(solidus_version = Spree.solidus_version)
|
|
54
|
+
solidus_version = to_gem_version(solidus_version)
|
|
55
|
+
boundaries.fetch(
|
|
56
|
+
boundaries
|
|
57
|
+
.keys
|
|
58
|
+
.reduce do |target, following|
|
|
59
|
+
if target <= solidus_version && solidus_version < following
|
|
60
|
+
target
|
|
61
|
+
else
|
|
62
|
+
following
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
private
|
|
69
|
+
|
|
70
|
+
def to_gem_version(string)
|
|
71
|
+
Gem::Version.new(string)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
data/lib/spree/core.rb
CHANGED
|
@@ -37,6 +37,16 @@ module Spree
|
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
+
# Load the same version defaults for all available Solidus components
|
|
41
|
+
#
|
|
42
|
+
# @see Spree::Preferences::Configuration#load_defaults
|
|
43
|
+
def self.load_defaults(version)
|
|
44
|
+
Spree::Config.load_defaults(version)
|
|
45
|
+
Spree::Frontend::Config.load_defaults(version) if defined?(Spree::Frontend::Config)
|
|
46
|
+
Spree::Backend::Config.load_defaults(version) if defined?(Spree::Backend::Config)
|
|
47
|
+
Spree::Api::Config.load_defaults(version) if defined?(Spree::Api::Config)
|
|
48
|
+
end
|
|
49
|
+
|
|
40
50
|
# Used to configure Spree.
|
|
41
51
|
#
|
|
42
52
|
# Example:
|
|
@@ -52,6 +62,13 @@ module Spree
|
|
|
52
62
|
end
|
|
53
63
|
|
|
54
64
|
module Core
|
|
65
|
+
def self.has_install_generator_been_run?
|
|
66
|
+
(Rails.env.test? && Rails.application.class.name == 'DummyApp::Application') ||
|
|
67
|
+
Rails.application.paths['config/initializers'].paths.any? do |path|
|
|
68
|
+
File.exist?(path.join('spree.rb'))
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
55
72
|
class GatewayError < RuntimeError; end
|
|
56
73
|
end
|
|
57
74
|
end
|
|
@@ -74,7 +74,7 @@ module Spree
|
|
|
74
74
|
@@product_properties_attributes = [:property_name, :value, :position]
|
|
75
75
|
|
|
76
76
|
@@product_attributes = [
|
|
77
|
-
:name, :description, :available_on, :discontinue_on, :
|
|
77
|
+
:name, :description, :available_on, :discontinue_on, :meta_description,
|
|
78
78
|
:meta_keywords, :price, :sku, :deleted_at,
|
|
79
79
|
:option_values_hash, :weight, :height, :width, :depth,
|
|
80
80
|
:shipping_category_id, :tax_category_id,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'spree/core/versioned_value'
|
|
3
4
|
require 'spree/preferences/preferable'
|
|
4
5
|
|
|
5
6
|
module Spree::Preferences
|
|
@@ -29,6 +30,44 @@ module Spree::Preferences
|
|
|
29
30
|
class Configuration
|
|
30
31
|
include Spree::Preferences::Preferable
|
|
31
32
|
|
|
33
|
+
# @!attribute [r] loaded_defaults
|
|
34
|
+
# @return [String]
|
|
35
|
+
# Some configuration defaults can be added or changed when a new Solidus
|
|
36
|
+
# version is released. Setting this to an older Solidus version allows keeping
|
|
37
|
+
# backward compatibility until the application code is updated to the new
|
|
38
|
+
# defaults. Set via {#load_defaults}
|
|
39
|
+
attr_reader :loaded_defaults
|
|
40
|
+
|
|
41
|
+
attr_reader :load_defaults_called
|
|
42
|
+
|
|
43
|
+
def initialize
|
|
44
|
+
@loaded_defaults = Spree.solidus_version
|
|
45
|
+
@load_defaults_called = false
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# @param [String] Solidus version from which take defaults when not
|
|
49
|
+
# overriden.
|
|
50
|
+
# @see #load_defaults
|
|
51
|
+
def load_defaults(version)
|
|
52
|
+
@loaded_defaults = version
|
|
53
|
+
@load_defaults_called = true
|
|
54
|
+
reset
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def check_load_defaults_called(instance_constant_name = nil)
|
|
58
|
+
return if load_defaults_called || !Spree::Core.has_install_generator_been_run?
|
|
59
|
+
|
|
60
|
+
target_name = instance_constant_name || "#{self.class.name}.new"
|
|
61
|
+
Spree::Deprecation.warn <<~MSG
|
|
62
|
+
It's recommended that you explicitly load the default configuration for
|
|
63
|
+
your current Solidus version. You can do it by adding the following call
|
|
64
|
+
to your Solidus initializer within the #{target_name} block:
|
|
65
|
+
|
|
66
|
+
config.load_defaults('#{Spree.solidus_version}')
|
|
67
|
+
|
|
68
|
+
MSG
|
|
69
|
+
end
|
|
70
|
+
|
|
32
71
|
# @yield [config] Yields this configuration object to a block
|
|
33
72
|
def configure
|
|
34
73
|
yield(self)
|
|
@@ -79,6 +118,23 @@ module Spree::Preferences
|
|
|
79
118
|
end
|
|
80
119
|
end
|
|
81
120
|
|
|
121
|
+
# Generates a different preference default depending on {#version_defaults}
|
|
122
|
+
#
|
|
123
|
+
# This method is meant to be used in the `default:` keyword argument for
|
|
124
|
+
# {.preference}. For instance, in the example, `foo`'s default was `true`
|
|
125
|
+
# until version 3.0.0.alpha, when it became `false`:
|
|
126
|
+
#
|
|
127
|
+
# @example
|
|
128
|
+
# preference :foo, :boolean, default: by_version(true, "3.0.0.alpha" => false)
|
|
129
|
+
#
|
|
130
|
+
# @see #loaded_defaults
|
|
131
|
+
# @see Spree::Core::VersionedValue
|
|
132
|
+
def self.by_version(*args)
|
|
133
|
+
proc do |loaded_defaults|
|
|
134
|
+
Spree::Core::VersionedValue.new(*args).call(loaded_defaults)
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
82
138
|
def self.preference(name, type, options = {})
|
|
83
139
|
super
|
|
84
140
|
alias_method name.to_s, "preferred_#{name}"
|
|
@@ -103,5 +159,11 @@ module Spree::Preferences
|
|
|
103
159
|
class_name
|
|
104
160
|
end
|
|
105
161
|
end
|
|
162
|
+
|
|
163
|
+
private
|
|
164
|
+
|
|
165
|
+
def context_for_default
|
|
166
|
+
[loaded_defaults]
|
|
167
|
+
end
|
|
106
168
|
end
|
|
107
169
|
end
|
|
@@ -11,6 +11,10 @@ module Spree
|
|
|
11
11
|
# A class including Preferable must implement #preferences which should return
|
|
12
12
|
# an object responding to .fetch(key), []=(key, val), and .delete(key).
|
|
13
13
|
#
|
|
14
|
+
# It may also define a `#context_for_default` method. It should return an
|
|
15
|
+
# array with the arguments to be provided to a proc used as the `default:`
|
|
16
|
+
# keyword for a preference.
|
|
17
|
+
#
|
|
14
18
|
# The generated writer method performs typecasting before assignment into the
|
|
15
19
|
# preferences object.
|
|
16
20
|
#
|
|
@@ -176,6 +180,10 @@ module Spree
|
|
|
176
180
|
value
|
|
177
181
|
end
|
|
178
182
|
end
|
|
183
|
+
|
|
184
|
+
def context_for_default
|
|
185
|
+
[].freeze
|
|
186
|
+
end
|
|
179
187
|
end
|
|
180
188
|
end
|
|
181
189
|
end
|
|
@@ -27,7 +27,7 @@ module Spree::Preferences
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
default = options[:default]
|
|
30
|
-
default =
|
|
30
|
+
default = proc { options[:default] } unless default.is_a?(Proc)
|
|
31
31
|
|
|
32
32
|
# The defined preferences on a class are all those defined directly on
|
|
33
33
|
# that class as well as those defined on ancestors.
|
|
@@ -44,7 +44,7 @@ module Spree::Preferences
|
|
|
44
44
|
# is a pending preference before going to default
|
|
45
45
|
define_method preference_getter_method(name) do
|
|
46
46
|
value = preferences.fetch(name) do
|
|
47
|
-
default.call
|
|
47
|
+
default.call(*context_for_default)
|
|
48
48
|
end
|
|
49
49
|
value = preference_encryptor.decrypt(value) if preference_encryptor.present?
|
|
50
50
|
value
|
|
@@ -60,7 +60,9 @@ module Spree::Preferences
|
|
|
60
60
|
preferences_will_change! if respond_to?(:preferences_will_change!)
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
-
define_method preference_default_getter_method(name)
|
|
63
|
+
define_method preference_default_getter_method(name) do
|
|
64
|
+
default.call(*context_for_default)
|
|
65
|
+
end
|
|
64
66
|
|
|
65
67
|
define_method preference_type_getter_method(name) do
|
|
66
68
|
type
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Spree
|
|
4
|
+
module Preferences
|
|
5
|
+
class PreferenceDifferentiator
|
|
6
|
+
attr_reader :config_class
|
|
7
|
+
|
|
8
|
+
def initialize(config_class)
|
|
9
|
+
@config_class = config_class
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def call(from:, to:)
|
|
13
|
+
preferences_from = config_class.new.load_defaults(from)
|
|
14
|
+
preferences_to = config_class.new.load_defaults(to)
|
|
15
|
+
preferences_from.reduce({}) do |changes, (pref_key, value_from)|
|
|
16
|
+
value_to = preferences_to[pref_key]
|
|
17
|
+
if value_from == value_to
|
|
18
|
+
changes
|
|
19
|
+
else
|
|
20
|
+
changes.merge(
|
|
21
|
+
pref_key => { from: value_from, to: value_to }
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -1,34 +1,54 @@
|
|
|
1
|
-
<%
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<% db = case ENV['DB']
|
|
2
|
+
when 'mysql'
|
|
3
|
+
'mysql'
|
|
4
|
+
when 'postgres', 'postgresql'
|
|
5
|
+
'postgres'
|
|
6
|
+
when 'sqlite', '', nil
|
|
7
|
+
'sqlite'
|
|
8
|
+
else
|
|
9
|
+
raise "Invalid DB specified: #{ENV['DB']}"
|
|
10
|
+
end %>
|
|
11
|
+
<% db_host = case db
|
|
12
|
+
when 'mysql'
|
|
13
|
+
ENV['DB_MYSQL_HOST'] || ENV['DB_HOST']
|
|
14
|
+
when 'postgres'
|
|
15
|
+
ENV['DB_POSTGRES_HOST'] || ENV['DB_HOST']
|
|
16
|
+
else
|
|
17
|
+
ENV['DB_HOST']
|
|
18
|
+
end %>
|
|
19
|
+
<% db_prefix = ENV['LIB_NAME'].presence || "solidus" %>
|
|
20
|
+
<% db_username = ENV['DB_USERNAME'] %>
|
|
21
|
+
<% db_password = ENV['DB_PASSWORD'] %>
|
|
22
|
+
<% case db
|
|
5
23
|
when 'mysql' %>
|
|
6
24
|
test:
|
|
7
25
|
adapter: mysql2
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
26
|
+
database: <%= db_prefix %>_test
|
|
27
|
+
<% unless db_username.blank? %>
|
|
28
|
+
username: <%= db_username %>
|
|
11
29
|
<% end %>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<%
|
|
15
|
-
|
|
30
|
+
<% unless db_password.blank? %>
|
|
31
|
+
password: <%= db_password %>
|
|
32
|
+
<% end %>
|
|
33
|
+
<% unless db_host.blank? %>
|
|
34
|
+
host: <%= db_host %>
|
|
16
35
|
<% end %>
|
|
17
|
-
|
|
18
|
-
<%
|
|
36
|
+
encoding: utf8
|
|
37
|
+
<% when 'postgres' %>
|
|
19
38
|
test:
|
|
20
39
|
adapter: postgresql
|
|
21
|
-
database: <%=
|
|
22
|
-
username: postgres
|
|
23
|
-
|
|
24
|
-
|
|
40
|
+
database: <%= db_prefix %>_test
|
|
41
|
+
username: <%= db_username.presence || "postgres" %>
|
|
42
|
+
<% unless db_password.blank? %>
|
|
43
|
+
password: <%= db_password %>
|
|
44
|
+
<% end %>
|
|
45
|
+
<% unless db_host.blank? %>
|
|
25
46
|
host: <%= db_host %>
|
|
26
|
-
<% end %>
|
|
27
|
-
|
|
47
|
+
<% end %>
|
|
48
|
+
min_messages: warning
|
|
49
|
+
<% when 'sqlite' %>
|
|
28
50
|
test:
|
|
29
51
|
adapter: sqlite3
|
|
30
|
-
database: db/<%=
|
|
52
|
+
database: db/<%= db_prefix %>_test.sqlite3
|
|
31
53
|
timeout: 10000
|
|
32
|
-
<% else %>
|
|
33
|
-
<% raise "Invalid DB specified: #{ENV['DB']}" %>
|
|
34
54
|
<% end %>
|
|
@@ -46,39 +46,56 @@ module DummyApp
|
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
class Application < ::Rails::Application
|
|
49
|
-
config.
|
|
50
|
-
|
|
49
|
+
config.load_defaults("#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}")
|
|
50
|
+
# Make the test environment more production-like:
|
|
51
51
|
config.cache_classes = true
|
|
52
|
-
config.cache_store = :memory_store
|
|
53
|
-
config.serve_static_assets = true
|
|
54
|
-
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
|
|
55
|
-
config.whiny_nils = true
|
|
56
|
-
config.consider_all_requests_local = true
|
|
57
52
|
config.action_controller.allow_forgery_protection = false
|
|
58
53
|
config.action_controller.default_protect_from_forgery = false
|
|
54
|
+
config.action_mailer.perform_caching = false
|
|
55
|
+
config.i18n.fallbacks = true
|
|
56
|
+
|
|
57
|
+
# In the test environment, we use the `caching: true` RSpec metadata to
|
|
58
|
+
# enable caching on select specs. See
|
|
59
|
+
# core/lib/spree/testing_support/caching.rb. See also
|
|
60
|
+
# https://github.com/solidusio/solidus/issues/4110
|
|
59
61
|
config.action_controller.perform_caching = false
|
|
62
|
+
|
|
63
|
+
# Make debugging easier:
|
|
64
|
+
config.consider_all_requests_local = true
|
|
60
65
|
config.action_dispatch.show_exceptions = false
|
|
61
66
|
config.active_support.deprecation = :stderr
|
|
67
|
+
config.log_level = :debug
|
|
68
|
+
|
|
69
|
+
# Improve test suite performance:
|
|
70
|
+
config.eager_load = false
|
|
71
|
+
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
|
|
72
|
+
config.cache_store = :memory_store
|
|
73
|
+
|
|
74
|
+
# We don't use a web server, so we let Rails serve assets.
|
|
75
|
+
config.public_file_server.enabled = true
|
|
76
|
+
|
|
77
|
+
# We don't want to send email in the test environment.
|
|
62
78
|
config.action_mailer.delivery_method = :test
|
|
63
|
-
|
|
79
|
+
|
|
80
|
+
# No need to use credentials file in a test environment.
|
|
64
81
|
config.secret_key_base = 'SECRET_TOKEN'
|
|
65
82
|
|
|
66
|
-
|
|
83
|
+
# Set the preview path within the dummy app:
|
|
67
84
|
config.action_mailer.preview_path = File.expand_path('dummy_app/mailer_previews', __dir__)
|
|
68
|
-
config.active_record.sqlite3.represent_boolean_as_integer = true unless RAILS_6_OR_ABOVE
|
|
69
85
|
|
|
70
|
-
config.
|
|
86
|
+
config.active_record.sqlite3.represent_boolean_as_integer = true unless RAILS_6_OR_ABOVE
|
|
87
|
+
config.active_record.dump_schema_after_migration = false
|
|
71
88
|
|
|
89
|
+
# Configure active storage to use storage within tmp folder
|
|
72
90
|
unless ENV['DISABLE_ACTIVE_STORAGE']
|
|
73
91
|
initializer 'solidus.active_storage' do
|
|
74
92
|
config.active_storage.service_configurations = {
|
|
75
93
|
test: {
|
|
76
94
|
service: 'Disk',
|
|
77
|
-
root:
|
|
95
|
+
root: Rails.root.join('tmp', 'storage')
|
|
78
96
|
}
|
|
79
97
|
}
|
|
80
98
|
config.active_storage.service = :test
|
|
81
|
-
config.active_storage.variant_processor = ENV.fetch('ACTIVE_STORAGE_VARIANT_PROCESSOR', :mini_magick).to_sym
|
|
82
99
|
end
|
|
83
100
|
end
|
|
84
101
|
|
|
@@ -96,12 +113,8 @@ module DummyApp
|
|
|
96
113
|
config.paths['db/migrate'] = migration_dirs
|
|
97
114
|
ActiveRecord::Migrator.migrations_paths = migration_dirs
|
|
98
115
|
|
|
99
|
-
config.
|
|
100
|
-
|
|
101
|
-
if config.respond_to?(:assets)
|
|
102
|
-
config.assets.paths << File.expand_path('dummy_app/assets/javascripts', __dir__)
|
|
103
|
-
config.assets.paths << File.expand_path('dummy_app/assets/stylesheets', __dir__)
|
|
104
|
-
end
|
|
116
|
+
config.assets.paths << File.expand_path('dummy_app/assets/javascripts', __dir__)
|
|
117
|
+
config.assets.paths << File.expand_path('dummy_app/assets/stylesheets', __dir__)
|
|
105
118
|
|
|
106
119
|
config.paths["config/database"] = File.expand_path('dummy_app/database.yml', __dir__)
|
|
107
120
|
config.paths['app/views'] = File.expand_path('dummy_app/views', __dir__)
|
|
@@ -118,6 +131,7 @@ ActiveSupport.on_load(:action_controller) do
|
|
|
118
131
|
end
|
|
119
132
|
|
|
120
133
|
Spree.user_class = 'Spree::LegacyUser'
|
|
134
|
+
Spree.load_defaults(Spree.solidus_version)
|
|
121
135
|
Spree.config do |config|
|
|
122
136
|
config.mails_from = "store@example.com"
|
|
123
137
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: solidus_core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0
|
|
4
|
+
version: 3.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Solidus Team
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-09-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: actionmailer
|
|
@@ -609,7 +609,6 @@ files:
|
|
|
609
609
|
- app/models/spree/tax/item_tax.rb
|
|
610
610
|
- app/models/spree/tax/order_adjuster.rb
|
|
611
611
|
- app/models/spree/tax/order_tax.rb
|
|
612
|
-
- app/models/spree/tax/shipping_rate_taxer.rb
|
|
613
612
|
- app/models/spree/tax/tax_helpers.rb
|
|
614
613
|
- app/models/spree/tax/tax_location.rb
|
|
615
614
|
- app/models/spree/tax_calculator/default.rb
|
|
@@ -705,6 +704,7 @@ files:
|
|
|
705
704
|
- db/migrate/20200530111458_add_bcc_email_to_spree_stores.rb
|
|
706
705
|
- db/migrate/20201008213609_add_discontinue_on_to_spree_products.rb
|
|
707
706
|
- db/migrate/20210122110141_add_name_to_spree_addresses.rb
|
|
707
|
+
- db/migrate/20210312061050_change_column_null_on_prices.rb
|
|
708
708
|
- db/seeds.rb
|
|
709
709
|
- lib/generators/solidus/install/install_generator.rb
|
|
710
710
|
- lib/generators/solidus/install/templates/config/initializers/spree.rb.tt
|
|
@@ -712,6 +712,8 @@ files:
|
|
|
712
712
|
- lib/generators/solidus/install/templates/vendor/assets/javascripts/spree/frontend/all.js
|
|
713
713
|
- lib/generators/solidus/install/templates/vendor/assets/stylesheets/spree/backend/all.css
|
|
714
714
|
- lib/generators/solidus/install/templates/vendor/assets/stylesheets/spree/frontend/all.css
|
|
715
|
+
- lib/generators/solidus/update/templates/config/initializers/new_solidus_defaults.rb.tt
|
|
716
|
+
- lib/generators/solidus/update/update_generator.rb
|
|
715
717
|
- lib/generators/spree/custom_user/custom_user_generator.rb
|
|
716
718
|
- lib/generators/spree/custom_user/templates/authentication_helpers.rb.tt
|
|
717
719
|
- lib/generators/spree/custom_user/templates/migration.rb.tt
|
|
@@ -765,6 +767,7 @@ files:
|
|
|
765
767
|
- lib/spree/core/stock_configuration.rb
|
|
766
768
|
- lib/spree/core/validators/email.rb
|
|
767
769
|
- lib/spree/core/version.rb
|
|
770
|
+
- lib/spree/core/versioned_value.rb
|
|
768
771
|
- lib/spree/deprecation.rb
|
|
769
772
|
- lib/spree/encryptor.rb
|
|
770
773
|
- lib/spree/event.rb
|
|
@@ -804,6 +807,7 @@ files:
|
|
|
804
807
|
- lib/spree/preferences/persistable.rb
|
|
805
808
|
- lib/spree/preferences/preferable.rb
|
|
806
809
|
- lib/spree/preferences/preferable_class_methods.rb
|
|
810
|
+
- lib/spree/preferences/preference_differentiator.rb
|
|
807
811
|
- lib/spree/preferences/scoped_store.rb
|
|
808
812
|
- lib/spree/preferences/static_model_preferences.rb
|
|
809
813
|
- lib/spree/preferences/statically_configurable.rb
|
|
@@ -903,8 +907,7 @@ files:
|
|
|
903
907
|
- lib/spree/testing_support/url_helpers.rb
|
|
904
908
|
- lib/spree/user_class_handle.rb
|
|
905
909
|
- lib/spree_core.rb
|
|
906
|
-
- lib/tasks/solidus/
|
|
907
|
-
- lib/tasks/upgrade.rake
|
|
910
|
+
- lib/tasks/solidus/delete_prices_with_nil_amount.rake
|
|
908
911
|
- solidus_core.gemspec
|
|
909
912
|
- vendor/assets/javascripts/jquery.payment.js
|
|
910
913
|
- vendor/assets/javascripts/jsuri.js
|
|
@@ -945,8 +948,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
945
948
|
- !ruby/object:Gem::Version
|
|
946
949
|
version: 1.8.23
|
|
947
950
|
requirements: []
|
|
948
|
-
rubygems_version: 3.2.
|
|
949
|
-
signing_key:
|
|
951
|
+
rubygems_version: 3.2.20
|
|
952
|
+
signing_key:
|
|
950
953
|
specification_version: 4
|
|
951
954
|
summary: Essential models, mailers, and classes for the Solidus e-commerce project.
|
|
952
955
|
test_files: []
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Spree
|
|
4
|
-
module Tax
|
|
5
|
-
# Used to build shipping rate taxes
|
|
6
|
-
class ShippingRateTaxer
|
|
7
|
-
# Build shipping rate taxes for a shipping rate
|
|
8
|
-
# Modifies the passed-in shipping rate with associated shipping rate taxes.
|
|
9
|
-
# @param [Spree::ShippingRate] shipping_rate The shipping rate to add taxes to.
|
|
10
|
-
# This parameter will be modified.
|
|
11
|
-
# @return [Spree::ShippingRate] The shipping rate with associated tax objects
|
|
12
|
-
def tax(shipping_rate)
|
|
13
|
-
taxes = Spree::Config.shipping_rate_tax_calculator_class.new(shipping_rate.order).calculate(shipping_rate)
|
|
14
|
-
taxes.each do |tax|
|
|
15
|
-
shipping_rate.taxes.build(
|
|
16
|
-
amount: tax.amount,
|
|
17
|
-
tax_rate: tax.tax_rate
|
|
18
|
-
)
|
|
19
|
-
end
|
|
20
|
-
shipping_rate
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
namespace :solidus do
|
|
4
|
-
desc 'Prints orders with invalid email (after fix for GHSA-qxmr-qxh6-2cc9)'
|
|
5
|
-
task check_orders_with_invalid_email: :environment do
|
|
6
|
-
matches = Spree::Order.find_each.reduce([]) do |matches, order|
|
|
7
|
-
order.email.nil? || Spree::EmailValidator::EMAIL_REGEXP.match?(order.email) ? matches : matches + [order]
|
|
8
|
-
end
|
|
9
|
-
if matches.any?
|
|
10
|
-
puts 'Email / ID / Number'
|
|
11
|
-
puts(matches.map do |order|
|
|
12
|
-
"#{order.email} / #{order.id} / #{order.number}"
|
|
13
|
-
end.join("\n"))
|
|
14
|
-
else
|
|
15
|
-
puts 'NO MATCHES'
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
data/lib/tasks/upgrade.rake
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
namespace :solidus do
|
|
4
|
-
namespace :upgrade do
|
|
5
|
-
task three_point_zero: [
|
|
6
|
-
'railties:install:migrations',
|
|
7
|
-
'db:migrate'
|
|
8
|
-
] do
|
|
9
|
-
puts "Your Solidus install is ready for Solidus 3.0"
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
desc "Upgrade to the current Solidus version"
|
|
14
|
-
task upgrade: 'upgrade:three_point_zero'
|
|
15
|
-
end
|