dry-auto_inject 0.4.5 → 0.4.6

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
- SHA1:
3
- metadata.gz: 11770f3fb1b553afb3fa69c334e9601345416da7
4
- data.tar.gz: 3310eb2c3808a135886b9a4289b4a946205ca43b
2
+ SHA256:
3
+ metadata.gz: 7390d5a0b2fd3f12fc33f412a506e355bcb315e6dc90199740b5e3af34d6918b
4
+ data.tar.gz: e3864b6de7ba096650403e7cec2adb3baa8cc036c933ba9e89f4c27f443fcac4
5
5
  SHA512:
6
- metadata.gz: a06aeae18d58438ccfbdca3dcf55452e3fae14a61fcfedab2abc4869248a64d3742a06ffdf18914f4ec2060e421ae08183cbe95e928e9764aedf19f66200f690
7
- data.tar.gz: 53fa1615a976fadd6ef6f12e88c9dabaf89cd24c5c794bc22ef12fe3da2de77240486935c8a944cfe9fd2450ef9e95a14765b7179630430a0eef9a7fa1fe5445
6
+ metadata.gz: 2f58d872c1a323b9a9a08d2e4615bb3c8d3adb2153ddab83ee14b18b401c5e78018ce9b67accbbd2005759c8456656619e78fd1145535246b99da46b9c101075
7
+ data.tar.gz: 91b4b889a5c4cdfc7e7876bed582205f7ffaea8fc970f9d7b098f95b9727d326632b474e820698752b8b9a67b8a2374e15cc076ad04e1570c9fe751bfab1a388
@@ -0,0 +1,6 @@
1
+ engines:
2
+ rubocop:
3
+ enabled: true
4
+ ratings:
5
+ paths:
6
+ - lib/**
@@ -1,6 +1,4 @@
1
1
  language: ruby
2
- dist: trusty
3
- sudo: required
4
2
  cache: bundler
5
3
  bundler_args: --without tools
6
4
  script:
@@ -8,17 +6,13 @@ script:
8
6
  after_success:
9
7
  - '[ -d coverage ] && bundle exec codeclimate-test-reporter'
10
8
  rvm:
11
- - 2.1.10
12
- - 2.2.7
13
- - 2.3.4
14
- - 2.4.1
9
+ - 2.5.0
10
+ - 2.4.3
11
+ - 2.3.6
15
12
  - jruby-9.1.10.0
16
13
  env:
17
14
  global:
18
- - JRUBY_OPTS='--dev -J-Xmx1024M'
19
- addons:
20
- code_climate:
21
- repo_token: 029b5aa100b82b6710e285597b7eabe760357b5dd1f626514371356055378d8c
15
+ - COVERAGE=true
22
16
  notifications:
23
17
  email: false
24
18
  webhooks:
@@ -1,3 +1,11 @@
1
+ # 0.4.6 / 2018-03-27
2
+
3
+ ### Changed
4
+
5
+ - In injector-generated `#initialize` methods, set dependency instance variables before calling `super` (timriley)
6
+
7
+ [Compare v0.4.5...v0.4.6](https://github.com/dry-rb/dry-auto_inject/compare/v0.4.5...v0.4.6)
8
+
1
9
  # 0.4.5 / 2018-01-02
2
10
 
3
11
  ### Added
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in dry-auto_inject.gemspec
data/README.md CHANGED
@@ -1,17 +1,16 @@
1
- [gitter]: https://gitter.im/dry-rb/chat
2
1
  [gem]: https://rubygems.org/gems/dry-auto_inject
3
2
  [travis]: https://travis-ci.org/dry-rb/dry-auto_inject
4
- [gemnasium]: https://gemnasium.com/dry-rb/dry-auto_inject
5
- [code_climate]: https://codeclimate.com/github/dry-rb/dry-auto_inject
6
- [inch]: http://inch-ci.org/github/dry-rb/dry-auto_inject
3
+ [codeclimate]: https://codeclimate.com/github/dry-rb/dry-auto_inject
4
+ [coveralls]: https://coveralls.io/r/dry-rb/dry-auto_inject
5
+ [inchpages]: http://inch-ci.org/github/dry-rb/dry-auto_inject
7
6
 
8
- # dry-auto_inject [![Join the Gitter chat](https://badges.gitter.im/Join%20Chat.svg)][gitter]
7
+ # dry-auto_inject [![Join the chat at https://gitter.im/dry-rb/chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dry-rb/chat)
9
8
 
10
- [![Gem Version](https://img.shields.io/gem/v/dry-auto_inject.svg)][gem]
11
- [![Build Status](https://img.shields.io/travis/dry-rb/dry-auto_inject.svg)][travis]
12
- [![Dependency Status](https://img.shields.io/gemnasium/dry-rb/dry-auto_inject.svg)][gemnasium]
13
- [![Code Climate](https://img.shields.io/codeclimate/github/dry-rb/dry-auto_inject.svg)][code_climate]
14
- [![API Documentation Coverage](http://inch-ci.org/github/dry-rb/dry-auto_inject.svg)][inch]
9
+ [![Gem Version](https://badge.fury.io/rb/dry-auto_inject.svg)][gem]
10
+ [![Build Status](https://travis-ci.org/dry-rb/dry-auto_inject.svg?branch=master)][travis]
11
+ [![Code Climate](https://codeclimate.com/github/dry-rb/dry-auto_inject/badges/gpa.svg)][codeclimate]
12
+ [![Test Coverage](https://codeclimate.com/github/dry-rb/dry-auto_inject/badges/coverage.svg)][codeclimate]
13
+ [![Inline docs](http://inch-ci.org/github/dry-rb/dry-auto_inject.svg?branch=master)][inchpages]
15
14
  ![No monkey-patches](https://img.shields.io/badge/monkey--patches-0-brightgreen.svg)
16
15
 
17
16
  A simple extension which allows you to automatically inject dependencies to your
data/Rakefile CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env rake
2
+ # frozen_string_literal: true
3
+
2
4
  require 'bundler/gem_tasks'
3
5
 
4
6
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'dry-auto_inject'
@@ -1,4 +1,6 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  lib = File.expand_path('../lib', __FILE__)
3
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
6
  require 'dry/auto_inject/version'
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dry/auto_inject'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dry/auto_inject/builder'
2
4
 
3
5
  module Dry
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dry/auto_inject/strategies'
2
4
  require 'dry/auto_inject/injector'
3
5
 
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dry
2
4
  module AutoInject
3
5
  DuplicateDependencyError = Class.new(StandardError)
4
6
  DependencyNameInvalid = Class.new(StandardError)
5
7
 
6
- VALID_NAME = /([a-z_][a-zA-Z_0-9]*)$/.freeze
8
+ VALID_NAME = /([a-z_][a-zA-Z_0-9]*)$/
7
9
 
8
10
  class DependencyMap
9
11
  def initialize(*dependencies)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dry/auto_inject/strategies'
2
4
 
3
5
  module Dry
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dry-container'
2
4
 
3
5
  module Dry
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dry/auto_inject/strategies/constructor'
2
4
 
3
5
  module Dry
@@ -34,8 +36,8 @@ module Dry
34
36
 
35
37
  instance_mod.class_eval <<-RUBY, __FILE__, __LINE__ + 1
36
38
  def initialize(#{initialize_args})
37
- super()
38
39
  #{dependency_map.names.map { |name| "@#{name} = #{name}" }.join("\n")}
40
+ super()
39
41
  end
40
42
  RUBY
41
43
  end
@@ -49,8 +51,8 @@ module Dry
49
51
 
50
52
  instance_mod.class_eval <<-RUBY, __FILE__, __LINE__ + 1
51
53
  def initialize(*args)
52
- super(#{super_params})
53
54
  #{dependency_map.names.map.with_index { |name, i| "@#{name} = args[#{i}]" }.join("\n")}
55
+ super(#{super_params})
54
56
  end
55
57
  RUBY
56
58
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dry/auto_inject/dependency_map'
2
4
 
3
5
  module Dry
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dry/auto_inject/strategies/constructor'
2
4
 
3
5
  module Dry
@@ -25,8 +27,8 @@ module Dry
25
27
 
26
28
  instance_mod.class_eval <<-RUBY, __FILE__, __LINE__ + 1
27
29
  def initialize(options)
28
- super(#{super_params})
29
30
  #{dependency_map.names.map { |name| "@#{name} = options[:#{name}]" }.join("\n")}
31
+ super(#{super_params})
30
32
  end
31
33
  RUBY
32
34
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dry/auto_inject/strategies/constructor'
2
4
 
3
5
  module Dry
@@ -38,8 +40,8 @@ module Dry
38
40
 
39
41
  instance_mod.class_eval <<-RUBY, __FILE__, __LINE__ + 1
40
42
  def initialize(#{initialize_params})
41
- super()
42
43
  #{dependency_map.names.map { |name| "@#{name} = #{name}" }.join("\n")}
44
+ super()
43
45
  end
44
46
  RUBY
45
47
 
@@ -53,6 +55,10 @@ module Dry
53
55
 
54
56
  instance_mod.class_exec(dependency_map) do |dependency_map|
55
57
  define_method :initialize do |*args, **kwargs|
58
+ dependency_map.names.each do |name|
59
+ instance_variable_set :"@#{name}", kwargs[name]
60
+ end
61
+
56
62
  super_kwargs = kwargs.each_with_object({}) { |(key, _), hsh|
57
63
  if !dependency_map.names.include?(key) || super_kwarg_names.include?(key)
58
64
  hsh[key] = kwargs[key]
@@ -64,10 +70,6 @@ module Dry
64
70
  else
65
71
  super(*args)
66
72
  end
67
-
68
- dependency_map.names.each do |name|
69
- instance_variable_set :"@#{name}", kwargs[name]
70
- end
71
73
  end
72
74
  end
73
75
 
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dry
2
4
  module AutoInject
3
- VERSION = '0.4.5'.freeze
5
+ VERSION = '0.4.6'
4
6
  end
5
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  begin
2
4
  require 'rubocop/rake_task'
3
5
 
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.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-02 00:00:00.000000000 Z
11
+ date: 2018-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-container
@@ -73,6 +73,7 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
+ - ".codeclimate.yml"
76
77
  - ".gitignore"
77
78
  - ".rspec"
78
79
  - ".rubocop.yml"
@@ -119,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
120
  version: '0'
120
121
  requirements: []
121
122
  rubyforge_project:
122
- rubygems_version: 2.6.11
123
+ rubygems_version: 2.7.5
123
124
  signing_key:
124
125
  specification_version: 4
125
126
  summary: Container-agnostic automatic constructor injection