smart_ioc 0.1.30 → 0.2.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/Gemfile.lock +2 -2
- data/lib/smart_ioc/bean_file_loader.rb +4 -0
- data/lib/smart_ioc/bean_locations.rb +7 -0
- data/lib/smart_ioc/container.rb +1 -0
- data/lib/smart_ioc/railtie.rb +24 -0
- data/lib/smart_ioc/version.rb +1 -1
- data/lib/smart_ioc.rb +2 -0
- data/spec/smart_ioc/example/admins/repository/admins_dao.rb +4 -4
- data/spec/smart_ioc/example/admins/repository/test/admins_repository.rb +4 -4
- data/spec/smart_ioc/factory_method_spec.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e4ad2f8d73d09ec4aa7bc84c8bd2b78f302f52c
|
4
|
+
data.tar.gz: 3cc1419f66178f8ceb0adb3d373f5c691c0c66ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa1317bdef1810f0822d31fb6c58c05a9da9d9e38dfab022f703f527e6dd60c7b2f267ae8d5b84da2ce5f57edce126020d116324badc8b645e0653fa7e618d09
|
7
|
+
data.tar.gz: 3d3fc1d281a26604b9356c45da596691e2d6e36fa8a099f76b8c382031a6791ed39c76221884239d3fb7eb5db071574bb047499224197e8e6d3945282d0c0210
|
data/Gemfile.lock
CHANGED
data/lib/smart_ioc/container.rb
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
class SmartIoC::Railtie < Rails::Railtie
|
2
|
+
initializer "smart_ioc.watching_for_bean_changes" do |app|
|
3
|
+
if app.config.reload_classes_only_on_change
|
4
|
+
bean_file_locations = SmartIoC::BeanLocations.get_all_bean_files
|
5
|
+
|
6
|
+
reloader = app.config.file_watcher.new(bean_file_locations) do
|
7
|
+
SmartIoC.container.force_clear_scopes
|
8
|
+
end
|
9
|
+
|
10
|
+
app.config.to_prepare { reloader.execute_if_updated }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
console do
|
15
|
+
module Rails::ConsoleMethods
|
16
|
+
alias :old_reload! :reload!
|
17
|
+
|
18
|
+
def reload!(print = true)
|
19
|
+
SmartIoC.container.force_clear_scopes
|
20
|
+
old_reload!(print = true)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/smart_ioc/version.rb
CHANGED
data/lib/smart_ioc.rb
CHANGED
@@ -26,6 +26,8 @@ module SmartIoC
|
|
26
26
|
require 'smart_ioc/errors'
|
27
27
|
end
|
28
28
|
|
29
|
+
require 'smart_ioc/railtie' if defined?(Rails)
|
30
|
+
|
29
31
|
class << self
|
30
32
|
# @param package_name [String or Symbol] package name for bean definitions
|
31
33
|
# @param dir [String] absolute path with bean definitions
|
@@ -1,3 +1,5 @@
|
|
1
|
+
$data ||= {}
|
2
|
+
|
1
3
|
class AdminsDAO
|
2
4
|
include SmartIoC::Iocify
|
3
5
|
|
@@ -5,16 +7,14 @@ class AdminsDAO
|
|
5
7
|
|
6
8
|
inject :config
|
7
9
|
|
8
|
-
@data = {}
|
9
|
-
|
10
10
|
class << self
|
11
11
|
def insert(entity)
|
12
12
|
config.app_name
|
13
|
-
|
13
|
+
$data[entity.id] = entity
|
14
14
|
end
|
15
15
|
|
16
16
|
def get(id)
|
17
|
-
|
17
|
+
$data[id]
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -1,17 +1,17 @@
|
|
1
|
+
$data ||= {}
|
2
|
+
|
1
3
|
class TestAdminsRepository
|
2
4
|
include SmartIoC::Iocify
|
3
5
|
|
4
6
|
bean :repository, context: :test, instance: false
|
5
7
|
|
6
|
-
@data = {}
|
7
|
-
|
8
8
|
class << self
|
9
9
|
def put(user)
|
10
|
-
|
10
|
+
$data[user.id] = user
|
11
11
|
end
|
12
12
|
|
13
13
|
def get(id)
|
14
|
-
|
14
|
+
$data[id]
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
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.2.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: 2017-
|
11
|
+
date: 2017-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- lib/smart_ioc/extra_package_contexts.rb
|
85
85
|
- lib/smart_ioc/inject_metadata.rb
|
86
86
|
- lib/smart_ioc/iocify.rb
|
87
|
+
- lib/smart_ioc/railtie.rb
|
87
88
|
- lib/smart_ioc/scopes.rb
|
88
89
|
- lib/smart_ioc/scopes/bean.rb
|
89
90
|
- lib/smart_ioc/scopes/prototype.rb
|
@@ -130,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
131
|
version: '0'
|
131
132
|
requirements: []
|
132
133
|
rubyforge_project:
|
133
|
-
rubygems_version: 2.
|
134
|
+
rubygems_version: 2.6.12
|
134
135
|
signing_key:
|
135
136
|
specification_version: 4
|
136
137
|
summary: Inversion of Control Container
|