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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e90324e596f844c7104c69634b4ff6556421510c710a1e054944beebe2a99f2e
4
- data.tar.gz: d201f17ab282ce6570ca549bb867570c9e09ec62f92a827980ce3facbcbb6c4e
3
+ metadata.gz: b5f47e60d13f88b737b964fce4fea346f95a38d1d5337dd99bf65c893366c5eb
4
+ data.tar.gz: 8d7189b3a504c92a01b9d1c23d1465ab101585e9a4c3486aa2020905483e7856
5
5
  SHA512:
6
- metadata.gz: a5a963fd13031155c8e59878d30ba0231afd9f73ab0c001d7a8f92a39e6b3ad05073b1dde874e5ba4af2c630245fca329b654d0658520870257bc1bef9b900f4
7
- data.tar.gz: c5507f3e995f0d3bd1ce310a8d92cdb3989c6e805a66e3137c63a7b4cd7d35d7c0c8842c0b2a3d5c588e1a268a9b5afba88e24bb054a7ff43eff750207b6bee6
6
+ metadata.gz: 90bfa3d03c3fe0b905e0ed24c3b10126801fb1fb8b186296d571493b8d3bf18640a2ece96d4dcad56f3f5a078d13f043d48bfd4d1cad87c24a69bc2943032ab9
7
+ data.tar.gz: 895db6215a3c0f705e81d234682df7166f3fd31fae812925e405cefc764d73491c6f7b994ade4d82d72429c802052cac46c2d2474e633a20ee75383c1cfff5ec
@@ -1,3 +1,11 @@
1
+ # 0.13.2 - 2019-12-28
2
+
3
+ ### Fixed
4
+
5
+ - More keyword warnings (flash-gordon)
6
+
7
+ [Compare v0.13.1...v0.13.2](https://github.com/dry-rb/dry-system/compare/v0.13.1...v0.13.2)
8
+
1
9
  # 0.13.1 - 2019-11-07
2
10
 
3
11
  ### Fixed
@@ -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 { |(file_name, options)| component(relative_path(dir, file_name), **options) }
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
 
@@ -115,6 +115,7 @@ module Dry
115
115
  def instance(*args)
116
116
  loader.call(*args)
117
117
  end
118
+ ruby2_keywords(:instance) if respond_to?(:ruby2_keywords, true)
118
119
 
119
120
  # @api private
120
121
  def boot?
@@ -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
@@ -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
- super("dry-system plugin #{plugin.inspect} failed to load its dependencies: #{message}")
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
@@ -660,6 +660,7 @@ module Dry
660
660
  end
661
661
 
662
662
  klass.instance_variable_set(:@hooks, new_hooks)
663
+ klass.instance_variable_set(:@__finalized__, false)
663
664
  super
664
665
  end
665
666
 
@@ -17,12 +17,6 @@ module Dry
17
17
  class Lifecycle < BasicObject
18
18
  attr_reader :container
19
19
 
20
- attr_reader :init
21
-
22
- attr_reader :start
23
-
24
- attr_reader :stop
25
-
26
20
  attr_reader :statuses
27
21
 
28
22
  attr_reader :triggers
@@ -55,6 +55,7 @@ module Dry
55
55
  constant.new(*args)
56
56
  end
57
57
  end
58
+ ruby2_keywords(:call) if respond_to?(:ruby2_keywords, true)
58
59
 
59
60
  # Return component's class constant
60
61
  #
@@ -28,27 +28,34 @@ module Dry
28
28
  end
29
29
 
30
30
  # @api private
31
- def load_dependencies
32
- Array(dependencies).each do |f|
33
- begin
34
- next if Plugins.loaded_dependencies.include?(f.to_s)
35
-
36
- require f
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 dependencies
51
- mod.respond_to?(:dependencies) ? Array(mod.dependencies) : EMPTY_ARRAY
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
 
@@ -22,7 +22,7 @@ module Dry
22
22
 
23
23
  # @api private
24
24
  def self.dependencies
25
- 'bootsnap'
25
+ { bootsnap: 'bootsnap' }
26
26
  end
27
27
 
28
28
  # Set up bootsnap for faster booting
@@ -26,7 +26,7 @@ module Dry
26
26
 
27
27
  # @api private
28
28
  def self.dependencies
29
- 'dry/events/publisher'
29
+ { 'dry-events': 'dry/events/publisher' }
30
30
  end
31
31
 
32
32
  # @api private
@@ -21,7 +21,7 @@ module Dry
21
21
 
22
22
  # @api private
23
23
  def self.dependencies
24
- '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/notifications'
15
+ { 'dry-monitor': 'dry/monitor/notifications' }
16
16
  end
17
17
 
18
18
  # @api private
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dry
4
4
  module System
5
- VERSION = '0.13.1'
5
+ VERSION = '0.13.2'
6
6
  end
7
7
  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: 0.13.1
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-07 00:00:00.000000000 Z
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.0.6
249
+ rubygems_version: 3.1.2
250
250
  signing_key:
251
251
  specification_version: 4
252
252
  summary: Organize your code into reusable components