solidus_core 3.2.6 → 3.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 44848f344bbc0758db56eaebe0aeeac5f6fe11a130fa745dfd79675e26db52ba
4
- data.tar.gz: c56e74d595de71a9d4fa74c4220d1ae91d7af38ed9e7132766bcb4608eb5f080
3
+ metadata.gz: d2b38eb2401bb7f4cc38c7eadab97621ec03a74aab1083aaa838e7ac02a753f8
4
+ data.tar.gz: b6d75fd4b66ded6bbc9edbba1b89ecfdc112310e8aa430e4402bc6d82a4d82ef
5
5
  SHA512:
6
- metadata.gz: 7ed3a7e4f5d99f0c114b78182920af674eca75b6367f4ce93e0b683e65743e3e077eecdb27f1f02c3b65fa5cf4ec1a842f82363c4e66becad01b50b22f92cf98
7
- data.tar.gz: a35530c9833699ad3cfee06f1c9474e67762b29ad6e57665790f1b310b5859d9dd173fb239ee68467c2e6c6ddc686e03dae62b8b80f543ab1d4272853fb971ee
6
+ metadata.gz: b383febf1f4b46763aca57b0cc491a66f9e5cd407579d302f9fdbf9421d9a61f9a6f0ab89c570c5a61bc444ab17a18e8b86ab3fe088a4ce4354cb3b0c22b1208
7
+ data.tar.gz: 351d24867375e4b103d49ab1fa084acea266af23a883f0d83005e574ef5d6fa51d07d39f9a6fe507298ddb403d2db6982ed204651649e21c0f7c3ab76db81b0b
@@ -32,6 +32,12 @@ module Spree
32
32
  prices.build(self.class.default_price_attributes)
33
33
  end
34
34
 
35
+ # @deprecated Use {#default_price_or_build} instead.
36
+ def find_or_build_default_price
37
+ default_price_or_build
38
+ end
39
+ deprecate find_or_build_default_price: :default_price_or_build, deprecator: Spree::Deprecation
40
+
35
41
  # Select from {#prices} the one to be considered as the default
36
42
  #
37
43
  # This method works with the in-memory association, so non-persisted prices
@@ -83,6 +83,7 @@ module Spree
83
83
  :height,
84
84
  :price,
85
85
  :sku,
86
+ :track_inventory,
86
87
  :weight,
87
88
  :width,
88
89
  ]
@@ -8,7 +8,7 @@ module Solidus
8
8
  class UpdateGenerator < ::Rails::Generators::Base
9
9
  FROM = Spree.previous_solidus_minor_version
10
10
 
11
- desc 'Generates a new initializer to preview the new defaults for current Solidus version'
11
+ desc 'Generates a new initializer to preview the new defaults for current Solidus version and copy new migrations'
12
12
 
13
13
  source_root File.expand_path('templates', __dir__)
14
14
 
@@ -37,10 +37,15 @@ module Solidus
37
37
  default: 'config/initializers/',
38
38
  hide: true
39
39
 
40
+ class_option :install_migrations,
41
+ type: :boolean,
42
+ default: true,
43
+ hide: true
44
+
40
45
  def create_new_defaults_initializer
41
46
  previous_version_prompt = options[:previous_version_prompt]
42
47
  return if previous_version_prompt && !yes?(<<~MSG, :red)
43
- The update process is only supported if you are coming from version #{FROM}. If this is not the case, please, skip it and update your application to use Solidus #{FROM} before retrying.
48
+ The default preferences update process is only supported if you are coming from version #{FROM}. If this is not the case, please, skip it and update your application to use Solidus #{FROM} before retrying.
44
49
  If you are confident you want to upgrade from a previous version, you must rerun the generator with the "--from={OLD_VERSION}" argument.
45
50
  Are you sure you want to continue? (y/N)
46
51
  MSG
@@ -57,6 +62,13 @@ module Solidus
57
62
  File.join(options[:initializer_directory], "#{options[:initializer_basename]}.rb")
58
63
  end
59
64
 
65
+ def install_migrations
66
+ return unless options[:install_migrations]
67
+
68
+ say_status :copying, "migrations"
69
+ rake 'spree:install:migrations'
70
+ end
71
+
60
72
  def print_message
61
73
  say <<~MSG
62
74
 
@@ -87,6 +87,7 @@ module Spree
87
87
 
88
88
  config.after_initialize do
89
89
  Spree::Config.check_load_defaults_called('Spree::Config')
90
+ Spree::Config.static_model_preferences.validate!
90
91
  end
91
92
 
92
93
  config.after_initialize do
@@ -45,7 +45,7 @@ module Spree
45
45
  new_master.sku = "COPY OF #{master.sku}"
46
46
  new_master.deleted_at = nil
47
47
  new_master.images = master.images.map { |image| duplicate_image image } if @include_images
48
- new_master.price = master.price
48
+ new_master.prices = master.prices.map(&:dup)
49
49
  end
50
50
  end
51
51
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spree
4
- VERSION = "3.2.6"
4
+ VERSION = "3.2.7"
5
5
 
6
6
  def self.solidus_version
7
7
  VERSION
@@ -7,13 +7,8 @@ module Spree
7
7
  attr_reader :preferences
8
8
 
9
9
  def initialize(klass, hash)
10
- hash = hash.symbolize_keys
11
- hash.keys.each do |key|
12
- if !klass.defined_preferences.include?(key)
13
- raise "Preference #{key.inspect} is not defined on #{klass}"
14
- end
15
- end
16
- @preferences = hash
10
+ @klass = klass
11
+ @preferences = hash.symbolize_keys
17
12
  end
18
13
 
19
14
  def fetch(key, &block)
@@ -27,6 +22,8 @@ module Spree
27
22
  def to_hash
28
23
  @preferences.deep_dup
29
24
  end
25
+
26
+ delegate :keys, to: :@preferences
30
27
  end
31
28
 
32
29
  def initialize
@@ -36,12 +33,32 @@ module Spree
36
33
  end
37
34
 
38
35
  def add(klass, name, preferences)
39
- @store[klass.to_s][name] = Definition.new(klass, preferences)
36
+ @store[klass.to_s][name] = Definition.new(klass.to_s, preferences)
40
37
  end
41
38
 
42
39
  def for_class(klass)
43
40
  @store[klass.to_s]
44
41
  end
42
+
43
+ def validate!
44
+ @store.keys.map(&:constantize).each do |klass|
45
+ validate_for_class!(klass)
46
+ end
47
+ end
48
+
49
+ private
50
+
51
+ def validate_for_class!(klass)
52
+ for_class(klass).each do |name, preferences|
53
+ klass_keys = klass.defined_preferences.map(&:to_s)
54
+ extra_keys = preferences.keys.map(&:to_s) - klass_keys
55
+ next if extra_keys.empty?
56
+
57
+ raise \
58
+ "Unexpected keys found for #{klass} under #{name}: #{extra_keys.sort.join(', ')} " \
59
+ "(expected keys: #{klass_keys.sort.join(', ')})"
60
+ end
61
+ end
45
62
  end
46
63
  end
47
64
  end
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.2.6
4
+ version: 3.2.7
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: 2023-02-07 00:00:00.000000000 Z
11
+ date: 2023-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer
@@ -1023,8 +1023,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1023
1023
  - !ruby/object:Gem::Version
1024
1024
  version: 1.8.23
1025
1025
  requirements: []
1026
- rubygems_version: 3.3.7
1027
- signing_key:
1026
+ rubygems_version: 3.4.6
1027
+ signing_key:
1028
1028
  specification_version: 4
1029
1029
  summary: Essential models, mailers, and classes for the Solidus e-commerce project.
1030
1030
  test_files: []