solidus_support 0.5.1 → 0.6.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: d0418d7c8da75d25d26361a1df289e43da888b5467ca4117db150f4d48bbcc2f
4
- data.tar.gz: c7bd4f7e00c64f65e3406419ca109a4ba07f29b0f024421f2cf3326f7968c844
3
+ metadata.gz: 52891f7c46410b049481d932d3936da5530d1eabd601d0af44760398b4560200
4
+ data.tar.gz: 47b62f091de89edaf01b1e57ce6b1fdf10c558f801ead911822b88bbd8baffa7
5
5
  SHA512:
6
- metadata.gz: d94c4a8544749e76b9e32c7b07df94b2c7e94f9ed7fd08297af4f76c0cea669b0428dc31907ee6b1ebd535c365c181404bf417f835628f3c68503403b296eb41
7
- data.tar.gz: 5a66ef8363f605ca39417ff732a1b5ae5a7dc2350bc908ebf717a8e55ec543f9524c50dacaaa923cd6afb74ee044eafef5da2431dee3caa34be3b694eb2f2836
6
+ metadata.gz: 2e55cb09d122d874ae9548420477d71a001fa7835f0027c976fca6cfef89351f0546b9477a5d219b9c80c15858e46edf510763b97301adf633dcaa97512d7237
7
+ data.tar.gz: 965ee76ae136fe8fc11987327044994b4fb1162a9f5516b1c50a47103ecc068acbf8cdc5ba5af68cb1b6e11bf41eb3c10bb50b0291f249dcee0c45341e0cfcd4
@@ -18,12 +18,12 @@ module SolidusSupport
18
18
 
19
19
  def reset_spree_preferences_deprecated?
20
20
  first_version_without_reset = Gem::Requirement.new('>= 2.9')
21
- first_version_without_reset.satisfied_by?(solidus_gem_version)
21
+ first_version_without_reset.satisfied_by?(Spree.solidus_gem_version)
22
22
  end
23
23
 
24
24
  def new_gateway_code?
25
25
  first_version_with_new_gateway_code = Gem::Requirement.new('>= 2.3')
26
- first_version_with_new_gateway_code.satisfied_by?(solidus_gem_version)
26
+ first_version_with_new_gateway_code.satisfied_by?(Spree.solidus_gem_version)
27
27
  end
28
28
 
29
29
  def payment_source_parent_class
@@ -24,6 +24,20 @@ module SolidusSupport
24
24
  module ClassMethods
25
25
  def activate
26
26
  load_solidus_decorators_from(solidus_decorators_root)
27
+ load_solidus_subscribers_from(solidus_subscribers_root)
28
+ end
29
+
30
+ # Loads Solidus event subscriber files.
31
+ #
32
+ # This allows to add event subscribers to extensions without explicitly subscribing them,
33
+ # similarly to what happens in Solidus core.
34
+ def load_solidus_subscribers_from(path)
35
+ if defined? Spree::Event
36
+ path.glob("**/*_subscriber.rb") do |subscriber_path|
37
+ require_dependency(subscriber_path)
38
+ end
39
+ Spree::Event.subscribers.each(&:subscribe!)
40
+ end
27
41
  end
28
42
 
29
43
  # Loads decorator files.
@@ -46,6 +60,13 @@ module SolidusSupport
46
60
  root.join('app/decorators')
47
61
  end
48
62
 
63
+ # Returns the root for this engine's Solidus event subscribers.
64
+ #
65
+ # @return [Path]
66
+ def solidus_subscribers_root
67
+ root.join("app/subscribers")
68
+ end
69
+
49
70
  # Enables support for a Solidus engine.
50
71
  #
51
72
  # This will tell Rails to:
@@ -59,10 +80,13 @@ module SolidusSupport
59
80
  paths['app/controllers'] << "lib/controllers/#{engine}"
60
81
  paths['app/views'] << "lib/views/#{engine}"
61
82
 
83
+ path = root.join("lib/decorators/#{engine}")
84
+
85
+ config.autoload_paths += path.glob('*')
86
+
62
87
  engine_context = self
63
88
  config.to_prepare do
64
89
  engine_context.instance_eval do
65
- path = root.join("lib/decorators/#{engine}")
66
90
  load_solidus_decorators_from(path)
67
91
  end
68
92
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusSupport
4
- VERSION = '0.5.1'
4
+ VERSION = '0.6.0'
5
5
  end
@@ -7,7 +7,7 @@ RSpec.describe SolidusSupport do
7
7
  let(:credit_card) { nil }
8
8
 
9
9
  before do
10
- allow(described_class).to receive(:solidus_gem_version) do
10
+ allow(Spree).to receive(:solidus_gem_version) do
11
11
  Gem::Version.new(solidus_version)
12
12
  end
13
13
  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.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Hawthorn
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-15 00:00:00.000000000 Z
11
+ date: 2020-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -128,7 +128,7 @@ dependencies:
128
128
  - - ">="
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
- description:
131
+ description:
132
132
  email: john@stembolt.com
133
133
  executables: []
134
134
  extensions: []
@@ -152,7 +152,6 @@ files:
152
152
  - lib/solidus_support/migration.rb
153
153
  - lib/solidus_support/version.rb
154
154
  - solidus_support.gemspec
155
- - spec/examples.txt
156
155
  - spec/solidus_support_spec.rb
157
156
  - spec/spec_helper.rb
158
157
  - spec/support/dummy_app.rb
@@ -161,7 +160,7 @@ homepage: https://github.com/solidusio/solidus_support
161
160
  licenses:
162
161
  - BSD-3-Clause
163
162
  metadata: {}
164
- post_install_message:
163
+ post_install_message:
165
164
  rdoc_options: []
166
165
  require_paths:
167
166
  - lib
@@ -176,13 +175,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
175
  - !ruby/object:Gem::Version
177
176
  version: '0'
178
177
  requirements: []
179
- rubygems_version: 3.0.3
180
- signing_key:
178
+ rubygems_version: 3.0.8
179
+ signing_key:
181
180
  specification_version: 4
182
181
  summary: Common runtime helpers for Solidus extensions.
183
182
  test_files:
184
183
  - spec/spec_helper.rb
185
- - spec/examples.txt
186
184
  - spec/solidus_support_spec.rb
187
185
  - spec/support/dummy_app.rb
188
186
  - spec/support/dummy_app/database.yml