dry-component 0.4.2 → 0.4.3

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
  SHA1:
3
- metadata.gz: 62d04c04b930c78a211b75bbe2b12e81709d5d72
4
- data.tar.gz: 4142d98f2cbea51f1d33f3864b8a952ede77416a
3
+ metadata.gz: 71fded9ea102f66efa6c00cc6249f74cd8c497b7
4
+ data.tar.gz: 9a8abe72737921f3ef16539b733002884d25e9b9
5
5
  SHA512:
6
- metadata.gz: 461b2819291b294fca018c24f12e392ee1fe3e9272232b9b87c79f5031968d74d9f91a2a7e52935ebc4c59fb3ec8f33e103eeeb94160a0ce5cceea184c9492c1
7
- data.tar.gz: 0441572d29a273a379388e6bfb2f7a6c31b94ffd55051a55ebdfe1b7eac35fb57004443334d632b5f2fa857099f16bdd38c72dbe44617c57b2277923db75f3cd
6
+ metadata.gz: 411c457ecc7cb1365764a84f29854f53ce36afdf832acff7af145e1660d2a740b130c003631392330e16b5c49f673ecb6eb894a67df40f096aa2f1f4456cf3e2
7
+ data.tar.gz: dc30846c1bec2bfdcd410c3f3eded9749ba3465d6d92449864d5bd0e5fb7de8051bae72600ac3e99b5b9bc6db3160885d5c682b8e5590d4c3332cdfca5f5fe7f
@@ -1,16 +1,26 @@
1
+ # 0.4.3 - 2016-08-01
2
+
3
+ ### Fixed
4
+
5
+ - Return immediately from `Container.load_component` if the requested component key already exists in the container. This fixes a crash when requesting to load a manually registered component with a name that doesn't map to a filename (timriley in [#24](https://github.com/dry-rb/dry-component/pull/24))
6
+
7
+ [Compare v0.4.2...v0.4.3](https://github.com/dry-rb/dry-component/compare/v0.4.2...v0.4.3)
8
+
1
9
  # 0.4.2 - 2016-07-26
2
10
 
3
11
  ### Fixed
4
12
 
5
13
  - Ensure file components can be loaded when they're requested for the first time using their shorthand container identifier (i.e. with the container's default namespace removed) (timriley)
6
14
 
15
+ [Compare v0.4.1...v0.4.2](https://github.com/dry-rb/dry-component/compare/v0.4.1...v0.4.2)
16
+
7
17
  # 0.4.1 - 2016-07-26 [YANKED]
8
18
 
9
19
  ### Fixed
10
20
 
11
21
  - Require the 0.4.0 release of dry-auto_inject for the features below (in 0.4.0) to work properly (timriley)
12
22
 
13
- [Compare v0.3.0...v0.4.0](https://github.com/dry-rb/dry-component/compare/v0.4.0...v0.4.1)
23
+ [Compare v0.4.0...v0.4.1](https://github.com/dry-rb/dry-component/compare/v0.4.0...v0.4.1)
14
24
 
15
25
  # 0.4.0 - 2016-07-26 [YANKED]
16
26
 
@@ -123,6 +123,8 @@ module Dry
123
123
  end
124
124
 
125
125
  def self.load_component(key)
126
+ return self if key?(key)
127
+
126
128
  component = loader.load(key)
127
129
  src_key = component.namespaces[0]
128
130
 
@@ -145,6 +147,8 @@ module Dry
145
147
  end
146
148
  end
147
149
  end
150
+
151
+ self
148
152
  end
149
153
 
150
154
  def self.require_component(component, &block)
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  module Component
3
- VERSION = '0.4.2'.freeze
3
+ VERSION = '0.4.3'.freeze
4
4
  end
5
5
  end
@@ -42,6 +42,16 @@ RSpec.describe Dry::Component::Container do
42
42
 
43
43
  expect(Test::Foo.new.dep).to be_instance_of(Test::Dep)
44
44
  end
45
+
46
+ it "raises an error if a component's file can't be found" do
47
+ expect { container.load_component('test.missing') }.to raise_error Dry::Component::FileNotFoundError
48
+ end
49
+
50
+ it "is a no op if a matching component is already registered" do
51
+ container.register "test.no_matching_file", Object.new
52
+
53
+ expect { container.load_component("test.no_matching_file") }.not_to raise_error
54
+ end
45
55
  end
46
56
  end
47
57
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-component
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-26 00:00:00.000000000 Z
11
+ date: 2016-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inflecto