smart_ioc 0.3.9 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/rspec.yml +34 -0
- data/.ruby-version +1 -1
- data/Gemfile +1 -0
- data/Gemfile.lock +28 -25
- data/README.md +11 -4
- data/docs/index.md +2 -5
- data/lib/smart_ioc/bean.rb +2 -2
- data/lib/smart_ioc/bean_definition.rb +11 -0
- data/lib/smart_ioc/bean_locations.rb +1 -1
- data/lib/smart_ioc/iocify.rb +4 -0
- data/lib/smart_ioc/version.rb +1 -1
- data/lib/smart_ioc.rb +15 -8
- data/smart_ioc.gemspec +1 -1
- data/spec/smart_ioc/bean_locator_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -6
- metadata +5 -5
- data/.travis.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d8b979ba9bf2ec07fbd542a155af2fad52bb85fdbffece8cc50f1e3132c8d77
|
4
|
+
data.tar.gz: 47478f2706b6e5a262af7de3974825ca8d01b48839716c14d9996749421b390a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 530e72ce702c8f328ca21ce183d6f511216cb957511f026b52dbcd110b9fc0b21e418e2005f549cfcea75f1b6e6b7b1de3134e476609a19588755434c058aefb
|
7
|
+
data.tar.gz: 75ac2416d31d4e067d9a4e3fb1966edfa3a929771fad2760f7506bf50a8e8b60c0a7b1d0fa72120856230ceb62212256a402ebebd981b548e17a4e5134da73ed
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Rspec
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ master ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ master ]
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
test:
|
18
|
+
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
strategy:
|
21
|
+
matrix:
|
22
|
+
ruby-version: ['3.1', '3.3']
|
23
|
+
|
24
|
+
steps:
|
25
|
+
- uses: actions/checkout@v2
|
26
|
+
- name: Set up Ruby
|
27
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
28
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
29
|
+
uses: ruby/setup-ruby@v1
|
30
|
+
with:
|
31
|
+
ruby-version: ${{ matrix.ruby-version }}
|
32
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
33
|
+
- name: Run tests
|
34
|
+
run: bundle exec rspec spec/
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.3.4
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,50 +1,53 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
smart_ioc (0.
|
4
|
+
smart_ioc (0.5.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
9
|
byebug (11.1.3)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
rspec-
|
21
|
-
rspec-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
rspec-expectations (3.9.2)
|
10
|
+
coderay (1.1.3)
|
11
|
+
diff-lcs (1.5.1)
|
12
|
+
docile (1.4.1)
|
13
|
+
method_source (1.1.0)
|
14
|
+
pry (0.14.2)
|
15
|
+
coderay (~> 1.1)
|
16
|
+
method_source (~> 1.0)
|
17
|
+
rake (13.2.1)
|
18
|
+
rspec (3.13.0)
|
19
|
+
rspec-core (~> 3.13.0)
|
20
|
+
rspec-expectations (~> 3.13.0)
|
21
|
+
rspec-mocks (~> 3.13.0)
|
22
|
+
rspec-core (3.13.0)
|
23
|
+
rspec-support (~> 3.13.0)
|
24
|
+
rspec-expectations (3.13.2)
|
26
25
|
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
-
rspec-support (~> 3.
|
28
|
-
rspec-mocks (3.
|
26
|
+
rspec-support (~> 3.13.0)
|
27
|
+
rspec-mocks (3.13.1)
|
29
28
|
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
-
rspec-support (~> 3.
|
31
|
-
rspec-support (3.
|
32
|
-
simplecov (0.
|
29
|
+
rspec-support (~> 3.13.0)
|
30
|
+
rspec-support (3.13.1)
|
31
|
+
simplecov (0.22.0)
|
33
32
|
docile (~> 1.1)
|
34
33
|
simplecov-html (~> 0.11)
|
35
|
-
|
34
|
+
simplecov_json_formatter (~> 0.1)
|
35
|
+
simplecov-html (0.12.3)
|
36
|
+
simplecov_json_formatter (0.1.4)
|
36
37
|
|
37
38
|
PLATFORMS
|
38
39
|
ruby
|
40
|
+
x86_64-darwin-23
|
39
41
|
|
40
42
|
DEPENDENCIES
|
41
43
|
bundler
|
42
44
|
byebug
|
43
|
-
|
45
|
+
pry
|
44
46
|
rake
|
45
47
|
rspec
|
46
48
|
simplecov
|
49
|
+
simplecov-html (= 0.12.3)
|
47
50
|
smart_ioc!
|
48
51
|
|
49
52
|
BUNDLED WITH
|
50
|
-
2.
|
53
|
+
2.5.14
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# SmartIoC
|
2
|
-
[](https://codeclimate.com/github/ddd-ruby/smart_ioc)
|
4
|
-
[](https://codecov.io/gh/ddd-ruby/smart_ioc)
|
5
|
-
[](https://gemnasium.com/ddd-ruby/smart_ioc)
|
2
|
+
[](https://github.com/droidlabs/smart_ioc/actions?query=workflow%3ARspec)
|
3
|
+
[](https://codeclimate.com/github/ddd-ruby/smart_ioc)
|
6
4
|
|
7
5
|
|
8
6
|
SmartIoC is a smart and really simple IoC container for Ruby applications.
|
@@ -10,6 +8,15 @@ SmartIoC is a smart and really simple IoC container for Ruby applications.
|
|
10
8
|
## Installation
|
11
9
|
`gem install smart_ioc`
|
12
10
|
|
11
|
+
## Ruby versions
|
12
|
+
|
13
|
+
Please install specific smart_ioc version, depending on Ruby version.
|
14
|
+
|
15
|
+
| Ruby Version | SmartIoC Version |
|
16
|
+
| ------------ | ------------ |
|
17
|
+
| < 3.0 | 0.3.2 |
|
18
|
+
| >= 3.0 | 0.4.0 |
|
19
|
+
|
13
20
|
## Setup
|
14
21
|
Set package name and source package folder with beans. SmartIoC will parse source files and detect bean definitions automatically for you.
|
15
22
|
|
data/docs/index.md
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
# SmartIoC
|
2
|
-
[](https://codeclimate.com/github/ddd-ruby/smart_ioc)
|
4
|
-
[](https://codecov.io/gh/ddd-ruby/smart_ioc)
|
5
|
-
[](https://gemnasium.com/ddd-ruby/smart_ioc)
|
6
|
-
|
2
|
+
[](https://github.com/droidlabs/smart_ioc/actions?query=workflow%3ARspec)
|
3
|
+
[](https://codeclimate.com/github/ddd-ruby/smart_ioc)
|
7
4
|
|
8
5
|
SmartIoC is a smart and really simple IoC container for Ruby applications.
|
9
6
|
|
data/lib/smart_ioc/bean.rb
CHANGED
@@ -64,4 +64,15 @@ class SmartIoC::BeanDefinition
|
|
64
64
|
str << "factory_method: #{@factory_method}"
|
65
65
|
str.join("\n")
|
66
66
|
end
|
67
|
+
|
68
|
+
def preload
|
69
|
+
@dependencies.each do |dep|
|
70
|
+
SmartIoC::Container.get_instance.get_bean(
|
71
|
+
dep.ref || dep.bean_name,
|
72
|
+
package: dep.package,
|
73
|
+
parent_bean_definition: self,
|
74
|
+
parent_bean_name: name,
|
75
|
+
).class._smart_ioc_preload_; nil
|
76
|
+
end
|
77
|
+
end
|
67
78
|
end
|
data/lib/smart_ioc/iocify.rb
CHANGED
data/lib/smart_ioc/version.rb
CHANGED
data/lib/smart_ioc.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'smart_ioc/version'
|
2
2
|
require 'benchmark'
|
3
|
+
require 'forwardable'
|
3
4
|
|
4
5
|
module SmartIoC
|
5
6
|
autoload :Args, 'smart_ioc/args'
|
@@ -74,14 +75,20 @@ module SmartIoC
|
|
74
75
|
Container.get_instance
|
75
76
|
end
|
76
77
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
78
|
+
extend Forwardable
|
79
|
+
|
80
|
+
container_methods = [
|
81
|
+
:register_bean,
|
82
|
+
:get_bean_definition,
|
83
|
+
:set_extra_context_for_package,
|
84
|
+
:get_bean,
|
85
|
+
:clear_scopes,
|
86
|
+
:force_clear_scopes,
|
87
|
+
:set_load_proc
|
88
|
+
]
|
89
|
+
|
90
|
+
def_delegators :container, *container_methods
|
84
91
|
end
|
85
92
|
end
|
86
93
|
|
87
|
-
require 'smart_ioc/bean'
|
94
|
+
require 'smart_ioc/bean'
|
data/smart_ioc.gemspec
CHANGED
@@ -13,8 +13,8 @@ describe SmartIoC::BeanLocator do
|
|
13
13
|
locations = SmartIoC::BeanLocations.get_bean_locations(:repository)
|
14
14
|
|
15
15
|
expect(locations[:test].size).to eq(3)
|
16
|
-
expect(locations[:test][0]).to match(/example\/admins\/repository\/
|
17
|
-
expect(locations[:test][1]).to match(/example\/admins\/repository\/admins_repository.rb/)
|
16
|
+
expect(locations[:test][0]).to match(/example\/admins\/repository\/admins_repository.rb/)
|
17
|
+
expect(locations[:test][1]).to match(/example\/admins\/repository\/test\/admins_repository.rb/)
|
18
18
|
expect(locations[:test][2]).to match(/example\/users\/repository\/users_repository.rb/)
|
19
19
|
}
|
20
20
|
|
data/spec/spec_helper.rb
CHANGED
@@ -1,18 +1,13 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'bundler/setup'
|
3
3
|
require 'simplecov'
|
4
|
+
require 'pry'
|
4
5
|
|
5
6
|
SimpleCov.start do
|
6
7
|
add_filter "/spec/"
|
7
8
|
add_filter "/.direnv/"
|
8
9
|
end
|
9
10
|
|
10
|
-
if ENV['CI']=='true'
|
11
|
-
require 'codecov'
|
12
|
-
|
13
|
-
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
14
|
-
end
|
15
|
-
|
16
11
|
require 'smart_ioc'
|
17
12
|
|
18
13
|
RSpec.configure do |config|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_ioc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruslan Gatiyatov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: pry
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -59,10 +59,10 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
+
- ".github/workflows/rspec.yml"
|
62
63
|
- ".gitignore"
|
63
64
|
- ".rspec"
|
64
65
|
- ".ruby-version"
|
65
|
-
- ".travis.yml"
|
66
66
|
- ".yardops"
|
67
67
|
- Gemfile
|
68
68
|
- Gemfile.lock
|
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
|
-
rubygems_version: 3.
|
138
|
+
rubygems_version: 3.5.11
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: Inversion of Control Container
|