dry-system 0.13.1 → 0.13.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/dry/system/auto_registrar.rb +2 -2
- data/lib/dry/system/component.rb +1 -0
- data/lib/dry/system/components/bootable.rb +2 -4
- data/lib/dry/system/constants.rb +3 -2
- data/lib/dry/system/container.rb +1 -0
- data/lib/dry/system/lifecycle.rb +0 -6
- data/lib/dry/system/loader.rb +1 -0
- data/lib/dry/system/plugins.rb +18 -11
- data/lib/dry/system/plugins/bootsnap.rb +1 -1
- data/lib/dry/system/plugins/dependency_graph.rb +1 -1
- data/lib/dry/system/plugins/monitoring.rb +1 -1
- data/lib/dry/system/plugins/notifications.rb +1 -1
- data/lib/dry/system/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5f47e60d13f88b737b964fce4fea346f95a38d1d5337dd99bf65c893366c5eb
|
4
|
+
data.tar.gz: 8d7189b3a504c92a01b9d1c23d1465ab101585e9a4c3486aa2020905483e7856
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90bfa3d03c3fe0b905e0ed24c3b10126801fb1fb8b186296d571493b8d3bf18640a2ece96d4dcad56f3f5a078d13f043d48bfd4d1cad87c24a69bc2943032ab9
|
7
|
+
data.tar.gz: 895db6215a3c0f705e81d234682df7166f3fd31fae812925e405cefc764d73491c6f7b994ade4d82d72429c802052cac46c2d2474e633a20ee75383c1cfff5ec
|
data/CHANGELOG.md
CHANGED
@@ -50,7 +50,7 @@ module Dry
|
|
50
50
|
def components(dir)
|
51
51
|
files(dir)
|
52
52
|
.map { |file_name| [file_name, file_options(file_name)] }
|
53
|
-
.map { |
|
53
|
+
.map { |file_name, options| component(relative_path(dir, file_name), **options) }
|
54
54
|
.reject { |component| registered?(component.identifier) }
|
55
55
|
end
|
56
56
|
|
@@ -71,7 +71,7 @@ module Dry
|
|
71
71
|
end
|
72
72
|
|
73
73
|
# @api private
|
74
|
-
def component(path, options)
|
74
|
+
def component(path, **options)
|
75
75
|
container.component(path, **options)
|
76
76
|
end
|
77
77
|
|
data/lib/dry/system/component.rb
CHANGED
@@ -51,10 +51,6 @@ module Dry
|
|
51
51
|
# @return [Symbol] component's unique identifier
|
52
52
|
attr_reader :identifier
|
53
53
|
|
54
|
-
# @!attribute [r] finalize
|
55
|
-
# @return [Proc] Finalization proc
|
56
|
-
attr_reader :finalize
|
57
|
-
|
58
54
|
# @!attribute [r] options
|
59
55
|
# @return [Hash] component's options
|
60
56
|
attr_reader :options
|
@@ -71,6 +67,8 @@ module Dry
|
|
71
67
|
|
72
68
|
# @api private
|
73
69
|
def initialize(identifier, options = {}, &block)
|
70
|
+
@config = nil
|
71
|
+
@config_block = nil
|
74
72
|
@identifier = identifier
|
75
73
|
@triggers = { before: TRIGGER_MAP.dup, after: TRIGGER_MAP.dup }
|
76
74
|
@options = block ? options.merge(block: block) : options
|
data/lib/dry/system/constants.rb
CHANGED
@@ -36,8 +36,9 @@ module Dry
|
|
36
36
|
# @api public
|
37
37
|
PluginDependencyMissing = Class.new(StandardError) do
|
38
38
|
# @api private
|
39
|
-
def initialize(plugin, message)
|
40
|
-
|
39
|
+
def initialize(plugin, message, gem = nil)
|
40
|
+
details = gem ? "#{message} - add #{gem} to your Gemfile" : message
|
41
|
+
super("dry-system plugin #{plugin.inspect} failed to load its dependencies: #{details}")
|
41
42
|
end
|
42
43
|
end
|
43
44
|
end
|
data/lib/dry/system/container.rb
CHANGED
data/lib/dry/system/lifecycle.rb
CHANGED
data/lib/dry/system/loader.rb
CHANGED
data/lib/dry/system/plugins.rb
CHANGED
@@ -28,27 +28,34 @@ module Dry
|
|
28
28
|
end
|
29
29
|
|
30
30
|
# @api private
|
31
|
-
def load_dependencies
|
32
|
-
Array(dependencies).each do |
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
Plugins.loaded_dependencies << f.to_s
|
38
|
-
rescue LoadError => e
|
39
|
-
raise PluginDependencyMissing.new(name, e.message)
|
31
|
+
def load_dependencies(dependencies = mod_dependencies, gem = nil)
|
32
|
+
Array(dependencies).each do |dependency|
|
33
|
+
if dependency.is_a?(Array) || dependency.is_a?(Hash)
|
34
|
+
dependency.each { |value| load_dependencies(*Array(value).reverse) }
|
35
|
+
elsif !Plugins.loaded_dependencies.include?(dependency.to_s)
|
36
|
+
load_dependency(dependency, gem)
|
40
37
|
end
|
41
38
|
end
|
42
39
|
end
|
43
40
|
|
41
|
+
# @api private
|
42
|
+
def load_dependency(dependency, gem)
|
43
|
+
require dependency
|
44
|
+
Plugins.loaded_dependencies << dependency.to_s
|
45
|
+
rescue LoadError => e
|
46
|
+
raise PluginDependencyMissing.new(name, e.message, gem)
|
47
|
+
end
|
48
|
+
|
44
49
|
# @api private
|
45
50
|
def stateful?
|
46
51
|
mod < Module
|
47
52
|
end
|
48
53
|
|
49
54
|
# @api private
|
50
|
-
def
|
51
|
-
mod.respond_to?(:dependencies)
|
55
|
+
def mod_dependencies
|
56
|
+
return EMPTY_ARRAY unless mod.respond_to?(:dependencies)
|
57
|
+
|
58
|
+
mod.dependencies.is_a?(Array) ? mod.dependencies : [mod.dependencies]
|
52
59
|
end
|
53
60
|
end
|
54
61
|
|
data/lib/dry/system/version.rb
CHANGED
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: 0.13.
|
4
|
+
version: 0.13.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -42,22 +42,22 @@ dependencies:
|
|
42
42
|
name: dry-configurable
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 0.7.0
|
48
45
|
- - "~>"
|
49
46
|
- !ruby/object:Gem::Version
|
50
47
|
version: '0.7'
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 0.7.0
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
|
-
- - ">="
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: 0.7.0
|
58
55
|
- - "~>"
|
59
56
|
- !ruby/object:Gem::Version
|
60
57
|
version: '0.7'
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 0.7.0
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: dry-container
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -246,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
246
246
|
- !ruby/object:Gem::Version
|
247
247
|
version: '0'
|
248
248
|
requirements: []
|
249
|
-
rubygems_version: 3.
|
249
|
+
rubygems_version: 3.1.2
|
250
250
|
signing_key:
|
251
251
|
specification_version: 4
|
252
252
|
summary: Organize your code into reusable components
|