dry-system 0.15.0 → 0.18.2

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: f029366a9ef603592adb0566dc7d7d1afb13b4e0a5ea86d70d6560a4e80b80f0
4
- data.tar.gz: 96b625962372b8e0a00a4cb99a449f8a5ed550c3328b887ef65c47a314628092
3
+ metadata.gz: de2d1a6333450270f4b10f90b2dfc7c3436b9885504544224970e3075bae0a90
4
+ data.tar.gz: a7506b0e02c0b3511b921d3390562d1ad59f67ffb8970c9573b5fd5f5437bbc8
5
5
  SHA512:
6
- metadata.gz: 1ef15338eb9e108b6e489a59ce10f0e8e57608cb6882ae7f8b89680786752b68e00b12a15238f61af63c03382b160dadfe59457ef0d35516fe9defcfe69cb4f9
7
- data.tar.gz: 4db3b188698061f78f23a8647d6145dc4466da9ac867c7c561f4aecd59434a18493b98b22d60c92f619f19f5fc177a723a8f2b4050be16f00d9151cadf7fdef2
6
+ metadata.gz: ab86a3f981d2bf26468a950f31d90993f096e2c8523fd275762f42ab5728e74e2fbc038b30566eecfaf41f15792bc34fedc2bd8733ffc6c03bb7ede4715b0cc0
7
+ data.tar.gz: 4969d94cc2e88c17646f96904e309892c02bbfbc311b08523ca01ff2bd3b08c3c132bf4f0eb641f7a6b6043f424fda0ffdb99ea3ef36ca899ce7a4790b258a43
data/CHANGELOG.md CHANGED
@@ -1,4 +1,60 @@
1
- ## v0.15.0 2020-01-30
1
+ ## 0.18.2 2021-08-30
2
+
3
+
4
+ ### Changed
5
+
6
+ - [internal] Improved compatibility with upcoming dry-configurable 0.13.0 release (@timriley in #187)
7
+
8
+ [Compare v0.18.1...v0.18.2](https://github.com/dry-rb/dry-system/compare/v0.18.1...v0.18.2)
9
+
10
+ ## 0.18.1 2020-08-26
11
+
12
+
13
+ ### Fixed
14
+
15
+ - Made `Booter#boot_files` a public method again, since it was required by dry-rails (@timriley)
16
+
17
+
18
+ [Compare v0.18.0...v0.18.1](https://github.com/dry-rb/dry-system/compare/v0.18.0...v0.18.1)
19
+
20
+ ## 0.18.0 2020-08-24
21
+
22
+
23
+ ### Added
24
+
25
+ - New `bootable_dirs` setting on `Dry::System::Container`, which accepts paths to multiple directories for looking up bootable component files. (@timriley in PR #151)
26
+
27
+ For each entry in the `bootable_dirs` array, relative directories will be appended to the container's `root`, and absolute directories will be left unchanged.
28
+
29
+ When searching for bootable files, the first match will win, and any subsequent same-named files will not be loaded. In this way, the `bootable_dirs` act similarly to the `$PATH` in a shell environment.
30
+
31
+
32
+ [Compare v0.17.0...v0.18.0](https://github.com/dry-rb/dry-system/compare/v0.17.0...v0.18.0)
33
+
34
+ ## 0.17.0 2020-02-19
35
+
36
+
37
+ ### Fixed
38
+
39
+ - Works with the latest dry-configurable version (issue #141) (@solnic)
40
+
41
+ ### Changed
42
+
43
+ - Depends on dry-configurable `=> 0.11.1` now (@solnic)
44
+
45
+ [Compare v0.16.0...v0.17.0](https://github.com/dry-rb/dry-system/compare/v0.16.0...v0.17.0)
46
+
47
+ ## 0.16.0 2020-02-15
48
+
49
+
50
+ ### Changed
51
+
52
+ - Plugins can now define their own settings which are available in the `before(:configure)` hook (@solnic)
53
+ - Dependency on dry-configurable was bumped to `~> 0.11` (@solnic)
54
+
55
+ [Compare v0.15.0...v0.16.0](https://github.com/dry-rb/dry-system/compare/v0.15.0...v0.16.0)
56
+
57
+ ## 0.15.0 2020-01-30
2
58
 
3
59
 
4
60
  ### Added
@@ -18,7 +74,7 @@ after(:configure) { config.my_new_setting = "awesome" }
18
74
  - Centralize error definitions in `lib/dry/system/errors.rb` (@cgeorgii)
19
75
  - All built-in plugins use `before(:configure)` now to declare their settings (@solnic)
20
76
 
21
- [Compare v0.14.1...vv0.15.0](https://github.com/dry-rb/dry-system/compare/v0.14.1...vv0.15.0)
77
+ [Compare v0.14.1...v0.15.0](https://github.com/dry-rb/dry-system/compare/v0.14.1...v0.15.0)
22
78
 
23
79
  ## 0.14.1 2020-01-22
24
80
 
data/dry-system.gemspec CHANGED
@@ -16,6 +16,8 @@ Gem::Specification.new do |spec|
16
16
  spec.description = spec.summary
17
17
  spec.homepage = 'https://dry-rb.org/gems/dry-system'
18
18
  spec.files = Dir["CHANGELOG.md", "LICENSE", "README.md", "dry-system.gemspec", "lib/**/*"]
19
+ spec.bindir = 'bin'
20
+ spec.executables = []
19
21
  spec.require_paths = ['lib']
20
22
 
21
23
  spec.metadata['allowed_push_host'] = 'https://rubygems.org'
@@ -28,7 +30,7 @@ Gem::Specification.new do |spec|
28
30
  # to update dependencies edit project.yml
29
31
  spec.add_runtime_dependency "concurrent-ruby", "~> 1.0"
30
32
  spec.add_runtime_dependency "dry-auto_inject", ">= 0.4.0"
31
- spec.add_runtime_dependency "dry-configurable", "~> 0.7"
33
+ spec.add_runtime_dependency "dry-configurable", "~> 0.11", ">= 0.11.1"
32
34
  spec.add_runtime_dependency "dry-container", "~> 0.7", ">= 0.7.2"
33
35
  spec.add_runtime_dependency "dry-core", "~> 0.3", ">= 0.3.1"
34
36
  spec.add_runtime_dependency "dry-equalizer", "~> 0.2"
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry/system/constants'
4
- require 'dry/system/magic_comments_parser'
5
- require 'dry/system/auto_registrar/configuration'
3
+ require "dry/system/constants"
4
+ require "dry/system/magic_comments_parser"
5
+ require "dry/system/auto_registrar/configuration"
6
6
 
7
7
  module Dry
8
8
  module System
@@ -67,8 +67,8 @@ module Dry
67
67
 
68
68
  # @api private
69
69
  def relative_path(dir, file_path)
70
- dir_root = root.join(dir.to_s.split('/')[0])
71
- file_path.to_s.sub("#{dir_root}/", '').sub(RB_EXT, EMPTY_STRING)
70
+ dir_root = root.join(dir.to_s.split("/")[0])
71
+ file_path.to_s.sub("#{dir_root}/", "").sub(RB_EXT, EMPTY_STRING)
72
72
  end
73
73
 
74
74
  # @api private
@@ -1,10 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry/system/components/bootable'
4
- require 'dry/system/errors'
5
- require 'dry/system/constants'
6
- require 'dry/system/lifecycle'
7
- require 'dry/system/booter/component_registry'
3
+ require "dry/system/components/bootable"
4
+ require "dry/system/errors"
5
+ require "dry/system/constants"
6
+ require "dry/system/lifecycle"
7
+ require "dry/system/booter/component_registry"
8
+ require "pathname"
8
9
 
9
10
  module Dry
10
11
  module System
@@ -16,29 +17,22 @@ module Dry
16
17
  #
17
18
  # @api private
18
19
  class Booter
19
- attr_reader :path
20
+ attr_reader :paths
20
21
 
21
22
  attr_reader :booted
22
23
 
23
24
  attr_reader :components
24
25
 
25
26
  # @api private
26
- def initialize(path)
27
- @path = path
27
+ def initialize(paths)
28
+ @paths = paths
28
29
  @booted = []
29
30
  @components = ComponentRegistry.new
30
31
  end
31
32
 
32
33
  # @api private
33
34
  def bootable?(component)
34
- boot_file(component).exist?
35
- end
36
-
37
- # @api private
38
- def boot_file(name)
39
- name = name.respond_to?(:root_key) ? name.root_key.to_s : name
40
-
41
- path.join("#{name}#{RB_EXT}")
35
+ !boot_file(component).nil?
42
36
  end
43
37
 
44
38
  # @api private
@@ -47,15 +41,6 @@ module Dry
47
41
  self
48
42
  end
49
43
 
50
- # @api private
51
- def load_component(path)
52
- identifier = Pathname(path).basename(RB_EXT).to_s.to_sym
53
-
54
- Kernel.require path unless components.exists?(identifier)
55
-
56
- self
57
- end
58
-
59
44
  # @api private
60
45
  def finalize!
61
46
  boot_files.each do |path|
@@ -120,7 +105,7 @@ module Dry
120
105
  # @api private
121
106
  def call(name_or_component)
122
107
  with_component(name_or_component) do |component|
123
- raise ComponentFileMismatchError.new(name, registered_booted_keys) unless component
108
+ raise ComponentFileMismatchError, name unless component
124
109
 
125
110
  yield(component) if block_given?
126
111
 
@@ -129,11 +114,30 @@ module Dry
129
114
  end
130
115
 
131
116
  # @api private
132
- def lifecycle_container(container)
133
- LifecycleContainer.new(container)
117
+ def boot_dependency(component)
118
+ boot_file = boot_file(component)
119
+
120
+ start(boot_file.basename(".*").to_s.to_sym) if boot_file
134
121
  end
135
122
 
136
123
  # @api private
124
+ def boot_files
125
+ @boot_files ||= paths.each_with_object([[], []]) { |path, (boot_files, loaded)|
126
+ files = Dir["#{path}/#{RB_GLOB}"].sort
127
+
128
+ files.each do |file|
129
+ basename = File.basename(file)
130
+
131
+ unless loaded.include?(basename)
132
+ boot_files << Pathname(file)
133
+ loaded << basename
134
+ end
135
+ end
136
+ }.first
137
+ end
138
+
139
+ private
140
+
137
141
  def with_component(id_or_component)
138
142
  component =
139
143
  case id_or_component
@@ -149,24 +153,28 @@ module Dry
149
153
  yield(component)
150
154
  end
151
155
 
152
- # @api private
153
- def require_boot_file(identifier)
154
- boot_file = boot_files.detect { |path|
155
- Pathname(path).basename(RB_EXT).to_s == identifier.to_s
156
- }
156
+ def load_component(path)
157
+ identifier = Pathname(path).basename(RB_EXT).to_s.to_sym
157
158
 
158
- Kernel.require boot_file if boot_file
159
+ Kernel.require path unless components.exists?(identifier)
160
+
161
+ self
159
162
  end
160
163
 
161
- # @api private
162
- def boot_files
163
- ::Dir["#{path}/**/#{RB_GLOB}"].sort
164
+ def boot_file(name)
165
+ name = name.respond_to?(:root_key) ? name.root_key.to_s : name
166
+
167
+ find_boot_file(name)
164
168
  end
165
169
 
166
- # @api private
167
- def boot_dependency(component)
168
- boot_file = boot_file(component)
169
- start(boot_file.basename('.*').to_s.to_sym) if boot_file.exist?
170
+ def require_boot_file(identifier)
171
+ boot_file = find_boot_file(identifier)
172
+
173
+ Kernel.require boot_file if boot_file
174
+ end
175
+
176
+ def find_boot_file(name)
177
+ boot_files.detect { |file| File.basename(file, RB_EXT) == name.to_s }
170
178
  end
171
179
  end
172
180
  end
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'concurrent/map'
3
+ require "concurrent/map"
4
4
 
5
- require 'dry-equalizer'
6
- require 'dry/inflector'
7
- require 'dry/system/loader'
8
- require 'dry/system/errors'
9
- require 'dry/system/constants'
5
+ require "dry-equalizer"
6
+ require "dry/inflector"
7
+ require "dry/system/loader"
8
+ require "dry/system/errors"
9
+ require "dry/system/constants"
10
10
 
11
11
  module Dry
12
12
  module System
@@ -118,7 +118,7 @@ module Dry
118
118
  ruby2_keywords(:instance) if respond_to?(:ruby2_keywords, true)
119
119
 
120
120
  # @api private
121
- def boot?
121
+ def bootable?
122
122
  false
123
123
  end
124
124
 
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry/system/lifecycle'
4
- require 'dry/system/settings'
5
- require 'dry/system/components/config'
6
- require 'dry/system/constants'
3
+ require "dry/system/lifecycle"
4
+ require "dry/system/settings"
5
+ require "dry/system/components/config"
6
+ require "dry/system/constants"
7
7
 
8
8
  module Dry
9
9
  module System
@@ -70,7 +70,7 @@ module Dry
70
70
  @config = nil
71
71
  @config_block = nil
72
72
  @identifier = identifier
73
- @triggers = { before: TRIGGER_MAP.dup, after: TRIGGER_MAP.dup }
73
+ @triggers = {before: TRIGGER_MAP.dup, after: TRIGGER_MAP.dup}
74
74
  @options = block ? options.merge(block: block) : options
75
75
  @namespace = options[:namespace]
76
76
  finalize = options[:finalize] || DEFAULT_FINALIZE
@@ -229,38 +229,10 @@ module Dry
229
229
  # @return [TrueClass]
230
230
  #
231
231
  # @api private
232
- def boot?
232
+ def bootable?
233
233
  true
234
234
  end
235
235
 
236
- # Return path to component's boot file
237
- #
238
- # @return [String]
239
- #
240
- # @api private
241
- def boot_file
242
- container_boot_files
243
- .detect { |path| Pathname(path).basename(RB_EXT).to_s == identifier.to_s }
244
- end
245
-
246
- # Return path to boot dir
247
- #
248
- # @return [String]
249
- #
250
- # @api private
251
- def boot_path
252
- container.boot_path
253
- end
254
-
255
- # Return all boot files defined under container's boot path
256
- #
257
- # @return [String]
258
- #
259
- # @api private
260
- def container_boot_files
261
- ::Dir[container.boot_path.join("**/#{RB_GLOB}")].sort
262
- end
263
-
264
236
  private
265
237
 
266
238
  # Return lifecycle object used for this component
@@ -21,8 +21,8 @@ module Dry
21
21
  private
22
22
 
23
23
  def method_missing(meth, value = nil)
24
- if meth.to_s.end_with?('=')
25
- @settings[meth.to_s.gsub('=', '').to_sym] = value
24
+ if meth.to_s.end_with?("=")
25
+ @settings[meth.to_s.gsub("=", "").to_sym] = value
26
26
  elsif @settings.key?(meth)
27
27
  @settings[meth]
28
28
  else
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry/system'
3
+ require "dry/system"
4
4
 
5
5
  Dry::System.register_provider(
6
6
  :system,
7
- boot_path: Pathname(__dir__).join('system_components').realpath
7
+ boot_path: Pathname(__dir__).join("system_components").realpath
8
8
  )
@@ -1,15 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry/core/constants'
3
+ require "dry/core/constants"
4
4
 
5
5
  module Dry
6
6
  module System
7
7
  include Dry::Core::Constants
8
8
 
9
- RB_EXT = '.rb'
10
- RB_GLOB = '*.rb'
11
- PATH_SEPARATOR = '/'
12
- DEFAULT_SEPARATOR = '.'
9
+ RB_EXT = ".rb"
10
+ RB_GLOB = "*.rb"
11
+ PATH_SEPARATOR = "/"
12
+ DEFAULT_SEPARATOR = "."
13
13
  WORD_REGEX = /\w+/.freeze
14
14
  end
15
15
  end
@@ -1,24 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'pathname'
4
-
5
- require 'dry-auto_inject'
6
- require 'dry-configurable'
7
- require 'dry-container'
8
- require 'dry/inflector'
9
-
10
- require 'dry/core/deprecations'
11
-
12
- require 'dry/system'
13
- require 'dry/system/errors'
14
- require 'dry/system/loader'
15
- require 'dry/system/booter'
16
- require 'dry/system/auto_registrar'
17
- require 'dry/system/manual_registrar'
18
- require 'dry/system/importer'
19
- require 'dry/system/component'
20
- require 'dry/system/constants'
21
- require 'dry/system/plugins'
3
+ require "pathname"
4
+
5
+ require "dry-auto_inject"
6
+ require "dry-configurable"
7
+ require "dry-container"
8
+ require "dry/inflector"
9
+
10
+ require "dry/core/deprecations"
11
+
12
+ require "dry/system"
13
+ require "dry/system/errors"
14
+ require "dry/system/loader"
15
+ require "dry/system/booter"
16
+ require "dry/system/auto_registrar"
17
+ require "dry/system/manual_registrar"
18
+ require "dry/system/importer"
19
+ require "dry/system/component"
20
+ require "dry/system/constants"
21
+ require "dry/system/plugins"
22
22
 
23
23
  module Dry
24
24
  module System
@@ -48,8 +48,6 @@ module Dry
48
48
  #
49
49
  # * `:name` - a unique container identifier
50
50
  # * `:root` - a system root directory (defaults to `pwd`)
51
- # * `:system_dir` - directory name relative to root, where bootable components
52
- # can be defined in `boot` dir this defaults to `system`
53
51
  #
54
52
  # @example
55
53
  # class MyApp < Dry::System::Container
@@ -75,8 +73,9 @@ module Dry
75
73
  setting :name
76
74
  setting :default_namespace
77
75
  setting(:root, Pathname.pwd.freeze) { |path| Pathname(path) }
78
- setting :system_dir, 'system'
79
- setting :registrations_dir, 'container'
76
+ setting :system_dir, "system"
77
+ setting :bootable_dirs, ["system/boot"]
78
+ setting :registrations_dir, "container"
80
79
  setting :auto_register, []
81
80
  setting :inflector, Dry::Inflector.new
82
81
  setting :loader, Dry::System::Loader
@@ -95,7 +94,20 @@ module Dry
95
94
  end
96
95
  end
97
96
 
98
- extend Dry::Core::Deprecations['Dry::System::Container']
97
+ extend Dry::Core::Deprecations["Dry::System::Container"]
98
+
99
+ # Define a new configuration setting
100
+ #
101
+ # @see https://dry-rb.org/gems/dry-configurable
102
+ #
103
+ # @api public
104
+ def setting(name, *args, &block)
105
+ super(name, *args, &block)
106
+ # TODO: dry-configurable needs a public API for this
107
+ config._settings << _settings[name]
108
+ self
109
+ end
110
+ ruby2_keywords(:setting) if respond_to?(:ruby2_keywords, true)
99
111
 
100
112
  # Configures the container
101
113
  #
@@ -158,9 +170,10 @@ module Dry
158
170
 
159
171
  # Registers finalization function for a bootable component
160
172
  #
161
- # By convention, boot files for components should be placed in
162
- # `%{system_dir}/boot` and they will be loaded on demand when components
163
- # are loaded in isolation, or during finalization process.
173
+ # By convention, boot files for components should be placed in a
174
+ # `bootable_dirs` entry and they will be loaded on demand when
175
+ # components are loaded in isolation, or during the finalization
176
+ # process.
164
177
  #
165
178
  # @example
166
179
  # # system/container.rb
@@ -243,30 +256,24 @@ module Dry
243
256
  boot_local(name, **opts, &block)
244
257
  end
245
258
 
259
+ booter.register_component component
260
+
246
261
  components[name] = component
247
262
  end
248
263
  deprecate :finalize, :boot
249
264
 
250
265
  # @api private
251
266
  def boot_external(identifier, from:, key: nil, namespace: nil, &block)
252
- component = System.providers[from].component(
267
+ System.providers[from].component(
253
268
  identifier, key: key, namespace: namespace, finalize: block, container: self
254
269
  )
255
-
256
- booter.register_component(component)
257
-
258
- component
259
270
  end
260
271
 
261
272
  # @api private
262
273
  def boot_local(identifier, namespace: nil, &block)
263
- component = Components::Bootable.new(
274
+ Components::Bootable.new(
264
275
  identifier, container: self, namespace: namespace, &block
265
276
  )
266
-
267
- booter.register_component(component)
268
-
269
- component
270
277
  end
271
278
 
272
279
  # Return if a container was finalized
@@ -476,7 +483,7 @@ module Dry
476
483
  # @param options [Hash] injector options
477
484
  #
478
485
  # @api public
479
- def injector(options = { strategies: strategies })
486
+ def injector(options = {strategies: strategies})
480
487
  Dry::AutoInject(self, options)
481
488
  end
482
489
 
@@ -494,7 +501,7 @@ module Dry
494
501
  # @api public
495
502
  def require_from_root(*paths)
496
503
  paths.flat_map { |path|
497
- path.to_s.include?('*') ? ::Dir[root.join(path)].sort : root.join(path)
504
+ path.to_s.include?("*") ? ::Dir[root.join(path)].sort : root.join(path)
498
505
  }.each { |path|
499
506
  Kernel.require path.to_s
500
507
  }
@@ -557,12 +564,20 @@ module Dry
557
564
 
558
565
  # @api private
559
566
  def booter
560
- @booter ||= config.booter.new(boot_path)
567
+ @booter ||= config.booter.new(boot_paths)
561
568
  end
562
569
 
563
570
  # @api private
564
- def boot_path
565
- root.join("#{config.system_dir}/boot")
571
+ def boot_paths
572
+ config.bootable_dirs.map { |dir|
573
+ dir = Pathname(dir)
574
+
575
+ if dir.relative?
576
+ root.join(dir)
577
+ else
578
+ dir
579
+ end
580
+ }
566
581
  end
567
582
 
568
583
  # @api private
@@ -623,13 +638,13 @@ module Dry
623
638
  return self if registered?(key)
624
639
 
625
640
  component(key).tap do |component|
626
- if component.boot?
641
+ if component.bootable?
627
642
  booter.start(component)
628
643
  else
629
644
  root_key = component.root_key
630
645
 
631
- if (bootable_dep = component(root_key)).boot?
632
- booter.start(bootable_dep)
646
+ if (root_bootable = component(root_key)).bootable?
647
+ booter.start(root_bootable)
633
648
  elsif importer.key?(root_key)
634
649
  load_imported_component(component.namespaced(root_key))
635
650
  end
@@ -17,12 +17,8 @@ module Dry
17
17
  # @api public
18
18
  ComponentFileMismatchError = Class.new(StandardError) do
19
19
  def initialize(component)
20
- path = component.boot_path
21
- files = component.container_boot_files
22
-
23
20
  super(<<-STR)
24
- Boot file for component #{component.identifier.inspect} not found.
25
- Container boot files under #{path}: #{files.inspect}")
21
+ Bootable component #{component.identifier.inspect} not found
26
22
  STR
27
23
  end
28
24
  end
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'concurrent/map'
3
+ require "concurrent/map"
4
4
 
5
- require 'dry/system/settings'
5
+ require "dry/system/settings"
6
6
 
7
7
  module Dry
8
8
  module System
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry/inflector'
3
+ require "dry/inflector"
4
4
 
5
5
  module Dry
6
6
  module System
@@ -7,8 +7,8 @@ module Dry
7
7
  COMMENT_RE = /^#\s+(?<name>[A-Za-z]{1}[A-Za-z0-9_]+):\s+(?<value>.+?)$/.freeze
8
8
 
9
9
  COERCIONS = {
10
- 'true' => true,
11
- 'false' => false
10
+ "true" => true,
11
+ "false" => false
12
12
  }.freeze
13
13
 
14
14
  def self.call(file_name)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry/system/constants'
3
+ require "dry/system/constants"
4
4
 
5
5
  module Dry
6
6
  module System
@@ -22,7 +22,7 @@ module Dry
22
22
 
23
23
  # @api private
24
24
  def self.dependencies
25
- { bootsnap: 'bootsnap' }
25
+ {bootsnap: "bootsnap"}
26
26
  end
27
27
 
28
28
  # Set up bootsnap for faster booting
@@ -31,12 +31,12 @@ module Dry
31
31
  def setup_bootsnap
32
32
  return unless bootsnap_available?
33
33
 
34
- ::Bootsnap.setup(config.bootsnap.merge(cache_dir: root.join('tmp/cache').to_s))
34
+ ::Bootsnap.setup(config.bootsnap.merge(cache_dir: root.join("tmp/cache").to_s))
35
35
  end
36
36
 
37
37
  # @api private
38
38
  def bootsnap_available?
39
- RUBY_ENGINE == 'ruby' && RUBY_VERSION >= '2.3.0' && RUBY_VERSION < '2.5.0'
39
+ RUBY_ENGINE == "ruby" && RUBY_VERSION >= "2.3.0" && RUBY_VERSION < "2.5.0"
40
40
  end
41
41
  end
42
42
  end
@@ -14,7 +14,7 @@ module Dry
14
14
 
15
15
  # @api private
16
16
  def define_initialize(klass)
17
- @container['notifications'].instrument(
17
+ @container["notifications"].instrument(
18
18
  :resolved_dependency, dependency_map: dependency_map.to_h, target_class: klass
19
19
  )
20
20
  super(klass)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry/system/constants'
4
- require 'dry/system/plugins/dependency_graph/strategies'
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
- { 'dry-events': 'dry/events/publisher' }
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 'logger'
3
+ require "logger"
4
4
 
5
5
  module Dry
6
6
  module System
@@ -11,12 +11,9 @@ module Dry
11
11
  system.before(:configure) do
12
12
  setting :logger, reader: true
13
13
 
14
- setting :log_dir, 'log'
14
+ setting :log_dir, "log"
15
15
 
16
- setting :log_levels,
17
- development: Logger::DEBUG,
18
- test: Logger::DEBUG,
19
- production: Logger::ERROR
16
+ setting :log_levels, {development: Logger::DEBUG, test: Logger::DEBUG, production: Logger::ERROR}
20
17
 
21
18
  setting :logger_class, ::Logger, reader: true
22
19
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'delegate'
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: [], &block)
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 = { target: key, object: object, method: meth, args: args }
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)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry/system/constants'
4
- require 'dry/system/plugins/monitoring/proxy'
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
- { 'dry-events': 'dry/events/publisher' }
24
+ {'dry-events': "dry/events/publisher"}
25
25
  end
26
26
 
27
27
  # @api private
@@ -12,7 +12,7 @@ module Dry
12
12
 
13
13
  # @api private
14
14
  def self.dependencies
15
- { 'dry-monitor': 'dry/monitor/notifications' }
15
+ {'dry-monitor': "dry/monitor/notifications"}
16
16
  end
17
17
 
18
18
  # @api private
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry/system/constants'
3
+ require "dry/system/constants"
4
4
 
5
5
  module Dry
6
6
  module System
@@ -116,22 +116,22 @@ module Dry
116
116
  @enabled_plugins ||= []
117
117
  end
118
118
 
119
- require 'dry/system/plugins/bootsnap'
119
+ require "dry/system/plugins/bootsnap"
120
120
  register(:bootsnap, Plugins::Bootsnap)
121
121
 
122
- require 'dry/system/plugins/logging'
122
+ require "dry/system/plugins/logging"
123
123
  register(:logging, Plugins::Logging)
124
124
 
125
- require 'dry/system/plugins/env'
125
+ require "dry/system/plugins/env"
126
126
  register(:env, Plugins::Env)
127
127
 
128
- require 'dry/system/plugins/notifications'
128
+ require "dry/system/plugins/notifications"
129
129
  register(:notifications, Plugins::Notifications)
130
130
 
131
- require 'dry/system/plugins/monitoring'
131
+ require "dry/system/plugins/monitoring"
132
132
  register(:monitoring, Plugins::Monitoring)
133
133
 
134
- require 'dry/system/plugins/dependency_graph'
134
+ require "dry/system/plugins/dependency_graph"
135
135
  register(:dependency_graph, Plugins::DependencyGraph)
136
136
  end
137
137
  end
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'concurrent/map'
4
- require 'dry/system/constants'
5
- require 'dry/system/components/bootable'
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
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry/system/settings/file_parser'
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('.env'),
23
+ root.join(".env"),
24
24
  root.join(".env.#{env}")
25
25
  ].compact
26
26
  end
@@ -37,7 +37,7 @@ module Dry
37
37
  def parse_line(line, hash)
38
38
  if (match = line.match(LINE))
39
39
  key, value = match.captures
40
- hash[key] = parse_value(value || '')
40
+ hash[key] = parse_value(value || "")
41
41
  end
42
42
  hash
43
43
  end
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry/core/class_builder'
4
- require 'dry/types'
5
- require 'dry/struct'
3
+ require "dry/core/class_builder"
4
+ require "dry/types"
5
+ require "dry/struct"
6
6
 
7
- require 'dry/system/settings/file_loader'
8
- require 'dry/system/constants'
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: 'Configuration', parent: Configuration).call do |klass|
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 'dry/container/stub'
3
+ require "dry/container/stub"
4
4
 
5
5
  module Dry
6
6
  module System
@@ -2,7 +2,7 @@
2
2
 
3
3
  Dry::System.register_component(:settings, provider: :system) do
4
4
  init do
5
- require 'dry/system/settings'
5
+ require "dry/system/settings"
6
6
  end
7
7
 
8
8
  start do
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dry
4
4
  module System
5
- VERSION = '0.15.0'
5
+ VERSION = "0.18.2"
6
6
  end
7
7
  end
data/lib/dry/system.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry/system/provider'
4
- require 'dry/system/provider_registry'
3
+ require "dry/system/provider"
4
+ require "dry/system/provider_registry"
5
5
 
6
6
  module Dry
7
7
  module System
data/lib/dry-system.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry/system'
3
+ require "dry/system"
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.15.0
4
+ version: 0.18.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: 2020-01-30 00:00:00.000000000 Z
11
+ date: 2021-08-30 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.7'
47
+ version: '0.11'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 0.11.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.7'
57
+ version: '0.11'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 0.11.1
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: dry-container
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -251,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
257
  - !ruby/object:Gem::Version
252
258
  version: '0'
253
259
  requirements: []
254
- rubygems_version: 3.0.3
260
+ rubygems_version: 3.1.6
255
261
  signing_key:
256
262
  specification_version: 4
257
263
  summary: Organize your code into reusable components