solidus_support 0.13.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/solidus_support/engine_extensions.rb +29 -1
- data/lib/solidus_support/legacy_event_compat/bus.rb +4 -0
- data/lib/solidus_support/legacy_event_compat/subscriber.rb +4 -0
- data/lib/solidus_support/migration.rb +4 -9
- data/lib/solidus_support/version.rb +1 -1
- data/solidus_support.gemspec +3 -0
- data/spec/support/dummy_app.rb +0 -3
- metadata +31 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cdd9849818af1dc56048136d30a8198d6d79c7245250824283659a47c396932
|
4
|
+
data.tar.gz: e82afa4bcca816ad08c7b0afb4ff09279104c99c111818d96ba26cf0f7dab2f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f619198e4c09da849dbab523854002358b35183d9c1cf13c5a24ae4001a986b6d5c38c5edc8d4ea06412581f4f14080a0abc1628d948409dbf47dc7be5364ee0
|
7
|
+
data.tar.gz: bb3060ebe160c24dca44376cab8d5c1cdb3bf377cc47312a1a70d15eaeabee3df045d566d464433f86b0943a24dbd5e2cbfd907a89c21374808defc0a054de72
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[](https://dl.circleci.com/status-badge/redirect/gh/solidusio/solidus_support/tree/main)
|
2
|
+
|
1
3
|
# SolidusSupport
|
2
4
|
|
3
5
|
This gem contains common runtime functionality for Solidus extensions.
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "active_support/deprecation"
|
4
|
+
require "flickwerk"
|
4
5
|
|
5
6
|
module SolidusSupport
|
6
7
|
module EngineExtensions
|
@@ -9,6 +10,7 @@ module SolidusSupport
|
|
9
10
|
|
10
11
|
def self.included(engine)
|
11
12
|
engine.extend ClassMethods
|
13
|
+
engine.include Flickwerk
|
12
14
|
|
13
15
|
engine.class_eval do
|
14
16
|
solidus_decorators_root.glob('*') do |decorators_folder|
|
@@ -102,7 +104,7 @@ module SolidusSupport
|
|
102
104
|
# by those gems, we work around those gems by adding our paths before
|
103
105
|
# `initialize_cache`, which is the Rails initializer called before
|
104
106
|
# `set_load_path`.
|
105
|
-
initializer "#{
|
107
|
+
initializer "#{engine_name}_#{engine}_paths", before: :initialize_cache do
|
106
108
|
if SolidusSupport.send(:"#{engine}_available?")
|
107
109
|
paths['app/controllers'] << "lib/controllers/#{engine}"
|
108
110
|
paths['app/views'] << "lib/views/#{engine}"
|
@@ -111,9 +113,11 @@ module SolidusSupport
|
|
111
113
|
|
112
114
|
if SolidusSupport.send(:"#{engine}_available?")
|
113
115
|
decorators_path = root.join("lib/decorators/#{engine}")
|
116
|
+
patches_path = root.join("lib/patches/#{engine}")
|
114
117
|
controllers_path = root.join("lib/controllers/#{engine}")
|
115
118
|
components_path = root.join("lib/components/#{engine}")
|
116
119
|
config.autoload_paths += decorators_path.glob('*')
|
120
|
+
config.autoload_paths += patches_path.glob("*")
|
117
121
|
config.autoload_paths << controllers_path if controllers_path.exist?
|
118
122
|
config.autoload_paths << components_path if components_path.exist?
|
119
123
|
|
@@ -124,6 +128,30 @@ module SolidusSupport
|
|
124
128
|
end
|
125
129
|
end
|
126
130
|
end
|
131
|
+
|
132
|
+
initializer "#{engine_name}_#{engine}_patch_paths" do
|
133
|
+
patch_paths = root.join("lib/patches/#{engine}").glob("*")
|
134
|
+
Flickwerk.patch_paths += patch_paths
|
135
|
+
end
|
136
|
+
|
137
|
+
initializer "#{engine_name}_#{engine}_user_patches" do |app|
|
138
|
+
app.reloader.to_prepare do
|
139
|
+
Flickwerk.aliases["Spree.user_class"] = Spree.user_class_name
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
initializer "eager_load_#{engine_name}_#{engine}_patches" do |app|
|
144
|
+
# Solidus versions < 4.5 `require` some of their application code.
|
145
|
+
# This leads to hard-to-debug problems with Flickwerk patches.
|
146
|
+
# What this does is eager-load all the patches in a `to_prepare`
|
147
|
+
# hook by constantizing them.
|
148
|
+
# You can override this behavior by setting the environment variable `SOLIDUS_LAZY_LOAD_PATCHES`.
|
149
|
+
if Spree.solidus_gem_version < Gem::Version.new("4.5.0.a") && !ENV["SOLIDUS_LAZY_LOAD_PATCHES"]
|
150
|
+
app.reloader.to_prepare do
|
151
|
+
Flickwerk.patches.each_value { _1.each(&:constantize) }
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
127
155
|
end
|
128
156
|
end
|
129
157
|
end
|
@@ -23,6 +23,10 @@ module SolidusSupport
|
|
23
23
|
# @param event_name [Symbol]
|
24
24
|
# @param payload [Hash<Symbol, Any>]
|
25
25
|
def self.publish(event_name, **payload)
|
26
|
+
SolidusSupport.deprecator.warn(
|
27
|
+
"SolidusSupport::LegacyEventCompat::Bus is deprecated and will be removed in solidus_support 1.0." \
|
28
|
+
" Please use Spree::Bus.publish instead."
|
29
|
+
)
|
26
30
|
if SolidusSupport::LegacyEventCompat.using_legacy?
|
27
31
|
Spree::Event.fire(event_name, payload)
|
28
32
|
else
|
@@ -41,6 +41,10 @@ module SolidusSupport
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def self.included(legacy_subscriber)
|
44
|
+
SolidusSupport.deprecator.warn(
|
45
|
+
"SolidusSupport::LegacyEventCompat::Subscriber is deprecated and will be removed in solidus_support 1.0." \
|
46
|
+
" Please `include Omnes::Subscriber` in `#{legacy_subscriber.name}` instead."
|
47
|
+
)
|
44
48
|
legacy_subscriber.define_singleton_method(:omnes_subscriber) do
|
45
49
|
@omnes_subscriber ||= Class.new.include(::Omnes::Subscriber).tap do |subscriber|
|
46
50
|
legacy_subscriber.event_actions.each do |(legacy_subscriber_method, event_name)|
|
@@ -3,15 +3,10 @@
|
|
3
3
|
module SolidusSupport
|
4
4
|
module Migration
|
5
5
|
def self.[](version)
|
6
|
-
|
7
|
-
ActiveRecord::Migration[version]
|
8
|
-
|
9
|
-
|
10
|
-
# it _is_ rails 4.2, so we can use that when requested.
|
11
|
-
return ActiveRecord::Migration if version.to_s == '4.2'
|
12
|
-
|
13
|
-
raise ArgumentError, "Unknown migration version '#{version}'; expected one of '4.2'"
|
14
|
-
end
|
6
|
+
SolidusSupport.deprecator.warn(
|
7
|
+
"SolidusSupport::Migration[#{version}] is deprecated. Please use ActiveRecord::Migration[#{version}] instead."
|
8
|
+
)
|
9
|
+
ActiveRecord::Migration[version]
|
15
10
|
end
|
16
11
|
end
|
17
12
|
end
|
data/solidus_support.gemspec
CHANGED
@@ -28,6 +28,9 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.executables = files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
29
|
spec.require_paths = ["lib"]
|
30
30
|
|
31
|
+
spec.add_dependency 'flickwerk', '~> 0.3.4'
|
32
|
+
spec.add_dependency 'solidus_core', '~> 4.1'
|
33
|
+
|
31
34
|
spec.add_development_dependency 'rails'
|
32
35
|
spec.add_development_dependency 'bundler'
|
33
36
|
spec.add_development_dependency 'rake'
|
data/spec/support/dummy_app.rb
CHANGED
@@ -14,9 +14,6 @@ module DummyApp
|
|
14
14
|
class Application < ::Rails::Application
|
15
15
|
config.eager_load = false
|
16
16
|
config.paths['config/database'] = File.expand_path('dummy_app/database.yml', __dir__)
|
17
|
-
if ActiveRecord::VERSION::MAJOR >= 7 && ActiveRecord::VERSION::MINOR < 1
|
18
|
-
config.active_record.legacy_connection_handling = false
|
19
|
-
end
|
20
17
|
end
|
21
18
|
end
|
22
19
|
|
metadata
CHANGED
@@ -1,16 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Hawthorn
|
8
8
|
- Solidus Team
|
9
|
-
autorequire:
|
10
9
|
bindir: exe
|
11
10
|
cert_chain: []
|
12
|
-
date: 2025-
|
11
|
+
date: 2025-02-11 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: flickwerk
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.3.4
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.3.4
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: solidus_core
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '4.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '4.1'
|
14
41
|
- !ruby/object:Gem::Dependency
|
15
42
|
name: rails
|
16
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,7 +150,6 @@ dependencies:
|
|
123
150
|
- - "~>"
|
124
151
|
- !ruby/object:Gem::Version
|
125
152
|
version: 0.2.2
|
126
|
-
description:
|
127
153
|
email: contact@solidus.io
|
128
154
|
executables: []
|
129
155
|
extensions: []
|
@@ -165,7 +191,6 @@ metadata:
|
|
165
191
|
homepage_uri: https://github.com/solidusio/solidus_support
|
166
192
|
source_code_uri: https://github.com/solidusio/solidus_support
|
167
193
|
changelog_uri: https://github.com/solidusio/solidus_support/releases
|
168
|
-
post_install_message:
|
169
194
|
rdoc_options: []
|
170
195
|
require_paths:
|
171
196
|
- lib
|
@@ -180,8 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
205
|
- !ruby/object:Gem::Version
|
181
206
|
version: '0'
|
182
207
|
requirements: []
|
183
|
-
rubygems_version: 3.
|
184
|
-
signing_key:
|
208
|
+
rubygems_version: 3.6.3
|
185
209
|
specification_version: 4
|
186
210
|
summary: Common runtime helpers for Solidus extensions.
|
187
211
|
test_files:
|