smart_ioc 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/smart_ioc/bean.rb +5 -1
- data/lib/smart_ioc/bean_definitions_storage.rb +5 -3
- data/lib/smart_ioc/bean_factory.rb +0 -2
- data/lib/smart_ioc/iocify.rb +2 -2
- data/lib/smart_ioc/version.rb +1 -1
- data/spec/smart_ioc/example/admins/repository/admins_dao.rb +2 -4
- data/spec/smart_ioc/example/admins/repository/admins_repository.rb +1 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01e3fac1f32289e170915d3251e88d937f970f6396ef7d6a8c7b2163696001f2
|
4
|
+
data.tar.gz: 15f36e9c706c0cfdb59c86e8f40cf1106361346b0f0def709f9618b3821cc865
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11fae8af77f705ecdbd3a6039dd5c148abd28fc5ef8e584644179f76f23f1c061f4dc4c049a593f308037ef0e1f033c0cd6641e3d761447e51a97c6ea3699efd
|
7
|
+
data.tar.gz: 82ea8d86866fe7eace9a1db47da5fd87457cd499425387aa977d086ac514525463902e8f4f8261ae91c4ba9e35ddc0b4f25761303552e35c63c05edd34d2ba7a
|
data/Gemfile.lock
CHANGED
data/lib/smart_ioc/bean.rb
CHANGED
@@ -9,11 +9,15 @@ def bean(bean_name, &proc)
|
|
9
9
|
klass.instance_variable_set(:@anonymous_bean, true)
|
10
10
|
klass.instance_exec(&proc)
|
11
11
|
|
12
|
+
file_path = caller[0].split(':').first
|
13
|
+
package = SmartIoC::BeanLocations.get_bean_package(file_path)
|
14
|
+
|
12
15
|
klass.instance_exec do
|
13
16
|
bean(
|
14
17
|
bean_name,
|
18
|
+
file_path: file_path,
|
15
19
|
scope: instance_variable_get(:@scope) || nil,
|
16
|
-
package: instance_variable_get(:@package) ||
|
20
|
+
package: instance_variable_get(:@package) || package,
|
17
21
|
instance: instance_variable_get(:@instance) || false,
|
18
22
|
factory_method: instance_variable_get(:@factory_method) || nil,
|
19
23
|
context: instance_variable_get(:@context) || nil,
|
@@ -21,12 +21,14 @@ class SmartIoC::BeanDefinitionsStorage
|
|
21
21
|
|
22
22
|
if existing_bd
|
23
23
|
error_msg =
|
24
|
-
%Q(
|
24
|
+
%Q(Unable to add bean to definitions storage.
|
25
25
|
Bean definition already exists.
|
26
|
+
|
26
27
|
New bean details:
|
27
|
-
|
28
|
+
#{bean_definition.inspect}
|
29
|
+
|
28
30
|
Existing bean details:
|
29
|
-
|
31
|
+
#{existing_bd.inspect})
|
30
32
|
|
31
33
|
raise ArgumentError, error_msg
|
32
34
|
end
|
@@ -120,8 +120,6 @@ class SmartIoC::BeanFactory
|
|
120
120
|
end
|
121
121
|
|
122
122
|
if smart_bds.size > 1
|
123
|
-
require 'byebug'
|
124
|
-
debugger
|
125
123
|
raise ArgumentError.new(
|
126
124
|
%Q(Unable to autodetect bean :#{bean}#{parent_bean_name ? " for bean :#{parent_bean_name}" : ''}.
|
127
125
|
Several definitions were found:\n
|
data/lib/smart_ioc/iocify.rb
CHANGED
@@ -64,8 +64,8 @@ module SmartIoC::Iocify
|
|
64
64
|
# @param context [Symbol] set bean context (ex: :test)
|
65
65
|
# @param after_init [Symbol] name of bean method that will be called after bean initialization (ex: :test)
|
66
66
|
# @return nil
|
67
|
-
def bean(bean_name, scope: nil, package: nil, instance: true, factory_method: nil, context: nil, after_init: nil)
|
68
|
-
file_path
|
67
|
+
def bean(bean_name, scope: nil, package: nil, instance: true, factory_method: nil, context: nil, after_init: nil, file_path: nil)
|
68
|
+
file_path ||= caller[0].split(':').first
|
69
69
|
package ||= SmartIoC::BeanLocations.get_bean_package(file_path)
|
70
70
|
context ||= SmartIoC::Container::DEFAULT_CONTEXT
|
71
71
|
bean_definition = SmartIoC.get_bean_definition(bean_name, package, context)
|
data/lib/smart_ioc/version.rb
CHANGED
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.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruslan Gatiyatov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|