dry-system 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/README.md +1 -1
- data/dry-system.gemspec +10 -13
- data/lib/dry/system/component.rb +2 -3
- data/lib/dry/system/component_dir.rb +5 -5
- data/lib/dry/system/config/component_dir.rb +3 -3
- data/lib/dry/system/config/component_dirs.rb +5 -5
- data/lib/dry/system/config/namespaces.rb +2 -2
- data/lib/dry/system/container.rb +21 -15
- data/lib/dry/system/errors.rb +1 -1
- data/lib/dry/system/loader.rb +3 -4
- data/lib/dry/system/manifest_registrar.rb +2 -2
- data/lib/dry/system/plugins/bootsnap.rb +7 -5
- data/lib/dry/system/plugins/dependency_graph/strategies.rb +3 -3
- data/lib/dry/system/plugins/dependency_graph.rb +1 -1
- data/lib/dry/system/plugins/monitoring.rb +3 -3
- data/lib/dry/system/plugins.rb +2 -2
- data/lib/dry/system/provider/source.rb +10 -10
- data/lib/dry/system/provider/source_dsl.rb +10 -10
- data/lib/dry/system/provider.rb +4 -4
- data/lib/dry/system/provider_registrar.rb +10 -10
- data/lib/dry/system/provider_source_registry.rb +3 -3
- data/lib/dry/system/provider_sources/settings/config.rb +2 -2
- data/lib/dry/system/stubs.rb +2 -2
- data/lib/dry/system/version.rb +1 -1
- data/lib/dry/system.rb +3 -3
- metadata +15 -56
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73c4548cedcd9da37980d70bf114fca9879738c1274789da138c8e43301db4db
|
4
|
+
data.tar.gz: 2c7cc8974efaaea1e998a15ea6c91cc0e6af352ec6ccce530abca9e83356203f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: daeef02f9d5c2de8a2e66edc4474cb4ee56d0c1a0813aa967caeacb1d7cc9e0fc287667cdbb4514934599432c3ca9fa016893341dacb79fd3f56ca5b3038a1d3
|
7
|
+
data.tar.gz: '0983d69ebea6f6a4f9c653ad850aee8f5b0f5215431b3d4aa2e535b10b11a9aebb68f5305939de6e67fe03bcf8f48ba0830591b116c7ece9411f525e33277f05'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
<!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
|
2
2
|
|
3
|
+
## 1.2.0 2025-01-07
|
4
|
+
|
5
|
+
|
6
|
+
### Added
|
7
|
+
|
8
|
+
- Option to skip eager loading during finalize with `eager_load: false` (via #276) (@cllns)
|
9
|
+
|
10
|
+
### Changed
|
11
|
+
|
12
|
+
- Update required Ruby version to 3.1 (@flash-gordon)
|
13
|
+
|
14
|
+
[Compare v1.1.1...v1.2.0](https://github.com/dry-rb/dry-system/compare/v1.1.1...v1.2.0)
|
15
|
+
|
3
16
|
## 1.1.1 2024-11-03
|
4
17
|
|
5
18
|
|
data/README.md
CHANGED
data/dry-system.gemspec
CHANGED
@@ -21,20 +21,17 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = []
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
-
spec.metadata["allowed_push_host"]
|
25
|
-
spec.metadata["changelog_uri"]
|
26
|
-
spec.metadata["source_code_uri"]
|
27
|
-
spec.metadata["bug_tracker_uri"]
|
24
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
25
|
+
spec.metadata["changelog_uri"] = "https://github.com/dry-rb/dry-system/blob/main/CHANGELOG.md"
|
26
|
+
spec.metadata["source_code_uri"] = "https://github.com/dry-rb/dry-system"
|
27
|
+
spec.metadata["bug_tracker_uri"] = "https://github.com/dry-rb/dry-system/issues"
|
28
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
28
29
|
|
29
|
-
spec.required_ruby_version = ">= 3.
|
30
|
+
spec.required_ruby_version = ">= 3.1"
|
30
31
|
|
31
32
|
# to update dependencies edit project.yml
|
32
|
-
spec.
|
33
|
-
spec.
|
34
|
-
spec.
|
35
|
-
spec.
|
36
|
-
|
37
|
-
spec.add_development_dependency "bundler"
|
38
|
-
spec.add_development_dependency "rake"
|
39
|
-
spec.add_development_dependency "rspec"
|
33
|
+
spec.add_dependency "dry-auto_inject", "~> 1.1"
|
34
|
+
spec.add_dependency "dry-configurable", "~> 1.3"
|
35
|
+
spec.add_dependency "dry-core", "~> 1.1"
|
36
|
+
spec.add_dependency "dry-inflector", "~> 1.1"
|
40
37
|
end
|
data/lib/dry/system/component.rb
CHANGED
@@ -60,10 +60,9 @@ module Dry
|
|
60
60
|
#
|
61
61
|
# @return [Object] component's class instance
|
62
62
|
# @api public
|
63
|
-
def instance(*args)
|
64
|
-
options[:instance]&.call(self, *args) || loader.call(self, *args)
|
63
|
+
def instance(*args, **kwargs)
|
64
|
+
options[:instance]&.call(self, *args, **kwargs) || loader.call(self, *args, **kwargs)
|
65
65
|
end
|
66
|
-
ruby2_keywords(:instance) if respond_to?(:ruby2_keywords, true)
|
67
66
|
|
68
67
|
# Returns the component's unique key
|
69
68
|
#
|
@@ -76,13 +76,13 @@ module Dry
|
|
76
76
|
|
77
77
|
def files(namespace)
|
78
78
|
if namespace.path?
|
79
|
-
Dir[File.join(full_path, namespace.path, "**", RB_GLOB)]
|
79
|
+
::Dir[::File.join(full_path, namespace.path, "**", RB_GLOB)]
|
80
80
|
else
|
81
81
|
non_root_paths = config.namespaces.to_a.reject(&:root?).map(&:path)
|
82
82
|
|
83
|
-
Dir[File.join(full_path, "**", RB_GLOB)].reject { |file_path|
|
83
|
+
::Dir[::File.join(full_path, "**", RB_GLOB)].reject { |file_path|
|
84
84
|
Pathname(file_path).relative_path_from(full_path).to_s.start_with?(*non_root_paths)
|
85
|
-
}
|
85
|
+
}
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
@@ -155,9 +155,9 @@ module Dry
|
|
155
155
|
}
|
156
156
|
end
|
157
157
|
|
158
|
-
def method_missing(name,
|
158
|
+
def method_missing(name, ...)
|
159
159
|
if config.respond_to?(name)
|
160
|
-
config.public_send(name,
|
160
|
+
config.public_send(name, ...)
|
161
161
|
else
|
162
162
|
super
|
163
163
|
end
|
@@ -7,7 +7,7 @@ module Dry
|
|
7
7
|
module Config
|
8
8
|
# @api public
|
9
9
|
class ComponentDir
|
10
|
-
include Dry::Configurable
|
10
|
+
include ::Dry::Configurable
|
11
11
|
|
12
12
|
# @!group Settings
|
13
13
|
|
@@ -211,9 +211,9 @@ module Dry
|
|
211
211
|
|
212
212
|
private
|
213
213
|
|
214
|
-
def method_missing(name,
|
214
|
+
def method_missing(name, ...)
|
215
215
|
if config.respond_to?(name)
|
216
|
-
config.public_send(name,
|
216
|
+
config.public_send(name, ...)
|
217
217
|
else
|
218
218
|
super
|
219
219
|
end
|
@@ -110,7 +110,7 @@ module Dry
|
|
110
110
|
|
111
111
|
# @api private
|
112
112
|
def initialize_copy(source)
|
113
|
-
@dirs = source.dirs.
|
113
|
+
@dirs = source.dirs.to_h { |path, dir| [path, dir.dup] }
|
114
114
|
@defaults = source.defaults.dup
|
115
115
|
end
|
116
116
|
|
@@ -221,8 +221,8 @@ module Dry
|
|
221
221
|
# @yieldparam dir [ComponentDir] the yielded component dir
|
222
222
|
#
|
223
223
|
# @api public
|
224
|
-
def each(&
|
225
|
-
to_a.each(&
|
224
|
+
def each(&)
|
225
|
+
to_a.each(&)
|
226
226
|
end
|
227
227
|
|
228
228
|
protected
|
@@ -272,9 +272,9 @@ module Dry
|
|
272
272
|
end
|
273
273
|
end
|
274
274
|
|
275
|
-
def method_missing(name,
|
275
|
+
def method_missing(name, ...)
|
276
276
|
if defaults.respond_to?(name)
|
277
|
-
defaults.public_send(name,
|
277
|
+
defaults.public_send(name, ...)
|
278
278
|
else
|
279
279
|
super
|
280
280
|
end
|
data/lib/dry/system/container.rb
CHANGED
@@ -103,8 +103,8 @@ module Dry
|
|
103
103
|
# @see after
|
104
104
|
#
|
105
105
|
# @api public
|
106
|
-
def configure(finalize_config: true, &
|
107
|
-
super(&
|
106
|
+
def configure(finalize_config: true, &)
|
107
|
+
super(&)
|
108
108
|
configured!(finalize_config: finalize_config)
|
109
109
|
end
|
110
110
|
|
@@ -314,23 +314,23 @@ module Dry
|
|
314
314
|
# @return [self] frozen container
|
315
315
|
#
|
316
316
|
# @api public
|
317
|
-
def finalize!(freeze: true, &
|
317
|
+
def finalize!(freeze: true, eager_load: true, &)
|
318
318
|
return self if finalized?
|
319
319
|
|
320
320
|
configured!
|
321
321
|
|
322
|
-
|
323
|
-
|
322
|
+
run_hooks(:finalize) do
|
323
|
+
yield(self) if block_given?
|
324
324
|
|
325
|
-
|
326
|
-
auto_registrar.finalize!
|
327
|
-
manifest_registrar.finalize!
|
328
|
-
importer.finalize!
|
325
|
+
[providers, auto_registrar, manifest_registrar, importer].each(&:finalize!)
|
329
326
|
|
330
|
-
|
327
|
+
keys.each { resolve(_1) } if eager_load
|
328
|
+
|
329
|
+
@__finalized__ = true
|
330
|
+
|
331
|
+
self.freeze if freeze
|
332
|
+
end
|
331
333
|
|
332
|
-
self.freeze if freeze
|
333
|
-
hooks[:after_finalize].each { |hook| instance_eval(&hook) }
|
334
334
|
self
|
335
335
|
end
|
336
336
|
|
@@ -462,7 +462,7 @@ module Dry
|
|
462
462
|
# @api public
|
463
463
|
def require_from_root(*paths)
|
464
464
|
paths.flat_map { |path|
|
465
|
-
path.to_s.include?("*") ? ::Dir[root.join(path)]
|
465
|
+
path.to_s.include?("*") ? ::Dir[root.join(path)] : root.join(path)
|
466
466
|
}.each { |path|
|
467
467
|
Kernel.require path.to_s
|
468
468
|
}
|
@@ -622,8 +622,8 @@ module Dry
|
|
622
622
|
load_local_component(component)
|
623
623
|
elsif manifest_registrar.file_exists?(component)
|
624
624
|
manifest_registrar.(component)
|
625
|
-
elsif importer.namespace?(component.
|
626
|
-
load_imported_component(component.identifier, namespace: component.
|
625
|
+
elsif importer.namespace?(component.root_key)
|
626
|
+
load_imported_component(component.identifier, namespace: component.root_key)
|
627
627
|
elsif importer.namespace?(nil)
|
628
628
|
load_imported_component(component.identifier, namespace: nil)
|
629
629
|
end
|
@@ -659,6 +659,12 @@ module Dry
|
|
659
659
|
end
|
660
660
|
} || IndirectComponent.new(Identifier.new(key))
|
661
661
|
end
|
662
|
+
|
663
|
+
def run_hooks(event)
|
664
|
+
hooks[:"before_#{event}"].each { instance_eval(&_1) }
|
665
|
+
yield
|
666
|
+
hooks[:"after_#{event}"].each { instance_eval(&_1) }
|
667
|
+
end
|
662
668
|
end
|
663
669
|
|
664
670
|
# Default hooks
|
data/lib/dry/system/errors.rb
CHANGED
data/lib/dry/system/loader.rb
CHANGED
@@ -43,18 +43,17 @@ module Dry
|
|
43
43
|
# @return [Object]
|
44
44
|
#
|
45
45
|
# @api public
|
46
|
-
def call(component, *args)
|
46
|
+
def call(component, *args, **kwargs)
|
47
47
|
require!(component)
|
48
48
|
|
49
49
|
constant = self.constant(component)
|
50
50
|
|
51
51
|
if singleton?(constant)
|
52
|
-
constant.instance(*args)
|
52
|
+
constant.instance(*args, **kwargs)
|
53
53
|
else
|
54
|
-
constant.new(*args)
|
54
|
+
constant.new(*args, **kwargs)
|
55
55
|
end
|
56
56
|
end
|
57
|
-
ruby2_keywords(:call) if respond_to?(:ruby2_keywords, true)
|
58
57
|
|
59
58
|
# Returns the component's class constant
|
60
59
|
#
|
@@ -26,7 +26,7 @@ module Dry
|
|
26
26
|
|
27
27
|
# @api private
|
28
28
|
def finalize!
|
29
|
-
::Dir[registrations_dir.join(RB_GLOB)].
|
29
|
+
::Dir[registrations_dir.join(RB_GLOB)].each do |file|
|
30
30
|
call(Identifier.new(File.basename(file, RB_EXT)))
|
31
31
|
end
|
32
32
|
end
|
@@ -38,7 +38,7 @@ module Dry
|
|
38
38
|
|
39
39
|
# @api private
|
40
40
|
def file_exists?(component)
|
41
|
-
File.exist?(File.join(registrations_dir, "#{component.root_key}#{RB_EXT}"))
|
41
|
+
::File.exist?(::File.join(registrations_dir, "#{component.root_key}#{RB_EXT}"))
|
42
42
|
end
|
43
43
|
|
44
44
|
private
|
@@ -6,10 +6,8 @@ module Dry
|
|
6
6
|
module Bootsnap
|
7
7
|
DEFAULT_OPTIONS = {
|
8
8
|
load_path_cache: true,
|
9
|
-
disable_trace: true,
|
10
9
|
compile_cache_iseq: true,
|
11
|
-
compile_cache_yaml: true
|
12
|
-
autoload_paths_cache: false
|
10
|
+
compile_cache_yaml: true
|
13
11
|
}.freeze
|
14
12
|
|
15
13
|
# @api private
|
@@ -32,12 +30,16 @@ module Dry
|
|
32
30
|
def setup_bootsnap
|
33
31
|
return unless bootsnap_available?
|
34
32
|
|
35
|
-
::Bootsnap.setup(config.bootsnap
|
33
|
+
::Bootsnap.setup(**config.bootsnap, cache_dir: root.join("tmp/cache").to_s)
|
36
34
|
end
|
37
35
|
|
38
36
|
# @api private
|
39
37
|
def bootsnap_available?
|
40
|
-
|
38
|
+
spec = Gem.loaded_specs["bootsnap"] or return false
|
39
|
+
|
40
|
+
RUBY_ENGINE == "ruby" &&
|
41
|
+
spec.match_platform(RUBY_PLATFORM) &&
|
42
|
+
spec.required_ruby_version.satisfied_by?(Gem::Version.new(RUBY_VERSION))
|
41
43
|
end
|
42
44
|
end
|
43
45
|
end
|
@@ -20,7 +20,7 @@ module Dry
|
|
20
20
|
target_class: klass
|
21
21
|
)
|
22
22
|
|
23
|
-
super
|
23
|
+
super
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -36,7 +36,7 @@ module Dry
|
|
36
36
|
target_class: klass
|
37
37
|
)
|
38
38
|
|
39
|
-
super
|
39
|
+
super
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -51,7 +51,7 @@ module Dry
|
|
51
51
|
target_class: klass
|
52
52
|
)
|
53
53
|
|
54
|
-
super
|
54
|
+
super
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -24,15 +24,15 @@ module Dry
|
|
24
24
|
end
|
25
25
|
|
26
26
|
# @api private
|
27
|
-
def monitor(key, **options, &
|
27
|
+
def monitor(key, **options, &)
|
28
28
|
notifications = self[:notifications]
|
29
29
|
|
30
30
|
resolve(key).tap do |target|
|
31
31
|
proxy = Proxy.for(target, **options, key: key)
|
32
32
|
|
33
|
-
if
|
33
|
+
if block_given?
|
34
34
|
proxy.monitored_methods.each do |meth|
|
35
|
-
notifications.subscribe(:monitoring, target: key, method: meth, &
|
35
|
+
notifications.subscribe(:monitoring, target: key, method: meth, &)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
data/lib/dry/system/plugins.rb
CHANGED
@@ -11,8 +11,8 @@ module Dry
|
|
11
11
|
# @return [Plugins]
|
12
12
|
#
|
13
13
|
# @api public
|
14
|
-
def self.register(name, plugin, &
|
15
|
-
registry[name] = Plugin.new(name, plugin, &
|
14
|
+
def self.register(name, plugin, &)
|
15
|
+
registry[name] = Plugin.new(name, plugin, &)
|
16
16
|
end
|
17
17
|
|
18
18
|
# @api private
|
@@ -37,21 +37,21 @@ module Dry
|
|
37
37
|
# @see Dry::System::Provider::SourceDSL
|
38
38
|
#
|
39
39
|
# @api private
|
40
|
-
def for(name:, group: nil, superclass: nil, &
|
40
|
+
def for(name:, group: nil, superclass: nil, &)
|
41
41
|
superclass ||= self
|
42
42
|
|
43
|
-
Class.new(superclass) { |klass|
|
43
|
+
::Class.new(superclass) { |klass|
|
44
44
|
klass.source_name name
|
45
45
|
klass.source_group group
|
46
46
|
|
47
47
|
name_with_group = group ? "#{group}->#{name}" : name
|
48
|
-
klass.instance_eval
|
49
|
-
def name
|
50
|
-
"#{superclass.name}[#{name_with_group}]"
|
51
|
-
end
|
48
|
+
klass.instance_eval(<<~RUBY, __FILE__, __LINE__ + 1)
|
49
|
+
def name # def name
|
50
|
+
"#{superclass.name}[#{name_with_group}]" # "CustomSource[custom]"
|
51
|
+
end # end
|
52
52
|
RUBY
|
53
53
|
|
54
|
-
SourceDSL.evaluate(klass, &
|
54
|
+
SourceDSL.evaluate(klass, &) if block_given?
|
55
55
|
}
|
56
56
|
end
|
57
57
|
|
@@ -125,12 +125,12 @@ module Dry
|
|
125
125
|
def target = target_container
|
126
126
|
|
127
127
|
# @api private
|
128
|
-
def initialize(provider_container:, target_container:, &
|
128
|
+
def initialize(provider_container:, target_container:, &)
|
129
129
|
super()
|
130
130
|
@callbacks = {before: CALLBACK_MAP.dup, after: CALLBACK_MAP.dup}
|
131
131
|
@provider_container = provider_container
|
132
132
|
@target_container = target_container
|
133
|
-
instance_exec(&
|
133
|
+
instance_exec(&) if block_given?
|
134
134
|
end
|
135
135
|
|
136
136
|
# Returns a string containing a human-readable representation of the provider.
|
@@ -263,7 +263,7 @@ module Dry
|
|
263
263
|
end
|
264
264
|
|
265
265
|
# @api private
|
266
|
-
def method_missing(name, *args, &
|
266
|
+
def method_missing(name, *args, &)
|
267
267
|
if container.key?(name)
|
268
268
|
container[name]
|
269
269
|
else
|
@@ -10,8 +10,8 @@ module Dry
|
|
10
10
|
#
|
11
11
|
# @api private
|
12
12
|
class SourceDSL
|
13
|
-
def self.evaluate(source_class, &
|
14
|
-
new(source_class).instance_eval(&
|
13
|
+
def self.evaluate(source_class, &)
|
14
|
+
new(source_class).instance_eval(&)
|
15
15
|
end
|
16
16
|
|
17
17
|
attr_reader :source_class
|
@@ -24,23 +24,23 @@ module Dry
|
|
24
24
|
source_class.setting(...)
|
25
25
|
end
|
26
26
|
|
27
|
-
def prepare(&
|
28
|
-
source_class.define_method(:prepare, &
|
27
|
+
def prepare(&)
|
28
|
+
source_class.define_method(:prepare, &)
|
29
29
|
end
|
30
30
|
|
31
|
-
def start(&
|
32
|
-
source_class.define_method(:start, &
|
31
|
+
def start(&)
|
32
|
+
source_class.define_method(:start, &)
|
33
33
|
end
|
34
34
|
|
35
|
-
def stop(&
|
36
|
-
source_class.define_method(:stop, &
|
35
|
+
def stop(&)
|
36
|
+
source_class.define_method(:stop, &)
|
37
37
|
end
|
38
38
|
|
39
39
|
private
|
40
40
|
|
41
|
-
def method_missing(name,
|
41
|
+
def method_missing(name, ...)
|
42
42
|
if source_class.respond_to?(name)
|
43
|
-
source_class.public_send(name,
|
43
|
+
source_class.public_send(name, ...)
|
44
44
|
else
|
45
45
|
super
|
46
46
|
end
|
data/lib/dry/system/provider.rb
CHANGED
@@ -127,8 +127,8 @@ module Dry
|
|
127
127
|
attr_reader :source
|
128
128
|
|
129
129
|
# @api private
|
130
|
-
# rubocop:disable
|
131
|
-
def initialize(name:, namespace: nil, target_container:, source_class:, source_options: {}, &
|
130
|
+
# rubocop:disable Style/KeywordParametersOrder
|
131
|
+
def initialize(name:, namespace: nil, target_container:, source_class:, source_options: {}, &)
|
132
132
|
@name = name
|
133
133
|
@namespace = namespace
|
134
134
|
@target_container = target_container
|
@@ -141,10 +141,10 @@ module Dry
|
|
141
141
|
**source_options,
|
142
142
|
provider_container: provider_container,
|
143
143
|
target_container: target_container,
|
144
|
-
&
|
144
|
+
&
|
145
145
|
)
|
146
146
|
end
|
147
|
-
# rubocop:enable
|
147
|
+
# rubocop:enable Style/KeywordParametersOrder
|
148
148
|
|
149
149
|
# Runs the `prepare` lifecycle step.
|
150
150
|
#
|
@@ -46,14 +46,14 @@ module Dry
|
|
46
46
|
|
47
47
|
# @see Container.register_provider
|
48
48
|
# @api private
|
49
|
-
def register_provider(name, from: nil, source: nil, if: true, **provider_options, &
|
49
|
+
def register_provider(name, from: nil, source: nil, if: true, **provider_options, &)
|
50
50
|
raise ProviderAlreadyRegisteredError, name if providers.key?(name)
|
51
51
|
|
52
52
|
if from && source.is_a?(Class)
|
53
53
|
raise ArgumentError, "You must supply a block when using a provider source"
|
54
54
|
end
|
55
55
|
|
56
|
-
if
|
56
|
+
if block_given? && source.is_a?(Class)
|
57
57
|
raise ArgumentError, "You must supply only a `source:` option or a block, not both"
|
58
58
|
end
|
59
59
|
|
@@ -66,14 +66,14 @@ module Dry
|
|
66
66
|
source: source || name,
|
67
67
|
group: from,
|
68
68
|
options: provider_options,
|
69
|
-
&
|
69
|
+
&
|
70
70
|
)
|
71
71
|
else
|
72
72
|
build_provider(
|
73
73
|
name,
|
74
74
|
source: source,
|
75
75
|
options: provider_options,
|
76
|
-
&
|
76
|
+
&
|
77
77
|
)
|
78
78
|
end
|
79
79
|
|
@@ -126,10 +126,10 @@ module Dry
|
|
126
126
|
# @api public
|
127
127
|
def provider_files
|
128
128
|
@provider_files ||= provider_paths.each_with_object([[], []]) { |path, (provider_files, loaded)| # rubocop:disable Layout/LineLength
|
129
|
-
files = Dir["#{path}/#{RB_GLOB}"]
|
129
|
+
files = ::Dir["#{path}/#{RB_GLOB}"]
|
130
130
|
|
131
131
|
files.each do |file|
|
132
|
-
basename = File.basename(file)
|
132
|
+
basename = ::File.basename(file)
|
133
133
|
|
134
134
|
unless loaded.include?(basename)
|
135
135
|
provider_files << Pathname(file)
|
@@ -213,11 +213,11 @@ module Dry
|
|
213
213
|
}
|
214
214
|
end
|
215
215
|
|
216
|
-
def build_provider(name, options:, source: nil, &
|
216
|
+
def build_provider(name, options:, source: nil, &)
|
217
217
|
source_class = source || Provider::Source.for(
|
218
218
|
name: name,
|
219
219
|
superclass: provider_source_class,
|
220
|
-
&
|
220
|
+
&
|
221
221
|
)
|
222
222
|
|
223
223
|
source_options =
|
@@ -236,7 +236,7 @@ module Dry
|
|
236
236
|
)
|
237
237
|
end
|
238
238
|
|
239
|
-
def build_provider_from_source(name, source:, group:, options:, &
|
239
|
+
def build_provider_from_source(name, source:, group:, options:, &)
|
240
240
|
provider_source = System.provider_sources.resolve(name: source, group: group)
|
241
241
|
|
242
242
|
source_options =
|
@@ -253,7 +253,7 @@ module Dry
|
|
253
253
|
target_container: target_container,
|
254
254
|
source_class: provider_source.source,
|
255
255
|
source_options: source_options,
|
256
|
-
&
|
256
|
+
&
|
257
257
|
)
|
258
258
|
end
|
259
259
|
|
@@ -24,7 +24,7 @@ module Dry
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def load_sources(path)
|
27
|
-
Dir[File.join(path, "**/#{RB_GLOB}")].
|
27
|
+
::Dir[::File.join(path, "**/#{RB_GLOB}")].each do |file|
|
28
28
|
require file
|
29
29
|
end
|
30
30
|
end
|
@@ -36,11 +36,11 @@ module Dry
|
|
36
36
|
)
|
37
37
|
end
|
38
38
|
|
39
|
-
def register_from_block(name:, group:, provider_options:, &
|
39
|
+
def register_from_block(name:, group:, provider_options:, &)
|
40
40
|
register(
|
41
41
|
name: name,
|
42
42
|
group: group,
|
43
|
-
source: Provider::Source.for(name: name, group: group, &
|
43
|
+
source: Provider::Source.for(name: name, group: group, &),
|
44
44
|
provider_options: provider_options
|
45
45
|
)
|
46
46
|
end
|
data/lib/dry/system/stubs.rb
CHANGED
data/lib/dry/system/version.rb
CHANGED
data/lib/dry/system.rb
CHANGED
@@ -30,8 +30,8 @@ module Dry
|
|
30
30
|
# Registers a provider source, which can be used as the basis for other providers
|
31
31
|
#
|
32
32
|
# @api public
|
33
|
-
def self.register_provider_source(name, group:, source: nil, provider_options: {}, &
|
34
|
-
if source &&
|
33
|
+
def self.register_provider_source(name, group:, source: nil, provider_options: {}, &)
|
34
|
+
if source && block_given?
|
35
35
|
raise ArgumentError, "You must supply only a `source:` option or a block, not both"
|
36
36
|
end
|
37
37
|
|
@@ -47,7 +47,7 @@ module Dry
|
|
47
47
|
name: name,
|
48
48
|
group: group,
|
49
49
|
provider_options: provider_options,
|
50
|
-
&
|
50
|
+
&
|
51
51
|
)
|
52
52
|
end
|
53
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry-system
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-auto_inject
|
@@ -16,98 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: dry-configurable
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.3'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
40
|
+
version: '1.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: dry-core
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1.
|
47
|
+
version: '1.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1.
|
54
|
+
version: '1.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: dry-inflector
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1.
|
61
|
+
version: '1.1'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '1.
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: bundler
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rake
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rspec
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
68
|
+
version: '1.1'
|
111
69
|
description: Organize your code into reusable components
|
112
70
|
email:
|
113
71
|
- piotr.solnica@gmail.com
|
@@ -169,7 +127,8 @@ metadata:
|
|
169
127
|
changelog_uri: https://github.com/dry-rb/dry-system/blob/main/CHANGELOG.md
|
170
128
|
source_code_uri: https://github.com/dry-rb/dry-system
|
171
129
|
bug_tracker_uri: https://github.com/dry-rb/dry-system/issues
|
172
|
-
|
130
|
+
rubygems_mfa_required: 'true'
|
131
|
+
post_install_message:
|
173
132
|
rdoc_options: []
|
174
133
|
require_paths:
|
175
134
|
- lib
|
@@ -177,7 +136,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
177
136
|
requirements:
|
178
137
|
- - ">="
|
179
138
|
- !ruby/object:Gem::Version
|
180
|
-
version: '3.
|
139
|
+
version: '3.1'
|
181
140
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
141
|
requirements:
|
183
142
|
- - ">="
|
@@ -185,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
144
|
version: '0'
|
186
145
|
requirements: []
|
187
146
|
rubygems_version: 3.3.27
|
188
|
-
signing_key:
|
147
|
+
signing_key:
|
189
148
|
specification_version: 4
|
190
149
|
summary: Organize your code into reusable components
|
191
150
|
test_files: []
|