smart_container 0.8.1 → 0.9.0

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: fbae5c2d40dc40e3114d685c1f13d6cbfb7003a1c8fda862ef5dbcfa432cf5cd
4
- data.tar.gz: dd288fa47167c0da4e2aae656478170d0dd78b142eef52a351c461ddbc92bf29
3
+ metadata.gz: 6a45cc16a5fa97c52b28570a75115e21765f771b58e43fc1a0bd90d39b3c8abe
4
+ data.tar.gz: e956a3ceaa496e4c7e023ac6310b93bc05525959f48619f0c31126d9097f7e83
5
5
  SHA512:
6
- metadata.gz: 27129a91c84f8aad432c5462c2d3a921284b2b8e3b1fb4b0a215295f6f88d94063946cc24f2d065f6da9ba6e64baf421f2a192b68fa63ebda879a81715e2c88f
7
- data.tar.gz: 5e6839adcfe1e3c31513b622fc3e46aab37ab3ec35a992c8a3b9c7ff029c976dbf331619d3df20da7ffe3d712a8839f04ac83f3055f9e2426869e9b9ecf556f6
6
+ metadata.gz: d4d619d75a98601444c55ff7a278169e6b0937f0356ff19f8fcd41ba9c72d9f25c8ec0a077a90b87d77469605e542a5e5081aec5d9b0bf0c1718019902ad8166
7
+ data.tar.gz: cb220b711e67c661f7338ff6d49f82048df73861cadc0c1fdc981739d7c64ffec03953d397176c1d9e4e64321cdae078ca624fcb6ac51a8ccb92f4473b92fe83
@@ -5,7 +5,8 @@ inherit_gem:
5
5
  - lib/rubocop.rspec.yml
6
6
 
7
7
  AllCops:
8
- TargetRubyVersion: 2.7.1
8
+ TargetRubyVersion: 3.0.0
9
+ NewCops: enable
9
10
  Include:
10
11
  - lib/**/*.rb
11
12
  - spec/**/*.rb
@@ -13,3 +14,7 @@ AllCops:
13
14
  - Rakefile
14
15
  - smart_container.gemspec
15
16
  - bin/console
17
+
18
+ Lint/EmptyBlock:
19
+ Exclude:
20
+ - spec/**/*.rb
@@ -1,6 +1,15 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [0.9.0] - 2020-01-17
5
+ ### Added
6
+ - Support for *Ruby@3*;
7
+ - Updated development dependencies;
8
+
9
+ ### Changed
10
+ - No more TravisCI (todo: migrate to Github Actions);
11
+ - Minimal `smart_engine` version: *0.11.0* (in order to support *Ruby@3*);
12
+
4
13
  ## [0.8.1] - 2020-07-09
5
14
  ### Changed
6
15
  - *Core*
@@ -1,98 +1,104 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smart_container (0.8.1)
5
- smart_engine (~> 0.5)
4
+ smart_container (0.9.0)
5
+ smart_engine (~> 0.11)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activesupport (6.0.2.2)
10
+ activesupport (6.1.1)
11
11
  concurrent-ruby (~> 1.0, >= 1.0.2)
12
- i18n (>= 0.7, < 2)
13
- minitest (~> 5.1)
14
- tzinfo (~> 1.1)
15
- zeitwerk (~> 2.2)
16
- armitage-rubocop (0.81.0)
17
- rubocop (= 0.81.0)
18
- rubocop-performance (= 1.5.2)
19
- rubocop-rails (= 2.5.2)
12
+ i18n (>= 1.6, < 2)
13
+ minitest (>= 5.1)
14
+ tzinfo (~> 2.0)
15
+ zeitwerk (~> 2.3)
16
+ armitage-rubocop (1.7.0.1)
17
+ rubocop (= 1.7.0)
18
+ rubocop-performance (= 1.9.1)
19
+ rubocop-rails (= 2.9.1)
20
20
  rubocop-rake (= 0.5.1)
21
- rubocop-rspec (= 1.38.1)
22
- ast (2.4.0)
23
- coderay (1.1.2)
24
- concurrent-ruby (1.1.6)
25
- diff-lcs (1.3)
26
- docile (1.3.2)
27
- i18n (1.8.2)
21
+ rubocop-rspec (= 2.1.0)
22
+ ast (2.4.1)
23
+ coderay (1.1.3)
24
+ concurrent-ruby (1.1.7)
25
+ diff-lcs (1.4.4)
26
+ docile (1.3.5)
27
+ i18n (1.8.7)
28
28
  concurrent-ruby (~> 1.0)
29
- jaro_winkler (1.5.4)
30
29
  method_source (1.0.0)
31
- minitest (5.14.0)
32
- parallel (1.19.1)
33
- parser (2.7.1.0)
34
- ast (~> 2.4.0)
30
+ minitest (5.14.3)
31
+ parallel (1.20.1)
32
+ parser (3.0.0.0)
33
+ ast (~> 2.4.1)
35
34
  pry (0.13.1)
36
35
  coderay (~> 1.1)
37
36
  method_source (~> 1.0)
38
- rack (2.2.2)
37
+ rack (2.2.3)
39
38
  rainbow (3.0.0)
40
- rake (13.0.1)
39
+ rake (13.0.3)
40
+ regexp_parser (2.0.3)
41
41
  rexml (3.2.4)
42
- rspec (3.9.0)
43
- rspec-core (~> 3.9.0)
44
- rspec-expectations (~> 3.9.0)
45
- rspec-mocks (~> 3.9.0)
46
- rspec-core (3.9.1)
47
- rspec-support (~> 3.9.1)
48
- rspec-expectations (3.9.1)
42
+ rspec (3.10.0)
43
+ rspec-core (~> 3.10.0)
44
+ rspec-expectations (~> 3.10.0)
45
+ rspec-mocks (~> 3.10.0)
46
+ rspec-core (3.10.1)
47
+ rspec-support (~> 3.10.0)
48
+ rspec-expectations (3.10.1)
49
49
  diff-lcs (>= 1.2.0, < 2.0)
50
- rspec-support (~> 3.9.0)
51
- rspec-mocks (3.9.1)
50
+ rspec-support (~> 3.10.0)
51
+ rspec-mocks (3.10.1)
52
52
  diff-lcs (>= 1.2.0, < 2.0)
53
- rspec-support (~> 3.9.0)
54
- rspec-support (3.9.2)
55
- rubocop (0.81.0)
56
- jaro_winkler (~> 1.5.1)
53
+ rspec-support (~> 3.10.0)
54
+ rspec-support (3.10.1)
55
+ rubocop (1.7.0)
57
56
  parallel (~> 1.10)
58
- parser (>= 2.7.0.1)
57
+ parser (>= 2.7.1.5)
59
58
  rainbow (>= 2.2.2, < 4.0)
59
+ regexp_parser (>= 1.8, < 3.0)
60
60
  rexml
61
+ rubocop-ast (>= 1.2.0, < 2.0)
61
62
  ruby-progressbar (~> 1.7)
62
63
  unicode-display_width (>= 1.4.0, < 2.0)
63
- rubocop-performance (1.5.2)
64
- rubocop (>= 0.71.0)
65
- rubocop-rails (2.5.2)
66
- activesupport
64
+ rubocop-ast (1.4.0)
65
+ parser (>= 2.7.1.5)
66
+ rubocop-performance (1.9.1)
67
+ rubocop (>= 0.90.0, < 2.0)
68
+ rubocop-ast (>= 0.4.0)
69
+ rubocop-rails (2.9.1)
70
+ activesupport (>= 4.2.0)
67
71
  rack (>= 1.1)
68
- rubocop (>= 0.72.0)
72
+ rubocop (>= 0.90.0, < 2.0)
69
73
  rubocop-rake (0.5.1)
70
74
  rubocop
71
- rubocop-rspec (1.38.1)
72
- rubocop (>= 0.68.1)
73
- ruby-progressbar (1.10.1)
74
- simplecov (0.18.5)
75
+ rubocop-rspec (2.1.0)
76
+ rubocop (~> 1.0)
77
+ rubocop-ast (>= 1.1.0)
78
+ ruby-progressbar (1.11.0)
79
+ simplecov (0.21.2)
75
80
  docile (~> 1.1)
76
81
  simplecov-html (~> 0.11)
77
- simplecov-html (0.12.2)
78
- smart_engine (0.7.0)
79
- thread_safe (0.3.6)
80
- tzinfo (1.2.7)
81
- thread_safe (~> 0.1)
82
+ simplecov_json_formatter (~> 0.1)
83
+ simplecov-html (0.12.3)
84
+ simplecov_json_formatter (0.1.2)
85
+ smart_engine (0.11.0)
86
+ tzinfo (2.0.4)
87
+ concurrent-ruby (~> 1.0)
82
88
  unicode-display_width (1.7.0)
83
- zeitwerk (2.3.0)
89
+ zeitwerk (2.4.2)
84
90
 
85
91
  PLATFORMS
86
- ruby
92
+ x86_64-darwin-20
87
93
 
88
94
  DEPENDENCIES
89
- armitage-rubocop (~> 0.81)
90
- bundler (~> 2.1)
95
+ armitage-rubocop (~> 1.7)
96
+ bundler (~> 2.2)
91
97
  pry (~> 0.13)
92
98
  rake (~> 13.0)
93
- rspec (~> 3.9)
94
- simplecov (~> 0.18)
99
+ rspec (~> 3.10)
100
+ simplecov (~> 0.21)
95
101
  smart_container!
96
102
 
97
103
  BUNDLED WITH
98
- 2.1.4
104
+ 2.2.3
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # SmartCore::Container &middot; [![Gem Version](https://badge.fury.io/rb/smart_container.svg)](https://badge.fury.io/rb/smart_container) [![Build Status](https://travis-ci.org/smart-rb/smart_container.svg?branch=master)](https://travis-ci.org/smart-rb/smart_container)
1
+ # SmartCore::Container &middot; [![Gem Version](https://badge.fury.io/rb/smart_container.svg)](https://badge.fury.io/rb/smart_container)
2
2
 
3
3
  Thread-safe semanticaly-defined IoC/DI Container.
4
4
 
@@ -306,6 +306,8 @@ container.namespace('database') {} # no one to listen this changement... :)
306
306
 
307
307
  ## Roadmap
308
308
 
309
+ - migrate to Github Actions;
310
+
309
311
  - convinient way to rebind registered dependnecies:
310
312
 
311
313
  ```ruby
@@ -343,6 +345,17 @@ resolve('logger', :allocate) # Draft
343
345
 
344
346
  - support for fallback block in `.resolve` operation (similar to `Hash#fetch` works);
345
347
 
348
+ - inline temporary dependency switch:
349
+
350
+ ```ruby
351
+ with(logger: Logger.new, db: DB.new) do
352
+ # logger is a new logger
353
+ # db is a new db
354
+ end
355
+
356
+ # out of block: logger is an old logger, db is an old db
357
+ ```
358
+
346
359
  ---
347
360
 
348
361
  ## Contributing
@@ -13,6 +13,7 @@ module SmartCore::Container::DependencyCompatability::Definition
13
13
  #
14
14
  # @api private
15
15
  # @since 0.1.0
16
+ # rubocop:disable Lint/EmptyBlock
16
17
  def potential_namespace_overlap?(container_klass, dependency_name)
17
18
  anonymous_container = Class.new(container_klass).new
18
19
  anonymous_container.register(dependency_name, &(proc {}))
@@ -20,6 +21,7 @@ module SmartCore::Container::DependencyCompatability::Definition
20
21
  rescue SmartCore::Container::DependencyOverNamespaceOverlapError
21
22
  true
22
23
  end
24
+ # rubocop:enable Lint/EmptyBlock
23
25
 
24
26
  # @param container_klass [Class<SmartCore::Container>]
25
27
  # @param namespace_name [String, Symbol]
@@ -27,6 +29,7 @@ module SmartCore::Container::DependencyCompatability::Definition
27
29
  #
28
30
  # @api private
29
31
  # @since 0.1.0
32
+ # rubocop:disable Lint/EmptyBlock
30
33
  def potential_dependency_overlap?(container_klass, namespace_name)
31
34
  anonymous_container = Class.new(container_klass).new
32
35
  anonymous_container.namespace(namespace_name, &(proc {}))
@@ -34,5 +37,6 @@ module SmartCore::Container::DependencyCompatability::Definition
34
37
  rescue SmartCore::Container::NamespaceOverDependencyOverlapError
35
38
  true
36
39
  end
40
+ # rubocop:enable Lint/EmptyBlock
37
41
  end
38
42
  end
@@ -63,7 +63,7 @@ module SmartCore::Container::DependencyResolver
63
63
  entity = extract(container, dependency_path)
64
64
 
65
65
  case
66
- when memoized.nil?
66
+ when memoized == nil
67
67
  entity.is_a?(SmartCore::Container::Entities::Dependency)
68
68
  when !!memoized == true
69
69
  entity.is_a?(SmartCore::Container::Entities::MemoizedDependency)
@@ -123,7 +123,7 @@ class SmartCore::Container::DependencyWatcher
123
123
  # @api private
124
124
  # @since 0.8.0
125
125
  def remove_listeners(entity_path) # TODO: support for pattern-based pathes
126
- if entity_path.nil?
126
+ if entity_path == nil
127
127
  observers.each_value(&:clear)
128
128
  else
129
129
  entity_path = indifferently_accessable_path(entity_path)
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ using SmartCore::Ext::BasicObjectAsObject
4
+
3
5
  # @api private
4
6
  # @since 0.8.1
5
7
  class SmartCore::Container::Host
@@ -10,7 +12,8 @@ class SmartCore::Container::Host
10
12
  #
11
13
  # @api private
12
14
  # @since 0.8.1
13
- def build(container, path) # rubocop:disable Metrics/AbcSize
15
+ # rubocop:disable Metrics/AbcSize, Style/NilComparison
16
+ def build(container, path)
14
17
  if (container.nil? && !path.nil?) || (!container.nil? && path.nil?)
15
18
  raise(SmartCore::Container::ArgumentError, <<~ERROR_MESSAGE)
16
19
  Host container requires both host container instance and host container path
@@ -28,6 +31,7 @@ class SmartCore::Container::Host
28
31
 
29
32
  new(container, path)
30
33
  end
34
+ # rubocop:enable Metrics/AbcSize, Style/NilComparison
31
35
  end
32
36
 
33
37
  # @return [SmartCore::Container]
@@ -238,6 +238,7 @@ class SmartCore::Container::Registry
238
238
  # @api private
239
239
  # @since 0.1.0
240
240
  # @version 0.8.1
241
+ # rubocop:disable Lint/EmptyBlock
241
242
  def add_namespace(namespace_name, host_container, dependencies_definition)
242
243
  if state_frozen?
243
244
  raise(SmartCore::Container::FrozenRegistryError, 'Can not modify frozen registry!')
@@ -246,7 +247,6 @@ class SmartCore::Container::Registry
246
247
  dependencies_definition ||= proc {}
247
248
  prevent_dependency_overlap!(namespace_name)
248
249
 
249
- # rubocop:disable Layout/RescueEnsureAlignment
250
250
  namespace_entity = begin
251
251
  fetch_entity(namespace_name)
252
252
  rescue SmartCore::Container::FetchError
@@ -254,10 +254,9 @@ class SmartCore::Container::Registry
254
254
  namespace_name, host_container
255
255
  )
256
256
  end
257
- # rubocop:enable Layout/RescueEnsureAlignment
258
-
259
257
  namespace_entity.tap { namespace_entity.append_definitions(dependencies_definition) }
260
258
  end
259
+ # rubocop:enable Lint/EmptyBlock
261
260
 
262
261
  # @param root_dependency_name [String, NilClass]
263
262
  # @param block [Block]
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SmartCore
4
- class Container
4
+ class Container # rubocop:disable Style/StaticClass
5
5
  # @api public
6
6
  # @since 0.1.0
7
- # @version 0.8.1
8
- VERSION = '0.8.1'
7
+ # @version 0.9.0
8
+ VERSION = '0.9.0'
9
9
  end
10
10
  end
@@ -27,12 +27,12 @@ Gem::Specification.new do |spec|
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ['lib']
29
29
 
30
- spec.add_dependency 'smart_engine', '~> 0.5'
30
+ spec.add_dependency 'smart_engine', '~> 0.11'
31
31
 
32
- spec.add_development_dependency 'bundler', '~> 2.1'
32
+ spec.add_development_dependency 'bundler', '~> 2.2'
33
33
  spec.add_development_dependency 'rake', '~> 13.0'
34
- spec.add_development_dependency 'rspec', '~> 3.9'
35
- spec.add_development_dependency 'armitage-rubocop', '~> 0.81'
36
- spec.add_development_dependency 'simplecov', '~> 0.18'
34
+ spec.add_development_dependency 'rspec', '~> 3.10'
35
+ spec.add_development_dependency 'armitage-rubocop', '~> 1.7'
36
+ spec.add_development_dependency 'simplecov', '~> 0.21'
37
37
  spec.add_development_dependency 'pry', '~> 0.13'
38
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_container
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rustam Ibragimov
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-09 00:00:00.000000000 Z
11
+ date: 2021-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: smart_engine
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.5'
19
+ version: '0.11'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.5'
26
+ version: '0.11'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.1'
33
+ version: '2.2'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.1'
40
+ version: '2.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,42 +58,42 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.9'
61
+ version: '3.10'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '3.9'
68
+ version: '3.10'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: armitage-rubocop
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.81'
75
+ version: '1.7'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.81'
82
+ version: '1.7'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: simplecov
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.18'
89
+ version: '0.21'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0.18'
96
+ version: '0.21'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: pry
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -118,7 +118,6 @@ files:
118
118
  - ".gitignore"
119
119
  - ".rspec"
120
120
  - ".rubocop.yml"
121
- - ".travis.yml"
122
121
  - CHANGELOG.md
123
122
  - CODE_OF_CONDUCT.md
124
123
  - Gemfile
@@ -173,7 +172,7 @@ metadata:
173
172
  homepage_uri: https://github.com/smart-rb/smart-container
174
173
  source_code_uri: https://github.com/smart-rb/smart-container
175
174
  changelog_uri: https://github.com/smart-rb/smart-container/CHANGELOG.md
176
- post_install_message:
175
+ post_install_message:
177
176
  rdoc_options: []
178
177
  require_paths:
179
178
  - lib
@@ -188,8 +187,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
187
  - !ruby/object:Gem::Version
189
188
  version: '0'
190
189
  requirements: []
191
- rubygems_version: 3.1.2
192
- signing_key:
190
+ rubygems_version: 3.2.3
191
+ signing_key:
193
192
  specification_version: 4
194
193
  summary: IoC/DI Container
195
194
  test_files: []
@@ -1,22 +0,0 @@
1
- ---
2
- language: ruby
3
- cache: bundler
4
- os: linux
5
- dist: xenial
6
- before_install:
7
- - gem install bundler
8
- script:
9
- - bundle exec rake rubocop
10
- - bundle exec rake rspec
11
- jobs:
12
- fast_finish: true
13
- include:
14
- - rvm: 2.4.10
15
- - rvm: 2.5.8
16
- - rvm: 2.6.6
17
- - rvm: 2.7.1
18
- - rvm: ruby-head
19
- - rvm: jruby-head
20
- allow_failures:
21
- - rvm: ruby-head
22
- - rvm: jruby-head