solidus_support 0.5.0 → 0.8.1
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/CHANGELOG.md +52 -0
- data/Gemfile +12 -0
- data/bin/console +1 -0
- data/lib/solidus_support.rb +12 -2
- data/lib/solidus_support/engine_extensions.rb +33 -8
- data/lib/solidus_support/version.rb +1 -1
- data/solidus_support.gemspec +1 -3
- data/spec/solidus_support_spec.rb +34 -1
- data/spec/support/dummy_app.rb +0 -1
- metadata +11 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 290b6b3d8d102c5a9346057f08c18b039395082f0d4a8ee7b59cff3f110d57a1
|
4
|
+
data.tar.gz: f6354f111b2875c3baac252f4046498f7f0e69cb7189f9d86a8c050a389c1c39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 193f63e10976f25a5b167603d53c0b9187e6edd2928dc2a5a56fb32b1599d58eec9afff4335a2dca4de6bd322e6b484a7866f8a19e3c5aebe6b69d6d2d426dd3
|
7
|
+
data.tar.gz: 602577640b806f17fd30d5bd90bda6b21bfd6fdf73b74674b88ae288365f1a5bb3eced6897e239fb3b2a415c396c2ed2612fdcc9ca87712c427b461194ac73d8
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,57 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v0.7.0](https://github.com/solidusio/solidus_support/tree/v0.7.0) (2020-10-28)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.6.0...v0.7.0)
|
6
|
+
|
7
|
+
**Closed issues:**
|
8
|
+
|
9
|
+
- Could we get a new release? [\#49](https://github.com/solidusio/solidus_support/issues/49)
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- Use `Spree::Event. activate\_all\_subscribers` when available [\#53](https://github.com/solidusio/solidus_support/pull/53) ([spaghetticode](https://github.com/spaghetticode))
|
14
|
+
- Support Rails 5.1.x [\#51](https://github.com/solidusio/solidus_support/pull/51) ([brchristian](https://github.com/brchristian))
|
15
|
+
- Remove redundant `solidus\_core` dev dependency [\#50](https://github.com/solidusio/solidus_support/pull/50) ([brchristian](https://github.com/brchristian))
|
16
|
+
|
17
|
+
## [v0.6.0](https://github.com/solidusio/solidus_support/tree/v0.6.0) (2020-07-24)
|
18
|
+
|
19
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.5.1...v0.6.0)
|
20
|
+
|
21
|
+
**Implemented enhancements:**
|
22
|
+
|
23
|
+
- Autoload Solidus Event subscribers from extensions [\#45](https://github.com/solidusio/solidus_support/pull/45) ([spaghetticode](https://github.com/spaghetticode))
|
24
|
+
|
25
|
+
**Fixed bugs:**
|
26
|
+
|
27
|
+
- Load event subscribers only when Spree::Event is available [\#47](https://github.com/solidusio/solidus_support/pull/47) ([spaghetticode](https://github.com/spaghetticode))
|
28
|
+
|
29
|
+
**Closed issues:**
|
30
|
+
|
31
|
+
- Namespace Conflicts [\#48](https://github.com/solidusio/solidus_support/issues/48)
|
32
|
+
|
33
|
+
**Merged pull requests:**
|
34
|
+
|
35
|
+
- Stop using SolidusSupport.solidus\_gem\_version [\#46](https://github.com/solidusio/solidus_support/pull/46) ([elia](https://github.com/elia))
|
36
|
+
- Add frontend/backend/api decorators to autoload path [\#44](https://github.com/solidusio/solidus_support/pull/44) ([kennyadsl](https://github.com/kennyadsl))
|
37
|
+
|
38
|
+
## [v0.5.1](https://github.com/solidusio/solidus_support/tree/v0.5.1) (2020-04-15)
|
39
|
+
|
40
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.5.0...v0.5.1)
|
41
|
+
|
42
|
+
**Merged pull requests:**
|
43
|
+
|
44
|
+
- Push decorators to autoload path using config.autoload\_paths [\#43](https://github.com/solidusio/solidus_support/pull/43) ([kennyadsl](https://github.com/kennyadsl))
|
45
|
+
|
46
|
+
## [v0.5.0](https://github.com/solidusio/solidus_support/tree/v0.5.0) (2020-02-18)
|
47
|
+
|
48
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.4.1...v0.5.0)
|
49
|
+
|
50
|
+
**Merged pull requests:**
|
51
|
+
|
52
|
+
- Load Solidus engine extension files automatically [\#42](https://github.com/solidusio/solidus_support/pull/42) ([aldesantis](https://github.com/aldesantis))
|
53
|
+
- Deprecate SolidusSupport.solidus\_gem\_version [\#37](https://github.com/solidusio/solidus_support/pull/37) ([kennyadsl](https://github.com/kennyadsl))
|
54
|
+
|
3
55
|
## [v0.4.1](https://github.com/solidusio/solidus_support/tree/v0.4.1) (2020-01-16)
|
4
56
|
|
5
57
|
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.4.0...v0.4.1)
|
data/Gemfile
CHANGED
@@ -16,3 +16,15 @@ else
|
|
16
16
|
end
|
17
17
|
|
18
18
|
gemspec
|
19
|
+
|
20
|
+
# There is an issue with Sprockets 4 not accepting a custom path for
|
21
|
+
# the assets manifest, which doesn't play well with in-memory dummy
|
22
|
+
# apps such as the one we use in this gem.
|
23
|
+
|
24
|
+
# A fix was provided for sprockets-rails[1] but it was not accepted
|
25
|
+
# yet.
|
26
|
+
|
27
|
+
# [1]: rails/sprockets-rails#446
|
28
|
+
#
|
29
|
+
# Please do not remove this line until we have a solution.
|
30
|
+
gem 'sprockets', '~> 3'
|
data/bin/console
CHANGED
data/lib/solidus_support.rb
CHANGED
@@ -18,12 +18,22 @@ 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
|
+
end
|
23
|
+
|
24
|
+
def combined_first_and_last_name_in_address?
|
25
|
+
versions_before_preference = Gem::Requirement.new('< 2.11.0')
|
26
|
+
versions_after_preference = Gem::Requirement.new('>= 3.0.0.alpha')
|
27
|
+
|
28
|
+
return false if versions_before_preference.satisfied_by?(Spree.solidus_gem_version)
|
29
|
+
return true if versions_after_preference.satisfied_by?(Spree.solidus_gem_version)
|
30
|
+
|
31
|
+
Spree::Config.use_combined_first_and_last_name_in_address
|
22
32
|
end
|
23
33
|
|
24
34
|
def new_gateway_code?
|
25
35
|
first_version_with_new_gateway_code = Gem::Requirement.new('>= 2.3')
|
26
|
-
first_version_with_new_gateway_code.satisfied_by?(solidus_gem_version)
|
36
|
+
first_version_with_new_gateway_code.satisfied_by?(Spree.solidus_gem_version)
|
27
37
|
end
|
28
38
|
|
29
39
|
def payment_source_parent_class
|
@@ -9,6 +9,10 @@ module SolidusSupport
|
|
9
9
|
engine.extend ClassMethods
|
10
10
|
|
11
11
|
engine.class_eval do
|
12
|
+
solidus_decorators_root.glob('*') do |decorators_folder|
|
13
|
+
config.autoload_paths += [decorators_folder]
|
14
|
+
end
|
15
|
+
|
12
16
|
config.to_prepare(&method(:activate))
|
13
17
|
|
14
18
|
enable_solidus_engine_support('backend') if SolidusSupport.backend_available?
|
@@ -19,15 +23,26 @@ module SolidusSupport
|
|
19
23
|
|
20
24
|
module ClassMethods
|
21
25
|
def activate
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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)
|
27
38
|
end
|
28
|
-
end
|
29
39
|
|
30
|
-
|
40
|
+
if Spree::Event.respond_to?(:activate_all_subscribers)
|
41
|
+
Spree::Event.activate_all_subscribers
|
42
|
+
else
|
43
|
+
Spree::Event.subscribers.each(&:subscribe!)
|
44
|
+
end
|
45
|
+
end
|
31
46
|
end
|
32
47
|
|
33
48
|
# Loads decorator files.
|
@@ -50,6 +65,13 @@ module SolidusSupport
|
|
50
65
|
root.join('app/decorators')
|
51
66
|
end
|
52
67
|
|
68
|
+
# Returns the root for this engine's Solidus event subscribers.
|
69
|
+
#
|
70
|
+
# @return [Path]
|
71
|
+
def solidus_subscribers_root
|
72
|
+
root.join("app/subscribers")
|
73
|
+
end
|
74
|
+
|
53
75
|
# Enables support for a Solidus engine.
|
54
76
|
#
|
55
77
|
# This will tell Rails to:
|
@@ -63,10 +85,13 @@ module SolidusSupport
|
|
63
85
|
paths['app/controllers'] << "lib/controllers/#{engine}"
|
64
86
|
paths['app/views'] << "lib/views/#{engine}"
|
65
87
|
|
88
|
+
path = root.join("lib/decorators/#{engine}")
|
89
|
+
|
90
|
+
config.autoload_paths += path.glob('*')
|
91
|
+
|
66
92
|
engine_context = self
|
67
93
|
config.to_prepare do
|
68
94
|
engine_context.instance_eval do
|
69
|
-
path = root.join("lib/decorators/#{engine}")
|
70
95
|
load_solidus_decorators_from(path)
|
71
96
|
end
|
72
97
|
end
|
data/solidus_support.gemspec
CHANGED
@@ -21,13 +21,11 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
s.require_paths = ["lib"]
|
23
23
|
|
24
|
-
s.
|
25
|
-
|
24
|
+
s.add_development_dependency 'rails'
|
26
25
|
s.add_development_dependency 'bundler'
|
27
26
|
s.add_development_dependency 'rake'
|
28
27
|
s.add_development_dependency 'rspec-rails'
|
29
28
|
s.add_development_dependency 'rubocop'
|
30
29
|
s.add_development_dependency 'rubocop-rspec'
|
31
|
-
s.add_development_dependency 'solidus_core'
|
32
30
|
s.add_development_dependency 'solidus_dev_support'
|
33
31
|
end
|
@@ -7,7 +7,7 @@ RSpec.describe SolidusSupport do
|
|
7
7
|
let(:credit_card) { nil }
|
8
8
|
|
9
9
|
before do
|
10
|
-
allow(
|
10
|
+
allow(Spree).to receive(:solidus_gem_version) do
|
11
11
|
Gem::Version.new(solidus_version)
|
12
12
|
end
|
13
13
|
end
|
@@ -42,4 +42,37 @@ RSpec.describe SolidusSupport do
|
|
42
42
|
end
|
43
43
|
# rubocop:enable RSpec/NestedGroups
|
44
44
|
end
|
45
|
+
|
46
|
+
describe '.combined_first_and_last_name_in_address?' do
|
47
|
+
subject { described_class.combined_first_and_last_name_in_address? }
|
48
|
+
|
49
|
+
before do
|
50
|
+
allow(Spree).to receive(:solidus_gem_version) do
|
51
|
+
Gem::Version.new(solidus_version)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context 'when Solidus did not have the code to combine addresses fields' do
|
56
|
+
let(:solidus_version) { '2.9.3' }
|
57
|
+
|
58
|
+
it { is_expected.to be_falsey }
|
59
|
+
end
|
60
|
+
|
61
|
+
context 'when Solidus has preference to choose if combine addresses fields' do
|
62
|
+
let(:solidus_version) { '2.11.3' }
|
63
|
+
before do
|
64
|
+
allow(Spree::Config)
|
65
|
+
.to receive(:use_combined_first_and_last_name_in_address)
|
66
|
+
.and_return(true)
|
67
|
+
end
|
68
|
+
|
69
|
+
it { is_expected.to be_truthy }
|
70
|
+
end
|
71
|
+
|
72
|
+
context 'when Solidus only has code to combine addresses fields' do
|
73
|
+
let(:solidus_version) { '3.0.0' }
|
74
|
+
|
75
|
+
it { is_expected.to be_truthy }
|
76
|
+
end
|
77
|
+
end
|
45
78
|
end
|
data/spec/support/dummy_app.rb
CHANGED
@@ -14,7 +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
|
-
config.active_record.sqlite3.represent_boolean_as_integer = true
|
18
17
|
end
|
19
18
|
end
|
20
19
|
|
metadata
CHANGED
@@ -1,35 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.1
|
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:
|
11
|
+
date: 2021-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 7.0.x
|
23
|
-
type: :runtime
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 7.0.x
|
26
|
+
version: '0'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: bundler
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,20 +94,6 @@ dependencies:
|
|
100
94
|
- - ">="
|
101
95
|
- !ruby/object:Gem::Version
|
102
96
|
version: '0'
|
103
|
-
- !ruby/object:Gem::Dependency
|
104
|
-
name: solidus_core
|
105
|
-
requirement: !ruby/object:Gem::Requirement
|
106
|
-
requirements:
|
107
|
-
- - ">="
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
110
|
-
type: :development
|
111
|
-
prerelease: false
|
112
|
-
version_requirements: !ruby/object:Gem::Requirement
|
113
|
-
requirements:
|
114
|
-
- - ">="
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
version: '0'
|
117
97
|
- !ruby/object:Gem::Dependency
|
118
98
|
name: solidus_dev_support
|
119
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,7 +108,7 @@ dependencies:
|
|
128
108
|
- - ">="
|
129
109
|
- !ruby/object:Gem::Version
|
130
110
|
version: '0'
|
131
|
-
description:
|
111
|
+
description:
|
132
112
|
email: john@stembolt.com
|
133
113
|
executables: []
|
134
114
|
extensions: []
|
@@ -161,7 +141,7 @@ homepage: https://github.com/solidusio/solidus_support
|
|
161
141
|
licenses:
|
162
142
|
- BSD-3-Clause
|
163
143
|
metadata: {}
|
164
|
-
post_install_message:
|
144
|
+
post_install_message:
|
165
145
|
rdoc_options: []
|
166
146
|
require_paths:
|
167
147
|
- lib
|
@@ -176,8 +156,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
176
156
|
- !ruby/object:Gem::Version
|
177
157
|
version: '0'
|
178
158
|
requirements: []
|
179
|
-
rubygems_version: 3.
|
180
|
-
signing_key:
|
159
|
+
rubygems_version: 3.1.4
|
160
|
+
signing_key:
|
181
161
|
specification_version: 4
|
182
162
|
summary: Common runtime helpers for Solidus extensions.
|
183
163
|
test_files:
|