smart_injection 0.0.0.alpha

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.
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @api private
4
+ # @since 0.1.0
5
+ module SmartCore::Injection::Locator::Factory
6
+ class << self
7
+ # @param injection_settings [SmartCore::Injection::Injector::InjectionSettings]
8
+ # @return [SmartCore::Injection::Locator]
9
+ #
10
+ # @api private
11
+ # @since 0.1.0
12
+ def create(injection_settings, import_key, import_path)
13
+ container_proxy = create_container_proxy(injection_settings)
14
+ locator = create_locator(import_path, container_proxy).tap do
15
+ control_inection_memoization(injection_settings, container_proxy, locator, import_path)
16
+ end
17
+ end
18
+
19
+ private
20
+
21
+ # @return [SmartCore::Injection::Locator::ContainerProxy]
22
+ #
23
+ # @api private
24
+ # @since 0.1.0
25
+ def create_container_proxy(injection_settings)
26
+ SmartCore::Injection::Locator::ContainerProxy.new(
27
+ injection_settings.container_set,
28
+ injection_settings.from
29
+ )
30
+ end
31
+
32
+ # @param import_path [String]
33
+ # @param container_proxy [SmartCore::Injection::Locator::ContainerProxy]
34
+ # @return [SmartCore::Injection::Locator]
35
+ #
36
+ # @api private
37
+ # @since 0.1.0
38
+ def create_locator(import_path, container_proxy)
39
+ SmartCore::Injection::Locator.new(import_path, container_proxy)
40
+ end
41
+
42
+ # @param injection_settings [SmartCore::Injection::Injector::InjectionSettings]
43
+ # @param locator [SmartCore::Injection::Locator]
44
+ # @param import_path [String]
45
+ # @return [void]
46
+ #
47
+ # @api private
48
+ # @since 0.1.0
49
+ def control_inection_memoization(injection_settings, container_proxy, locator, import_path)
50
+ container_proxy.observe(import_path) { locator.rebind! } unless injection_settings.memoize
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SmartCore
4
+ module Injection
5
+ # @return [String]
6
+ #
7
+ # @api public
8
+ # @since 0.1.0
9
+ VERSION = '0.0.0.alpha'
10
+ end
11
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/smart_core/injection/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.4.10')
7
+
8
+ spec.name = 'smart_injection'
9
+ spec.version = SmartCore::Injection::VERSION
10
+ spec.authors = ['Rustam Ibragimov']
11
+ spec.email = ['iamdaiver@gmail.com']
12
+
13
+ spec.summary = 'DI principles and idioms realized in scope of Ruby'
14
+ spec.description = 'DI principles and idioms realized in scope of Ruby'
15
+ spec.homepage = 'https://github.com/smart-rb/smart_injection'
16
+ spec.license = 'MIT'
17
+
18
+ spec.metadata['homepage_uri'] =
19
+ spec.homepage
20
+ spec.metadata['source_code_uri'] =
21
+ 'https://github.com/smart-rb/smart_injection'
22
+ spec.metadata['changelog_uri'] =
23
+ 'https://github.com/smart-rb/smart_injection/blob/master/CHANGELOG.md'
24
+
25
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
27
+ end
28
+
29
+ spec.bindir = 'exe'
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ['lib']
32
+
33
+ spec.add_runtime_dependency 'smart_engine', '~> 0.7'
34
+ spec.add_runtime_dependency 'smart_container', '~> 0.7'
35
+
36
+ spec.add_development_dependency 'bundler', '~> 2.1'
37
+ spec.add_development_dependency 'rake', '~> 13.0'
38
+ spec.add_development_dependency 'rspec', '~> 3.9'
39
+ spec.add_development_dependency 'armitage-rubocop', '~> 0.85'
40
+ spec.add_development_dependency 'simplecov', '~> 0.18'
41
+ spec.add_development_dependency 'pry', '~> 0.13'
42
+ end
metadata ADDED
@@ -0,0 +1,187 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: smart_injection
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0.alpha
5
+ platform: ruby
6
+ authors:
7
+ - Rustam Ibragimov
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-07-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: smart_engine
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: smart_container
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.7'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.1'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '13.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '13.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.9'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.9'
83
+ - !ruby/object:Gem::Dependency
84
+ name: armitage-rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.85'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.85'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.18'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.18'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.13'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.13'
125
+ description: DI principles and idioms realized in scope of Ruby
126
+ email:
127
+ - iamdaiver@gmail.com
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - ".gitignore"
133
+ - ".rspec"
134
+ - ".rubocop.yml"
135
+ - ".travis.yml"
136
+ - CHANGELOG.md
137
+ - CODE_OF_CONDUCT.md
138
+ - Gemfile
139
+ - Gemfile.lock
140
+ - LICENSE.txt
141
+ - README.md
142
+ - Rakefile
143
+ - bin/console
144
+ - bin/setup
145
+ - lib/smart_core/injection.rb
146
+ - lib/smart_core/injection/dsl.rb
147
+ - lib/smart_core/injection/errors.rb
148
+ - lib/smart_core/injection/injector.rb
149
+ - lib/smart_core/injection/injector/container_set.rb
150
+ - lib/smart_core/injection/injector/injection_settings.rb
151
+ - lib/smart_core/injection/injector/injection_settings/incompatability_control.rb
152
+ - lib/smart_core/injection/injector/modulizer.rb
153
+ - lib/smart_core/injection/injector/strategies.rb
154
+ - lib/smart_core/injection/injector/strategies/method_injection.rb
155
+ - lib/smart_core/injection/locator.rb
156
+ - lib/smart_core/injection/locator/container_proxy.rb
157
+ - lib/smart_core/injection/locator/dependency.rb
158
+ - lib/smart_core/injection/locator/factory.rb
159
+ - lib/smart_core/injection/version.rb
160
+ - smart_injection.gemspec
161
+ homepage: https://github.com/smart-rb/smart_injection
162
+ licenses:
163
+ - MIT
164
+ metadata:
165
+ homepage_uri: https://github.com/smart-rb/smart_injection
166
+ source_code_uri: https://github.com/smart-rb/smart_injection
167
+ changelog_uri: https://github.com/smart-rb/smart_injection/blob/master/CHANGELOG.md
168
+ post_install_message:
169
+ rdoc_options: []
170
+ require_paths:
171
+ - lib
172
+ required_ruby_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: 2.4.10
177
+ required_rubygems_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">"
180
+ - !ruby/object:Gem::Version
181
+ version: 1.3.1
182
+ requirements: []
183
+ rubygems_version: 3.1.2
184
+ signing_key:
185
+ specification_version: 4
186
+ summary: DI principles and idioms realized in scope of Ruby
187
+ test_files: []