dry-auto_inject 0.4.3 → 0.4.4

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: b5d25d77aea481c1dfd5c35eb30eaca7d921b1a7
4
- data.tar.gz: a9512d492a6805f94b33784683f13a64ec6fe69d
3
+ metadata.gz: ddb0ea042ef971f3d0a99dcc8ec1ec5c3fa93651
4
+ data.tar.gz: a9b6209a4674755967a5ab219cc9ae535199a994
5
5
  SHA512:
6
- metadata.gz: a270fe530357ac14278071e5d76dca6a2dd4e07865817d0e9f2e3524af8138a250d403261615737f8a084803bcacd38ec7b8a765a5af9f2034b515ca71e093ac
7
- data.tar.gz: 4dcfbdeb49aeccb0109b414d4e0d18e7733bbb2ff5b70b4be9ec4582c4e6aacad9c5755d368a14ad04c02de79fe87895450358f4cca55dcc2012d5e07581feda
6
+ metadata.gz: 0b0c776559ba90710ada7b54ed91a09cc1353f6a330425ae1018bb5eaf2c683a5425fe3afe87a0ce3399e132244243acdb564006835f46081a21234d2d282b8c
7
+ data.tar.gz: '08a636c4dd8c86533bdcc4e21e0e01b01218b5b05ad86708f208c832e3d8f75c6fd0b55294c17dd5aba53efd863ccdda60fb3f385470c731d1524748756b0a42'
@@ -1,21 +1,33 @@
1
- # 0.4.3 / to-be-released
1
+ # 0.4.4 / 2017-09-14
2
+
3
+ ### Added
4
+
5
+ - Determine name for dependencies by splitting identifiers on any invalid local variable name characters (e.g. "/", "?", "!"), instead of splitting on dots only (raventid in [#39](https://github.com/dry-rb/dry-auto_inject/pull/39))
6
+
7
+ # 0.4.3 / 2017-05-27
2
8
 
3
9
  ### Added
4
10
 
5
11
  - Push sequential arguments along with keywords in the kwargs strategy (hbda + vladra in [#32](https://github.com/dry-rb/dry-auto_inject/pull/32))
6
12
 
13
+ [Compare v0.4.2...v0.4.3](https://github.com/dryrb/dry-auto_inject/compare/v0.4.2...v0.4.3)
14
+
7
15
  # 0.4.2 / 2016-10-10
8
16
 
9
17
  ### Fixed
10
18
 
11
19
  - Fixed issue where injectors for different containers could not be used on different classes in an inheritance hierarchy (timriley in [#31](https://github.com/dry-rb/dry-auto_inject/pull/31))
12
20
 
21
+ [Compare v0.4.1...v0.4.2](https://github.com/dryrb/dry-auto_inject/compare/v0.4.1...v0.4.2)
22
+
13
23
  # 0.4.1 / 2016-08-14
14
24
 
15
25
  ### Changed
16
26
 
17
27
  - Loosened version dependency on dry-container (AMHOL)
18
28
 
29
+ [Compare v0.4.0...v0.4.1](https://github.com/dryrb/dry-auto_inject/compare/v0.4.0...v0.4.1)
30
+
19
31
  # 0.4.0 / 2016-07-26
20
32
 
21
33
  ### Added
@@ -0,0 +1,29 @@
1
+ # Issue Guidelines
2
+
3
+ ## Reporting bugs
4
+
5
+ If you found a bug, report an issue and describe what's the expected behavior versus what actually happens. If the bug causes a crash, attach a full backtrace. If possible, a reproduction script showing the problem is highly appreciated.
6
+
7
+ ## Reporting feature requests
8
+
9
+ Report a feature request **only after discussing it first on [discuss.dry-rb.org](https://discuss.dry-rb.org)** where it was accepted. Please provide a concise description of the feature, don't link to a discussion thread, and instead summarize what was discussed.
10
+
11
+ ## Reporting questions, support requests, ideas, concerns etc.
12
+
13
+ **PLEASE DON'T** - use [discuss.dry-rb.org](http://discuss.dry-rb.org) instead.
14
+
15
+ # Pull Request Guidelines
16
+
17
+ A Pull Request will only be accepted if it addresses a specific issue that was reported previously, or fixes typos, mistakes in documentation etc.
18
+
19
+ Other requirements:
20
+
21
+ 1) Do not open a pull request if you can't provide tests along with it. If you have problems writing tests, ask for help in the related issue.
22
+ 2) Follow the style conventions of the surrounding code. In most cases, this is standard ruby style.
23
+ 3) Add API documentation if it's a new feature
24
+ 4) Update API documentation if it changes an existing feature
25
+ 5) Bonus points for sending a PR to [github.com/dry-rb/dry-rb.org](github.com/dry-rb/dry-rb.org) which updates user documentation and guides
26
+
27
+ # Asking for help
28
+
29
+ If these guidelines aren't helpful, and you're stuck, please post a message on [discuss.dry-rb.org](https://discuss.dry-rb.org).
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in dry-container.gemspec
3
+ # Specify your gem's dependencies in dry-auto_inject.gemspec
4
4
  gemspec
5
5
 
6
6
  group :test do
@@ -1,6 +1,9 @@
1
1
  module Dry
2
2
  module AutoInject
3
3
  DuplicateDependencyError = Class.new(StandardError)
4
+ DependencyNameInvalid = Class.new(StandardError)
5
+
6
+ VALID_NAME = /([a-z_][a-zA-Z_0-9]*)$/.freeze
4
7
 
5
8
  class DependencyMap
6
9
  def initialize(*dependencies)
@@ -10,7 +13,7 @@ module Dry
10
13
  aliases = dependencies.last.is_a?(Hash) ? dependencies.pop : {}
11
14
 
12
15
  dependencies.each do |identifier|
13
- name = identifier.to_s.split(".").last
16
+ name = name_for(identifier)
14
17
  add_dependency(name, identifier)
15
18
  end
16
19
 
@@ -34,6 +37,12 @@ module Dry
34
37
 
35
38
  private
36
39
 
40
+ def name_for(identifier)
41
+ matched = VALID_NAME.match(identifier.to_s)
42
+ raise DependencyNameInvalid, "name +#{identifier}+ is not a valid Ruby identifier" unless matched
43
+ matched[0]
44
+ end
45
+
37
46
  def add_dependency(name, identifier)
38
47
  name = name.to_sym
39
48
  raise DuplicateDependencyError, "name +#{name}+ is already used" if @map.key?(name)
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  module AutoInject
3
- VERSION = '0.4.3'.freeze
3
+ VERSION = '0.4.4'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-auto_inject
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-27 00:00:00.000000000 Z
11
+ date: 2017-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-container
@@ -79,6 +79,7 @@ files:
79
79
  - ".rubocop_todo.yml"
80
80
  - ".travis.yml"
81
81
  - CHANGELOG.md
82
+ - CONTRIBUTING.md
82
83
  - Gemfile
83
84
  - LICENSE
84
85
  - README.md