solidus_support 0.14.0 → 0.15.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2cdd9849818af1dc56048136d30a8198d6d79c7245250824283659a47c396932
4
- data.tar.gz: e82afa4bcca816ad08c7b0afb4ff09279104c99c111818d96ba26cf0f7dab2f7
3
+ metadata.gz: '09d239fe1d57fc84f17af961c9de4e51cbb83a4e80d286fec98a12a777e58318'
4
+ data.tar.gz: 4e1e4faba60077e35bf756a420f97ff5c2e3edb4401e07188722bfff4d25e10d
5
5
  SHA512:
6
- metadata.gz: f619198e4c09da849dbab523854002358b35183d9c1cf13c5a24ae4001a986b6d5c38c5edc8d4ea06412581f4f14080a0abc1628d948409dbf47dc7be5364ee0
7
- data.tar.gz: bb3060ebe160c24dca44376cab8d5c1cdb3bf377cc47312a1a70d15eaeabee3df045d566d464433f86b0943a24dbd5e2cbfd907a89c21374808defc0a054de72
6
+ metadata.gz: 62f69a22c52a8e967c345b3a4a0cfb1d892228b38029648d440094676b969f4f43f32e5ea5b75e2a840e007c2ad977ea37f2dd379a869c26252d8669fa226ae6
7
+ data.tar.gz: 036dfff49abd5b21c674418af832bcb17fdc3b8bc1630cfda2aea6ffdaf4f5ee278498c7d3b9092cfa8b6369440b7d3bba54223155c07e6a92c73db1a57e427d
data/README.md CHANGED
@@ -9,26 +9,6 @@ If you are looking for development tools instead, see
9
9
 
10
10
  ## Usage
11
11
 
12
- ### `SolidusSupport::Migration`
13
-
14
- Rails >= 5 introduced the concept of specifying what Rails version your migration was written for,
15
- like `ActiveRecord::Migration[5.0]`. Not specifying a version is deprecated in Rails 5.0 and removed
16
- in Rails 5.1. This wasn't backported to Rails 4.2, so we provide this helper to return the right
17
- parent class:
18
-
19
- ``` ruby
20
- # On Rails 4.2
21
- SolidusSupport::Migration[4.2] # returns `ActiveRecord::Migration`
22
- SolidusSupport::Migration[5.0] # errors
23
-
24
- # On Rails 5.0
25
- SolidusSupport::Migration[4.2] # same as `ActiveRecord::Migration[4.2]`
26
- SolidusSupport::Migration[5.0] # same as `ActiveRecord::Migration[5.0]`
27
- ```
28
-
29
- There's no reason to use `SolidusSupport::Migration[5.0]` over `ActiveRecord::Migration[5.0]`, but
30
- it is provided.
31
-
32
12
  ### Engine extensions
33
13
 
34
14
  This extension provides a module that decorates `Rails::Engine` to seamlessly support autoloading
@@ -37,16 +37,16 @@ module SolidusSupport
37
37
  # This allows to add event subscribers to extensions without explicitly subscribing them,
38
38
  # similarly to what happens in Solidus core.
39
39
  def load_solidus_subscribers_from(path)
40
- if SolidusSupport::LegacyEventCompat.using_legacy?
41
- path.glob("**/*_subscriber.rb") do |subscriber_path|
42
- require_dependency(subscriber_path)
43
- end
40
+ return unless SolidusSupport::LegacyEventCompat.using_legacy?
44
41
 
45
- if Spree::Event.respond_to?(:activate_all_subscribers)
46
- Spree::Event.activate_all_subscribers
47
- else
48
- Spree::Event.subscribers.each(&:subscribe!)
49
- end
42
+ path.glob("**/*_subscriber.rb") do |subscriber_path|
43
+ require_dependency(subscriber_path)
44
+ end
45
+
46
+ if Spree::Event.respond_to?(:activate_all_subscribers)
47
+ Spree::Event.activate_all_subscribers
48
+ else
49
+ Spree::Event.subscribers.each(&:subscribe!)
50
50
  end
51
51
  end
52
52
 
@@ -113,11 +113,9 @@ module SolidusSupport
113
113
 
114
114
  if SolidusSupport.send(:"#{engine}_available?")
115
115
  decorators_path = root.join("lib/decorators/#{engine}")
116
- patches_path = root.join("lib/patches/#{engine}")
117
116
  controllers_path = root.join("lib/controllers/#{engine}")
118
117
  components_path = root.join("lib/components/#{engine}")
119
118
  config.autoload_paths += decorators_path.glob('*')
120
- config.autoload_paths += patches_path.glob("*")
121
119
  config.autoload_paths << controllers_path if controllers_path.exist?
122
120
  config.autoload_paths << components_path if components_path.exist?
123
121
 
@@ -130,13 +128,20 @@ module SolidusSupport
130
128
  end
131
129
 
132
130
  initializer "#{engine_name}_#{engine}_patch_paths" do
133
- patch_paths = root.join("lib/patches/#{engine}").glob("*")
134
- Flickwerk.patch_paths += patch_paths
131
+ if SolidusSupport.send(:"#{engine}_available?")
132
+ patch_paths = root.join("lib/patches/#{engine}").glob("*")
133
+ config.autoload_paths += patch_paths
134
+ Flickwerk.patch_paths += patch_paths
135
+ end
135
136
  end
136
137
 
137
138
  initializer "#{engine_name}_#{engine}_user_patches" do |app|
138
139
  app.reloader.to_prepare do
139
- Flickwerk.aliases["Spree.user_class"] = Spree.user_class_name
140
+ Flickwerk.aliases["Spree.user_class"] = if Spree.respond_to?(:user_class_name)
141
+ Spree.user_class_name
142
+ else
143
+ Spree.user_class.name
144
+ end
140
145
  end
141
146
  end
142
147
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusSupport
4
- VERSION = '0.14.0'
4
+ VERSION = '0.15.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Hawthorn
8
8
  - Solidus Team
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-11 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: flickwerk
@@ -205,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
205
  - !ruby/object:Gem::Version
206
206
  version: '0'
207
207
  requirements: []
208
- rubygems_version: 3.6.3
208
+ rubygems_version: 3.6.9
209
209
  specification_version: 4
210
210
  summary: Common runtime helpers for Solidus extensions.
211
211
  test_files: