instance_store 0.0.1.alpha1

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,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b312928324305cff3c9d181e8627232cd95d2e4ee64714e8c4515cb1e69503ff
4
+ data.tar.gz: eec3da316d0eb5dcf533995bffc9ab24b1199c2b658170baa731a35fc57571e8
5
+ SHA512:
6
+ metadata.gz: 0a360c92481b8582115e0631a189a6a4c89f5d3a9222805493d66238f57358d4e019351414286009d9f8bfbc727de720cb1e3ad9bcd0ef5151019f0c6ae90a5b
7
+ data.tar.gz: 336a38bc59c3d33f2e513b6e7509bc0921b07886eaf7746d29f085364e4368d594cad789930befe2c0e1cde37e6d5adecf4fba292336b3dbc476248533bb3683
@@ -0,0 +1,42 @@
1
+ kind: pipeline
2
+ name: default
3
+
4
+ steps:
5
+ - name: install
6
+ image: ruby
7
+ volumes:
8
+ - name: bundle
9
+ path: /usr/local/bundle
10
+ commands:
11
+ - bundle install --jobs=3 --retry=3
12
+
13
+ - name: test
14
+ image: ruby
15
+ environment:
16
+ CODECOV_TOKEN:
17
+ from_secret: CODECOV_TOKEN
18
+ CI: true
19
+ volumes:
20
+ - name: bundle
21
+ path: /usr/local/bundle
22
+ commands:
23
+ - rake
24
+ - name: build_gem
25
+ image: ruby
26
+ environment:
27
+ RUBYGEMS_KEY:
28
+ from_secret: RUBYGEMS_KEY
29
+ volumes:
30
+ - name: bundle
31
+ path: /usr/local/bundle
32
+ commands:
33
+ - sh ./sbin/gem_signin.sh
34
+ - gem build
35
+ - sh ./sbin/gem_push.sh
36
+ when:
37
+ branch: release
38
+ event: push
39
+
40
+ volumes:
41
+ - name: bundle
42
+ temp: {}
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ ../bak/coverage/
3
+ ../bak/.ruby-version
4
+ ../bak/.ruby-gemset
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
@@ -0,0 +1,29 @@
1
+ require:
2
+ - rubocop-rspec
3
+ AllCops:
4
+ NewCops: enable
5
+
6
+ Metrics/BlockLength:
7
+ Enabled: true
8
+ Exclude:
9
+ - ./*.gemspec
10
+ - app/**/*.rb
11
+ - spec/**/*_spec.rb
12
+
13
+ RSpec/NestedGroups:
14
+ Enabled: true
15
+ Exclude:
16
+ - spec/**/*_spec.rb
17
+
18
+ Metrics/MethodLength:
19
+ Enabled: true
20
+ Exclude:
21
+ - config/*.rb
22
+
23
+ RSpec/ExampleLength:
24
+ Enabled: true
25
+ Max: 20
26
+
27
+ RSpec/MultipleExpectations:
28
+ Enabled: true
29
+ Max: 5
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at s.bezugliy@codenv.top. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
@@ -0,0 +1,13 @@
1
+ FROM ruby:2.7.1
2
+
3
+ RUN mkdir -p /opt/app
4
+ WORKDIR /opt/app
5
+
6
+ COPY ./lib/instance_store/version.rb ./lib/instance_store/
7
+ COPY ./Gemfile ./
8
+ COPY instance_store.gemspec ./
9
+ COPY ./Gemfile.lock ./
10
+
11
+ RUN bundle check || bundle install
12
+
13
+ COPY ./sbin/entrypoint.sh ./sbin/
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in codenv.gemspec
6
+ gemspec
7
+
8
+ gem 'minitest', '~> 5.0'
9
+ gem 'rake', '~> 12.0'
@@ -0,0 +1,129 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ instance_store (0.0.1.alpha1)
5
+ guard (~> 2.16)
6
+ rake (~> 12.3)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ ansi (1.5.0)
12
+ ast (2.4.1)
13
+ codecov (0.2.11)
14
+ json
15
+ simplecov
16
+ coderay (1.1.3)
17
+ concurrent-ruby (1.1.7)
18
+ diff-lcs (1.4.4)
19
+ docile (1.3.2)
20
+ fabrication (2.21.1)
21
+ faker (2.14.0)
22
+ i18n (>= 1.6, < 2)
23
+ ffi (1.13.1)
24
+ formatador (0.2.5)
25
+ guard (2.16.2)
26
+ formatador (>= 0.2.4)
27
+ listen (>= 2.7, < 4.0)
28
+ lumberjack (>= 1.0.12, < 2.0)
29
+ nenv (~> 0.1)
30
+ notiffany (~> 0.0)
31
+ pry (>= 0.9.12)
32
+ shellany (~> 0.0)
33
+ thor (>= 0.18.1)
34
+ guard-compat (1.2.1)
35
+ guard-rspec (4.7.3)
36
+ guard (~> 2.1)
37
+ guard-compat (~> 1.1)
38
+ rspec (>= 2.99.0, < 4.0)
39
+ guard-rubocop (1.3.0)
40
+ guard (~> 2.0)
41
+ rubocop (~> 0.20)
42
+ i18n (1.8.5)
43
+ concurrent-ruby (~> 1.0)
44
+ json (2.3.1)
45
+ listen (3.2.1)
46
+ rb-fsevent (~> 0.10, >= 0.10.3)
47
+ rb-inotify (~> 0.9, >= 0.9.10)
48
+ lumberjack (1.2.8)
49
+ method_source (1.0.0)
50
+ minitest (5.14.2)
51
+ nenv (0.3.0)
52
+ notiffany (0.1.3)
53
+ nenv (~> 0.1)
54
+ shellany (~> 0.0)
55
+ parallel (1.19.2)
56
+ parser (2.7.1.5)
57
+ ast (~> 2.4.1)
58
+ pry (0.13.1)
59
+ coderay (~> 1.1)
60
+ method_source (~> 1.0)
61
+ rainbow (3.0.0)
62
+ rake (12.3.3)
63
+ rb-fsevent (0.10.4)
64
+ rb-inotify (0.10.1)
65
+ ffi (~> 1.0)
66
+ regexp_parser (1.8.0)
67
+ rexml (3.2.4)
68
+ rspec (3.9.0)
69
+ rspec-core (~> 3.9.0)
70
+ rspec-expectations (~> 3.9.0)
71
+ rspec-mocks (~> 3.9.0)
72
+ rspec-core (3.9.2)
73
+ rspec-support (~> 3.9.3)
74
+ rspec-expectations (3.9.2)
75
+ diff-lcs (>= 1.2.0, < 2.0)
76
+ rspec-support (~> 3.9.0)
77
+ rspec-mocks (3.9.1)
78
+ diff-lcs (>= 1.2.0, < 2.0)
79
+ rspec-support (~> 3.9.0)
80
+ rspec-support (3.9.3)
81
+ rubocop (0.92.0)
82
+ parallel (~> 1.10)
83
+ parser (>= 2.7.1.5)
84
+ rainbow (>= 2.2.2, < 4.0)
85
+ regexp_parser (>= 1.7)
86
+ rexml
87
+ rubocop-ast (>= 0.5.0)
88
+ ruby-progressbar (~> 1.7)
89
+ unicode-display_width (>= 1.4.0, < 2.0)
90
+ rubocop-ast (0.6.0)
91
+ parser (>= 2.7.1.5)
92
+ rubocop-rspec (1.43.2)
93
+ rubocop (~> 0.87)
94
+ ruby-progressbar (1.10.1)
95
+ shellany (0.0.1)
96
+ simplecov (0.19.0)
97
+ docile (~> 1.1)
98
+ simplecov-html (~> 0.11)
99
+ simplecov-console (0.7.2)
100
+ ansi
101
+ simplecov
102
+ terminal-table
103
+ simplecov-html (0.12.3)
104
+ terminal-table (1.8.0)
105
+ unicode-display_width (~> 1.1, >= 1.1.1)
106
+ thor (1.0.1)
107
+ unicode-display_width (1.7.0)
108
+
109
+ PLATFORMS
110
+ ruby
111
+
112
+ DEPENDENCIES
113
+ codecov (~> 0.2)
114
+ fabrication (~> 2.21)
115
+ faker (~> 2.14)
116
+ guard-rspec (~> 4.7)
117
+ guard-rubocop (~> 1.3)
118
+ instance_store!
119
+ minitest (~> 5.0)
120
+ pry (~> 0.13)
121
+ rake (~> 12.0)
122
+ rspec (~> 3.9)
123
+ rubocop (~> 0.92)
124
+ rubocop-rspec (~> 1.43)
125
+ simplecov (~> 0.19)
126
+ simplecov-console (~> 0.7)
127
+
128
+ BUNDLED WITH
129
+ 2.1.4
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ clearing :on
4
+
5
+ scope groups: [:qa]
6
+ scope plugins: %i[rspec rubocop]
7
+
8
+ group :qa do
9
+ guard :rspec, all_on_start: true, cmd: 'rspec -c --format doc' do
10
+ require 'guard/rspec/dsl'
11
+ dsl = Guard::RSpec::Dsl.new(self)
12
+
13
+ # Feel free to open issues for suggestions and improvements
14
+ watch('Gemfile.lock')
15
+ watch(%r{^(lib)/.*})
16
+ # RSpec files
17
+ rspec = dsl.rspec
18
+ watch(rspec.spec_helper) { rspec.spec_dir }
19
+ watch(rspec.spec_support) { rspec.spec_dir }
20
+ watch(rspec.spec_files)
21
+
22
+ # Ruby files
23
+ ruby = dsl.ruby
24
+ dsl.watch_spec_files_for(ruby.lib_files)
25
+
26
+ watch(%r{^spec/fabricators/.+_spec\.rb$})
27
+ end
28
+
29
+ guard :rubocop, all_on_start: true do
30
+ watch(/.+\.rb$/)
31
+ watch(%r{^spec/.+_spec\.rb$})
32
+ watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) }
33
+ end
34
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Sergey Bezugliy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,14 @@
1
+ # Instantiator
2
+ **WIP, draft.**
3
+
4
+ [![Build Status](https://cloud.drone.io/api/badges/sbezugliy/instance_store/status.svg)](https://cloud.drone.io/sbezugliy/instance_store)
5
+
6
+ [![Maintainability](https://api.codeclimate.com/v1/badges/8ee693b9dad0419eb64e/maintainability)](https://codeclimate.com/github/sbezugliy/instance_store/maintainability)
7
+
8
+ [![codecov](https://codecov.io/gh/sbezugliy/instance_store/branch/master/graph/badge.svg)](https://codecov.io/gh/sbezugliy/instance_store)
9
+
10
+ Ruby instance containerization library, providing tools
11
+ for preinitialization and managemant, cloning and duplication of objects.
12
+
13
+ ## Tests
14
+ > $ docker-compose up
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+
5
+
6
+ begin
7
+ require 'rspec/core/rake_task'
8
+
9
+ RSpec::Core::RakeTask.new(:spec)
10
+
11
+ task :default => :spec
12
+ rescue LoadError
13
+ # no rspec available
14
+ end
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'instance_store'
6
+
7
+ require 'pry'
8
+ Pry.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ {
2
+ "result": {
3
+ "covered_percent": 100.0
4
+ }
5
+ }
@@ -0,0 +1,232 @@
1
+ {
2
+ "RSpec": {
3
+ "coverage": {
4
+ "/drone/src/spec/instance_store/error_spec.rb": {
5
+ "lines": [
6
+ null,
7
+ null,
8
+ 1,
9
+ null,
10
+ 1,
11
+ 4,
12
+ null,
13
+ 1,
14
+ 3,
15
+ 6,
16
+ null,
17
+ null,
18
+ null,
19
+ null,
20
+ null,
21
+ null,
22
+ 1,
23
+ 2,
24
+ null,
25
+ 1,
26
+ null,
27
+ null,
28
+ null,
29
+ null,
30
+ 1,
31
+ 2,
32
+ null,
33
+ 1,
34
+ null,
35
+ null,
36
+ null,
37
+ null,
38
+ 1,
39
+ 2,
40
+ null,
41
+ 1,
42
+ null,
43
+ null,
44
+ null,
45
+ null
46
+ ]
47
+ },
48
+ "/drone/src/spec/instance_store/instantiator_spec.rb": {
49
+ "lines": [
50
+ null,
51
+ null,
52
+ 1,
53
+ 1,
54
+ 1,
55
+ null,
56
+ 1,
57
+ 11,
58
+ null,
59
+ 1,
60
+ 1,
61
+ 1,
62
+ 1,
63
+ 1,
64
+ null,
65
+ null,
66
+ 1,
67
+ 1,
68
+ null,
69
+ null,
70
+ null,
71
+ null,
72
+ null,
73
+ 1,
74
+ null,
75
+ null,
76
+ null,
77
+ null,
78
+ null,
79
+ null,
80
+ null,
81
+ null,
82
+ 1,
83
+ 1,
84
+ 6,
85
+ 6,
86
+ 6,
87
+ null,
88
+ null,
89
+ 1,
90
+ 1,
91
+ 2,
92
+ null,
93
+ null,
94
+ null,
95
+ null,
96
+ 1,
97
+ 5,
98
+ 4,
99
+ null,
100
+ 1,
101
+ 1,
102
+ null,
103
+ null,
104
+ null,
105
+ null,
106
+ null,
107
+ null,
108
+ null,
109
+ 1,
110
+ 1,
111
+ null,
112
+ null,
113
+ null,
114
+ null,
115
+ null,
116
+ null,
117
+ null,
118
+ 1,
119
+ 1,
120
+ null,
121
+ null,
122
+ null,
123
+ 1,
124
+ 1,
125
+ null,
126
+ null,
127
+ 1,
128
+ 1,
129
+ null,
130
+ null,
131
+ null,
132
+ 1,
133
+ 1,
134
+ null,
135
+ null,
136
+ null,
137
+ null,
138
+ null,
139
+ 1,
140
+ 1,
141
+ 1,
142
+ null,
143
+ null,
144
+ null,
145
+ null,
146
+ null,
147
+ null,
148
+ null,
149
+ null,
150
+ null,
151
+ null,
152
+ null,
153
+ 1,
154
+ 1,
155
+ null,
156
+ null,
157
+ null,
158
+ null,
159
+ null,
160
+ null,
161
+ null,
162
+ null,
163
+ 1,
164
+ 1,
165
+ 2,
166
+ null,
167
+ null,
168
+ null,
169
+ null,
170
+ 1,
171
+ 1,
172
+ 2,
173
+ null,
174
+ null,
175
+ null,
176
+ null
177
+ ]
178
+ },
179
+ "/drone/src/spec/support/mock/test_a.rb": {
180
+ "lines": [
181
+ null,
182
+ null,
183
+ 1,
184
+ 1,
185
+ 1,
186
+ null,
187
+ 1,
188
+ 15,
189
+ 15,
190
+ 15,
191
+ null,
192
+ null,
193
+ 1,
194
+ null,
195
+ 10,
196
+ null,
197
+ null,
198
+ null,
199
+ null,
200
+ null,
201
+ null
202
+ ]
203
+ },
204
+ "/drone/src/spec/support/mock/test_b.rb": {
205
+ "lines": [
206
+ null,
207
+ null,
208
+ 1,
209
+ 1,
210
+ 1,
211
+ null,
212
+ 1,
213
+ 7,
214
+ 7,
215
+ 7,
216
+ null,
217
+ null,
218
+ 1,
219
+ null,
220
+ 1,
221
+ null,
222
+ null,
223
+ null,
224
+ null,
225
+ null,
226
+ null
227
+ ]
228
+ }
229
+ },
230
+ "timestamp": 1601245561
231
+ }
232
+ }
File without changes
@@ -0,0 +1,11 @@
1
+ version: '3.7'
2
+ services:
3
+ instantiator_test:
4
+ image: instantiator:latest
5
+ build:
6
+ context: .
7
+ dockerfile: Dockerfile
8
+ entrypoint: /opt/app/sbin/entrypoint.sh
9
+ volumes:
10
+ - ./:/opt/app/
11
+ command: bundle exec guard --no-bundler-warning --no-interactions
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/instance_store/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'instance_store'
7
+ spec.version = InstanceStore::VERSION
8
+ spec.authors = ['Sergey']
9
+ spec.email = ['s.bezugliy@codenv.top']
10
+
11
+ spec.summary = 'Ruby instance containerization library, providing tools \
12
+ for preinitialization and managemant, cloning and duplication of objects. WIP, draft.'
13
+ spec.description = 'Ruby instance containerization library, providing tools \
14
+ for preinitialization and managemant, cloning and duplication of objects. WIP, draft.'
15
+ spec.homepage = 'https://codenv.top'
16
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
17
+
18
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
19
+
20
+ spec.metadata['homepage_uri'] = spec.homepage
21
+ spec.metadata['source_code_uri'] = 'https://github.com'
22
+ spec.metadata['changelog_uri'] = 'https://github.com'
23
+
24
+ # Specify which files should be added to the gem when it is released.
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
+ spec.bindir = 'bin'
29
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
30
+ spec.require_paths = %w[lib]
31
+
32
+ spec.add_runtime_dependency 'guard', '~> 2.16'
33
+ spec.add_runtime_dependency 'rake', '~> 12.3'
34
+
35
+ spec.add_development_dependency 'codecov', '~> 0.2'
36
+ spec.add_development_dependency 'fabrication', '~> 2.21'
37
+ spec.add_development_dependency 'faker', '~> 2.14'
38
+ spec.add_development_dependency 'guard-rspec', '~> 4.7'
39
+ spec.add_development_dependency 'guard-rubocop', '~> 1.3'
40
+ spec.add_development_dependency 'pry', '~> 0.13'
41
+ spec.add_development_dependency 'rspec', '~> 3.9'
42
+ spec.add_development_dependency 'rubocop', '~> 0.92'
43
+ spec.add_development_dependency 'rubocop-rspec', '~> 1.43'
44
+ spec.add_development_dependency 'simplecov', '~> 0.19'
45
+ spec.add_development_dependency 'simplecov-console', '~> 0.7'
46
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Mixin module for common methods
4
+ module CoreMixins
5
+ # Transforms symbol or string to object constantized name
6
+ def to_classname
7
+ to_s.capitalize.gsub(/_(\w)/) { Regexp.last_match(1).upcase }
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ # String core class extensions
4
+ class String
5
+ include CoreMixins
6
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Symbol core class extensions
4
+ class Symbol
5
+ include CoreMixins
6
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'core_ext/core_mixins'
4
+ require 'core_ext/string'
5
+ require 'core_ext/symbol'
6
+
7
+ require 'instance_store/error'
8
+ require 'instance_store/instantiator'
9
+
10
+ # Instance store module
11
+ module InstanceStore; end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module InstanceStore
4
+ # Error for absent module
5
+ class NoModuleError < StandardError
6
+ def initialize(module_name, message = nil)
7
+ msg = message || "Module `#{module_name.to_classname}` is undefined"
8
+ super(msg)
9
+ end
10
+ end
11
+
12
+ # Error for absent class
13
+ class NoClassError < StandardError
14
+ def initialize(module_name, class_name, message = nil)
15
+ msg = message || "Class `#{module_name.to_classname}::#{class_name.to_classname}` is undefined"
16
+ super(msg)
17
+ end
18
+ end
19
+
20
+ # Error for nil alias name
21
+ class NilAliasNameError < StandardError
22
+ def initialize(module_name, class_name, message = nil)
23
+ msg = message || "Alias name is nil for cloned `#{module_name.to_classname}::#{class_name.to_classname}`."
24
+ super(msg)
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ module InstanceStore
4
+ # Instantiator and loader
5
+ class Instantiator
6
+ attr_reader :types
7
+ attr_accessor :i
8
+
9
+ def initialize(types = [:Config])
10
+ @i = {}
11
+ @types = types
12
+ build_storage
13
+ end
14
+
15
+ def types=(types)
16
+ @types = types
17
+ build_storage
18
+ end
19
+
20
+ def build_storage
21
+ @i.merge! Hash[@types.map { |t| [t, @i[t] || {}] }]
22
+ end
23
+
24
+ def add(type, name, args: {}, clone: false, alias_name: nil)
25
+ alias_check(type, name, clone, alias_name)
26
+ inst = select_instance(type, name, args)
27
+ @i[type][alias_name] = inst.clone if clone
28
+ end
29
+
30
+ def get(type, name)
31
+ caller_check(type, name)
32
+ @i[type][name]
33
+ end
34
+
35
+ private
36
+
37
+ def select_instance(type, name, args)
38
+ @i[type][name] unless @i[type].nil? || @i[type][name].nil?
39
+ @i[type][name] = instantiate(type, name, args)
40
+ end
41
+
42
+ def alias_check(type, name, clone, alias_name)
43
+ return unless clone
44
+ return unless alias_name.nil?
45
+
46
+ raise InstanceStore::NilAliasNameError.new(type, name)
47
+ end
48
+
49
+ def caller_check(type, name)
50
+ raise(InstanceStore::NoModuleError, type) unless @i.keys.include?(type)
51
+ raise(InstanceStore::NoClassError.new(type, name)) unless @i[type].keys.include?(name)
52
+ end
53
+
54
+ def instantiate(type, name, args)
55
+ klass = eval_module(type).class_eval(name.to_classname)
56
+ if args.empty?
57
+ klass.new
58
+ else
59
+ klass.new(**args)
60
+ end
61
+ end
62
+
63
+ def eval_module(type)
64
+ Object.class_eval(type.to_classname)
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module InstanceStore
4
+ VERSION = '0.0.1.alpha1'
5
+ end
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+ bundle check || bundle install
3
+ bundle exec guard --no-bundler-warning --no-interactions
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bash
2
+ gem push $(ls -t instance_store-*.gem | head -1)
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env bash
2
+ mkdir -p ~/.gem
3
+ echo "---
4
+ :rubygems_api_key: ${RUBYGEMS_KEY}
5
+ " > ~/.gem/credentials
6
+ chmod 0600 -R ~/.gem
7
+ gem signin
metadata ADDED
@@ -0,0 +1,262 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: instance_store
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.alpha1
5
+ platform: ruby
6
+ authors:
7
+ - Sergey
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-09-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: guard
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.16'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '12.3'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '12.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: codecov
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.2'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: fabrication
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.21'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.21'
69
+ - !ruby/object:Gem::Dependency
70
+ name: faker
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.14'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.14'
83
+ - !ruby/object:Gem::Dependency
84
+ name: guard-rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '4.7'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '4.7'
97
+ - !ruby/object:Gem::Dependency
98
+ name: guard-rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.3'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.3'
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
+ - !ruby/object:Gem::Dependency
126
+ name: rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '3.9'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '3.9'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.92'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '0.92'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rubocop-rspec
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '1.43'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '1.43'
167
+ - !ruby/object:Gem::Dependency
168
+ name: simplecov
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '0.19'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '0.19'
181
+ - !ruby/object:Gem::Dependency
182
+ name: simplecov-console
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '0.7'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '0.7'
195
+ description: |-
196
+ Ruby instance containerization library, providing tools \
197
+ for preinitialization and managemant, cloning and duplication of objects. WIP, draft.
198
+ email:
199
+ - s.bezugliy@codenv.top
200
+ executables:
201
+ - console
202
+ - setup
203
+ extensions: []
204
+ extra_rdoc_files: []
205
+ files:
206
+ - ".drone.yml"
207
+ - ".gitignore"
208
+ - ".rspec"
209
+ - ".rubocop.yml"
210
+ - CODE_OF_CONDUCT.md
211
+ - Dockerfile
212
+ - Gemfile
213
+ - Gemfile.lock
214
+ - Guardfile
215
+ - LICENSE
216
+ - README.MD
217
+ - Rakefile
218
+ - bin/console
219
+ - bin/setup
220
+ - coverage/.last_run.json
221
+ - coverage/.resultset.json
222
+ - coverage/.resultset.json.lock
223
+ - docker-compose.yml
224
+ - instance_store.gemspec
225
+ - lib/core_ext/core_mixins.rb
226
+ - lib/core_ext/string.rb
227
+ - lib/core_ext/symbol.rb
228
+ - lib/instance_store.rb
229
+ - lib/instance_store/error.rb
230
+ - lib/instance_store/instantiator.rb
231
+ - lib/instance_store/version.rb
232
+ - sbin/entrypoint.sh
233
+ - sbin/gem_push.sh
234
+ - sbin/gem_signin.sh
235
+ homepage: https://codenv.top
236
+ licenses: []
237
+ metadata:
238
+ allowed_push_host: https://rubygems.org
239
+ homepage_uri: https://codenv.top
240
+ source_code_uri: https://github.com
241
+ changelog_uri: https://github.com
242
+ post_install_message:
243
+ rdoc_options: []
244
+ require_paths:
245
+ - lib
246
+ required_ruby_version: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - ">="
249
+ - !ruby/object:Gem::Version
250
+ version: 2.3.0
251
+ required_rubygems_version: !ruby/object:Gem::Requirement
252
+ requirements:
253
+ - - ">"
254
+ - !ruby/object:Gem::Version
255
+ version: 1.3.1
256
+ requirements: []
257
+ rubygems_version: 3.1.2
258
+ signing_key:
259
+ specification_version: 4
260
+ summary: Ruby instance containerization library, providing tools \ for preinitialization
261
+ and managemant, cloning and duplication of objects. WIP, draft.
262
+ test_files: []