smart_ioc 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/smart_ioc/bean_locations.rb +8 -1
- data/lib/smart_ioc/version.rb +1 -1
- data/spec/smart_ioc/bean_locations_spec.rb +14 -0
- data/spec/smart_ioc/bean_locator_spec.rb +2 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aeab800e2e18812c2d25fe456a4e9d434e3ca63c
|
4
|
+
data.tar.gz: a7a3247fe3174be4e45453af569bc631cb81eae6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 317128788531e93c88f58e866322151c79f8af17e229f28ef1e8b641152e91d813ffc2d44d2fb80dbf986c65ec658059245472b1343d57e3ba32238e76c77752
|
7
|
+
data.tar.gz: e07b6743d555dc82ed0a1b18252771747f91f463adfce06b57dc91f32dcf7522851bd4f772a32df32bd7f1f188fadfa639c1c85828c219d2eba6dd8d0c110b83
|
data/Gemfile.lock
CHANGED
@@ -11,7 +11,8 @@
|
|
11
11
|
# }
|
12
12
|
# }
|
13
13
|
class SmartIoC::BeanLocations
|
14
|
-
@data
|
14
|
+
@data = {}
|
15
|
+
@paths = {}
|
15
16
|
|
16
17
|
class << self
|
17
18
|
# @param package_name [Symbol] bean package name (ex: :repository)
|
@@ -23,12 +24,18 @@ class SmartIoC::BeanLocations
|
|
23
24
|
@data[package_name] ||= {}
|
24
25
|
package_beans = @data[package_name]
|
25
26
|
|
27
|
+
@paths[bean_path] = bean
|
28
|
+
|
26
29
|
package_beans[bean] ||= []
|
27
30
|
package_beans[bean].push(bean_path)
|
28
31
|
|
29
32
|
nil
|
30
33
|
end
|
31
34
|
|
35
|
+
def get_bean_by_path(path)
|
36
|
+
@paths[path]
|
37
|
+
end
|
38
|
+
|
32
39
|
# @param bean [Symbol] bean name (ex: :users_repository)
|
33
40
|
# @return Hash[Array[String]] hash of bean definitions from all packages
|
34
41
|
def get_bean_locations(bean)
|
data/lib/smart_ioc/version.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SmartIoC::BeanLocations do
|
4
|
+
before :all do
|
5
|
+
SmartIoC.clear
|
6
|
+
end
|
7
|
+
|
8
|
+
it {
|
9
|
+
path = '/app/test_path'
|
10
|
+
SmartIoC::BeanLocations.add_bean(:test, :test_bean, path)
|
11
|
+
|
12
|
+
expect(SmartIoC::BeanLocations.get_bean_by_path(path)).to eq(:test_bean)
|
13
|
+
}
|
14
|
+
end
|
@@ -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\/admins_repository.rb/)
|
17
|
-
expect(locations[:test][1]).to match(/example\/admins\/repository\/
|
16
|
+
expect(locations[:test][0]).to match(/example\/admins\/repository\/test\/admins_repository.rb/)
|
17
|
+
expect(locations[:test][1]).to match(/example\/admins\/repository\/admins_repository.rb/)
|
18
18
|
expect(locations[:test][2]).to match(/example\/users\/repository\/users_repository.rb/)
|
19
19
|
}
|
20
20
|
|
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.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruslan Gatiyatov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- spec/smart_ioc/bean_definition_spec.rb
|
96
96
|
- spec/smart_ioc/bean_factory_spec.rb
|
97
97
|
- spec/smart_ioc/bean_file_loader_spec.rb
|
98
|
+
- spec/smart_ioc/bean_locations_spec.rb
|
98
99
|
- spec/smart_ioc/bean_locator_spec.rb
|
99
100
|
- spec/smart_ioc/container_spec.rb
|
100
101
|
- spec/smart_ioc/example/admins/repository/admins_dao.rb
|
@@ -139,6 +140,7 @@ test_files:
|
|
139
140
|
- spec/smart_ioc/bean_definition_spec.rb
|
140
141
|
- spec/smart_ioc/bean_factory_spec.rb
|
141
142
|
- spec/smart_ioc/bean_file_loader_spec.rb
|
143
|
+
- spec/smart_ioc/bean_locations_spec.rb
|
142
144
|
- spec/smart_ioc/bean_locator_spec.rb
|
143
145
|
- spec/smart_ioc/container_spec.rb
|
144
146
|
- spec/smart_ioc/example/admins/repository/admins_dao.rb
|