dry-system 0.15.0 → 0.19.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +142 -2
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/dry-system.gemspec +5 -4
- data/lib/dry-system.rb +1 -1
- data/lib/dry/system.rb +2 -2
- data/lib/dry/system/auto_registrar.rb +17 -59
- data/lib/dry/system/booter.rb +68 -41
- data/lib/dry/system/component.rb +62 -100
- data/lib/dry/system/component_dir.rb +128 -0
- data/lib/dry/system/components.rb +2 -2
- data/lib/dry/system/components/bootable.rb +6 -34
- data/lib/dry/system/components/config.rb +2 -2
- data/lib/dry/system/config/component_dir.rb +202 -0
- data/lib/dry/system/config/component_dirs.rb +184 -0
- data/lib/dry/system/constants.rb +5 -5
- data/lib/dry/system/container.rb +133 -184
- data/lib/dry/system/errors.rb +21 -16
- data/lib/dry/system/identifier.rb +157 -0
- data/lib/dry/system/lifecycle.rb +2 -2
- data/lib/dry/system/loader.rb +40 -41
- data/lib/dry/system/loader/autoloading.rb +26 -0
- data/lib/dry/system/magic_comments_parser.rb +2 -2
- data/lib/dry/system/manual_registrar.rb +1 -1
- data/lib/dry/system/plugins.rb +7 -7
- data/lib/dry/system/plugins/bootsnap.rb +3 -3
- data/lib/dry/system/plugins/dependency_graph.rb +3 -3
- data/lib/dry/system/plugins/dependency_graph/strategies.rb +1 -1
- data/lib/dry/system/plugins/logging.rb +5 -5
- data/lib/dry/system/plugins/monitoring.rb +3 -3
- data/lib/dry/system/plugins/monitoring/proxy.rb +3 -3
- data/lib/dry/system/plugins/notifications.rb +1 -1
- data/lib/dry/system/provider.rb +3 -3
- data/lib/dry/system/settings.rb +6 -6
- data/lib/dry/system/settings/file_loader.rb +2 -2
- data/lib/dry/system/settings/file_parser.rb +1 -1
- data/lib/dry/system/stubs.rb +1 -1
- data/lib/dry/system/system_components/settings.rb +1 -1
- data/lib/dry/system/version.rb +1 -1
- metadata +21 -25
- data/lib/dry/system/auto_registrar/configuration.rb +0 -43
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "dry/system/constants"
|
4
|
+
require "dry/system/plugins/dependency_graph/strategies"
|
5
5
|
|
6
6
|
module Dry
|
7
7
|
module System
|
@@ -28,7 +28,7 @@ module Dry
|
|
28
28
|
|
29
29
|
# @api private
|
30
30
|
def self.dependencies
|
31
|
-
{
|
31
|
+
{'dry-events': "dry/events/publisher"}
|
32
32
|
end
|
33
33
|
|
34
34
|
# @api private
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "logger"
|
4
4
|
|
5
5
|
module Dry
|
6
6
|
module System
|
@@ -11,12 +11,12 @@ module Dry
|
|
11
11
|
system.before(:configure) do
|
12
12
|
setting :logger, reader: true
|
13
13
|
|
14
|
-
setting :log_dir,
|
14
|
+
setting :log_dir, "log"
|
15
15
|
|
16
16
|
setting :log_levels,
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
development: Logger::DEBUG,
|
18
|
+
test: Logger::DEBUG,
|
19
|
+
production: Logger::ERROR
|
20
20
|
|
21
21
|
setting :logger_class, ::Logger, reader: true
|
22
22
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "dry/system/constants"
|
4
|
+
require "dry/system/plugins/monitoring/proxy"
|
5
5
|
|
6
6
|
module Dry
|
7
7
|
module System
|
@@ -21,7 +21,7 @@ module Dry
|
|
21
21
|
|
22
22
|
# @api private
|
23
23
|
def self.dependencies
|
24
|
-
{
|
24
|
+
{'dry-events': "dry/events/publisher"}
|
25
25
|
end
|
26
26
|
|
27
27
|
# @api private
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "delegate"
|
4
4
|
|
5
5
|
module Dry
|
6
6
|
module System
|
@@ -9,7 +9,7 @@ module Dry
|
|
9
9
|
# @api private
|
10
10
|
class Proxy < SimpleDelegator
|
11
11
|
# @api private
|
12
|
-
def self.for(target, key:, methods: []
|
12
|
+
def self.for(target, key:, methods: [])
|
13
13
|
monitored_methods =
|
14
14
|
if methods.empty?
|
15
15
|
target.public_methods - Object.public_instance_methods
|
@@ -30,7 +30,7 @@ module Dry
|
|
30
30
|
monitored_methods.each do |meth|
|
31
31
|
define_method(meth) do |*args, &block|
|
32
32
|
object = __getobj__
|
33
|
-
opts = {
|
33
|
+
opts = {target: key, object: object, method: meth, args: args}
|
34
34
|
|
35
35
|
__notifications__.instrument(:monitoring, opts) do
|
36
36
|
object.public_send(meth, *args, &block)
|
data/lib/dry/system/provider.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
3
|
+
require "concurrent/map"
|
4
|
+
require "dry/system/constants"
|
5
|
+
require "dry/system/components/bootable"
|
6
6
|
|
7
7
|
module Dry
|
8
8
|
module System
|
data/lib/dry/system/settings.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
3
|
+
require "dry/core/class_builder"
|
4
|
+
require "dry/types"
|
5
|
+
require "dry/struct"
|
6
6
|
|
7
|
-
require
|
8
|
-
require
|
7
|
+
require "dry/system/settings/file_loader"
|
8
|
+
require "dry/system/constants"
|
9
9
|
|
10
10
|
module Dry
|
11
11
|
module System
|
@@ -22,7 +22,7 @@ module Dry
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def call
|
25
|
-
Core::ClassBuilder.new(name:
|
25
|
+
Core::ClassBuilder.new(name: "Configuration", parent: Configuration).call do |klass|
|
26
26
|
schema.each do |key, type|
|
27
27
|
klass.setting(key, type)
|
28
28
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "dry/system/settings/file_parser"
|
4
4
|
|
5
5
|
module Dry
|
6
6
|
module System
|
@@ -20,7 +20,7 @@ module Dry
|
|
20
20
|
|
21
21
|
def files(root, env)
|
22
22
|
[
|
23
|
-
root.join(
|
23
|
+
root.join(".env"),
|
24
24
|
root.join(".env.#{env}")
|
25
25
|
].compact
|
26
26
|
end
|
data/lib/dry/system/stubs.rb
CHANGED
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.
|
4
|
+
version: 0.19.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -44,14 +44,20 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
47
|
+
version: '0.12'
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 0.12.1
|
48
51
|
type: :runtime
|
49
52
|
prerelease: false
|
50
53
|
version_requirements: !ruby/object:Gem::Requirement
|
51
54
|
requirements:
|
52
55
|
- - "~>"
|
53
56
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
57
|
+
version: '0.12'
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 0.12.1
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: dry-container
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -78,34 +84,20 @@ dependencies:
|
|
78
84
|
requirements:
|
79
85
|
- - "~>"
|
80
86
|
- !ruby/object:Gem::Version
|
81
|
-
version: '0.
|
87
|
+
version: '0.5'
|
82
88
|
- - ">="
|
83
89
|
- !ruby/object:Gem::Version
|
84
|
-
version: 0.
|
90
|
+
version: '0.5'
|
85
91
|
type: :runtime
|
86
92
|
prerelease: false
|
87
93
|
version_requirements: !ruby/object:Gem::Requirement
|
88
94
|
requirements:
|
89
95
|
- - "~>"
|
90
96
|
- !ruby/object:Gem::Version
|
91
|
-
version: '0.
|
97
|
+
version: '0.5'
|
92
98
|
- - ">="
|
93
99
|
- !ruby/object:Gem::Version
|
94
|
-
version: 0.
|
95
|
-
- !ruby/object:Gem::Dependency
|
96
|
-
name: dry-equalizer
|
97
|
-
requirement: !ruby/object:Gem::Requirement
|
98
|
-
requirements:
|
99
|
-
- - "~>"
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: '0.2'
|
102
|
-
type: :runtime
|
103
|
-
prerelease: false
|
104
|
-
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
requirements:
|
106
|
-
- - "~>"
|
107
|
-
- !ruby/object:Gem::Version
|
108
|
-
version: '0.2'
|
100
|
+
version: '0.5'
|
109
101
|
- !ruby/object:Gem::Dependency
|
110
102
|
name: dry-inflector
|
111
103
|
requirement: !ruby/object:Gem::Requirement
|
@@ -196,19 +188,23 @@ files:
|
|
196
188
|
- lib/dry-system.rb
|
197
189
|
- lib/dry/system.rb
|
198
190
|
- lib/dry/system/auto_registrar.rb
|
199
|
-
- lib/dry/system/auto_registrar/configuration.rb
|
200
191
|
- lib/dry/system/booter.rb
|
201
192
|
- lib/dry/system/booter/component_registry.rb
|
202
193
|
- lib/dry/system/component.rb
|
194
|
+
- lib/dry/system/component_dir.rb
|
203
195
|
- lib/dry/system/components.rb
|
204
196
|
- lib/dry/system/components/bootable.rb
|
205
197
|
- lib/dry/system/components/config.rb
|
198
|
+
- lib/dry/system/config/component_dir.rb
|
199
|
+
- lib/dry/system/config/component_dirs.rb
|
206
200
|
- lib/dry/system/constants.rb
|
207
201
|
- lib/dry/system/container.rb
|
208
202
|
- lib/dry/system/errors.rb
|
203
|
+
- lib/dry/system/identifier.rb
|
209
204
|
- lib/dry/system/importer.rb
|
210
205
|
- lib/dry/system/lifecycle.rb
|
211
206
|
- lib/dry/system/loader.rb
|
207
|
+
- lib/dry/system/loader/autoloading.rb
|
212
208
|
- lib/dry/system/magic_comments_parser.rb
|
213
209
|
- lib/dry/system/manual_registrar.rb
|
214
210
|
- lib/dry/system/plugins.rb
|
@@ -244,14 +240,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
244
240
|
requirements:
|
245
241
|
- - ">="
|
246
242
|
- !ruby/object:Gem::Version
|
247
|
-
version: 2.
|
243
|
+
version: 2.5.0
|
248
244
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
249
245
|
requirements:
|
250
246
|
- - ">="
|
251
247
|
- !ruby/object:Gem::Version
|
252
248
|
version: '0'
|
253
249
|
requirements: []
|
254
|
-
rubygems_version: 3.
|
250
|
+
rubygems_version: 3.1.6
|
255
251
|
signing_key:
|
256
252
|
specification_version: 4
|
257
253
|
summary: Organize your code into reusable components
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Dry
|
4
|
-
module System
|
5
|
-
class AutoRegistrar
|
6
|
-
# Default auto_registrar configuration
|
7
|
-
#
|
8
|
-
# This is currently configured by default for every System::Container.
|
9
|
-
# Configuration allows to define custom initialization as well as exclusion
|
10
|
-
# logic, for each component that is being registered by Dry::System
|
11
|
-
# auto-registration.
|
12
|
-
#
|
13
|
-
# @api private
|
14
|
-
class Configuration
|
15
|
-
DEFAULT_INSTANCE = -> component { component.instance }.freeze
|
16
|
-
FALSE_PROC = -> * { false }.freeze
|
17
|
-
|
18
|
-
def self.setting(name)
|
19
|
-
define_method(name) do |&block|
|
20
|
-
ivar = "@#{name}"
|
21
|
-
if block
|
22
|
-
instance_variable_set(ivar, block)
|
23
|
-
else
|
24
|
-
instance_variable_get(ivar)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
setting :exclude
|
30
|
-
setting :instance
|
31
|
-
|
32
|
-
attr_accessor :memoize
|
33
|
-
|
34
|
-
# @api private
|
35
|
-
def initialize
|
36
|
-
@instance = DEFAULT_INSTANCE
|
37
|
-
@exclude = FALSE_PROC
|
38
|
-
@memoize = false
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|