avm-tools 0.121.2 → 0.124.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -0
  3. data/lib/avm/tools/runner/app_src/info.rb +19 -0
  4. data/lib/avm/tools/runner/application_stereotypes/list.rb +31 -0
  5. data/lib/avm/tools/runner/application_stereotypes.rb +16 -0
  6. data/lib/avm/tools/version.rb +1 -1
  7. metadata +6 -63
  8. data/lib/avm/tools/runner/eac_redmine_base0/dev_docker.rb +0 -17
  9. data/sub/eac_config/Gemfile +0 -5
  10. data/sub/eac_config/eac_config.gemspec +0 -19
  11. data/sub/eac_config/lib/eac_config/entry.rb +0 -53
  12. data/sub/eac_config/lib/eac_config/entry_path.rb +0 -41
  13. data/sub/eac_config/lib/eac_config/envvars_node/entry.rb +0 -54
  14. data/sub/eac_config/lib/eac_config/envvars_node.rb +0 -25
  15. data/sub/eac_config/lib/eac_config/load_nodes_search.rb +0 -39
  16. data/sub/eac_config/lib/eac_config/load_path.rb +0 -28
  17. data/sub/eac_config/lib/eac_config/node.rb +0 -67
  18. data/sub/eac_config/lib/eac_config/node_entry.rb +0 -22
  19. data/sub/eac_config/lib/eac_config/node_uri.rb +0 -38
  20. data/sub/eac_config/lib/eac_config/old_configs/base.rb +0 -43
  21. data/sub/eac_config/lib/eac_config/old_configs/file.rb +0 -47
  22. data/sub/eac_config/lib/eac_config/old_configs.rb +0 -75
  23. data/sub/eac_config/lib/eac_config/paths_hash/entry_key_error.rb +0 -8
  24. data/sub/eac_config/lib/eac_config/paths_hash/node.rb +0 -67
  25. data/sub/eac_config/lib/eac_config/paths_hash/path_search.rb +0 -39
  26. data/sub/eac_config/lib/eac_config/paths_hash.rb +0 -63
  27. data/sub/eac_config/lib/eac_config/rspec/setup.rb +0 -65
  28. data/sub/eac_config/lib/eac_config/rspec.rb +0 -9
  29. data/sub/eac_config/lib/eac_config/version.rb +0 -5
  30. data/sub/eac_config/lib/eac_config/yaml_file_node/entry.rb +0 -36
  31. data/sub/eac_config/lib/eac_config/yaml_file_node.rb +0 -47
  32. data/sub/eac_config/lib/eac_config.rb +0 -7
  33. data/sub/eac_config/spec/lib/eac_config/entry_path_spec.rb +0 -30
  34. data/sub/eac_config/spec/lib/eac_config/envvars_node/entry_spec.rb +0 -14
  35. data/sub/eac_config/spec/lib/eac_config/envvars_node_spec.rb +0 -40
  36. data/sub/eac_config/spec/lib/eac_config/old_configs_spec.rb +0 -46
  37. data/sub/eac_config/spec/lib/eac_config/paths_hash_spec.rb +0 -88
  38. data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec.rb +0 -52
  39. data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1.yaml +0 -6
  40. data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_1.yaml +0 -2
  41. data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2/storage1_2_1.yaml +0 -2
  42. data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2.yaml +0 -4
  43. data/sub/eac_config/spec/rubocop_spec.rb +0 -3
  44. data/sub/eac_config/spec/spec_helper.rb +0 -4
  45. data/sub/eac_docker/Gemfile +0 -5
  46. data/sub/eac_docker/eac_docker.gemspec +0 -19
  47. data/sub/eac_docker/lib/eac_docker/container.rb +0 -78
  48. data/sub/eac_docker/lib/eac_docker/debug.rb +0 -15
  49. data/sub/eac_docker/lib/eac_docker/executables.rb +0 -18
  50. data/sub/eac_docker/lib/eac_docker/images/base.rb +0 -14
  51. data/sub/eac_docker/lib/eac_docker/images/coded.rb +0 -43
  52. data/sub/eac_docker/lib/eac_docker/images/named.rb +0 -30
  53. data/sub/eac_docker/lib/eac_docker/images/templatized.rb +0 -41
  54. data/sub/eac_docker/lib/eac_docker/images.rb +0 -9
  55. data/sub/eac_docker/lib/eac_docker/registry.rb +0 -17
  56. data/sub/eac_docker/lib/eac_docker/rspec/setup.rb +0 -17
  57. data/sub/eac_docker/lib/eac_docker/rspec.rb +0 -9
  58. data/sub/eac_docker/lib/eac_docker/version.rb +0 -5
  59. data/sub/eac_docker/lib/eac_docker.rb +0 -7
  60. data/sub/eac_docker/spec/lib/eac_docker/executables_spec.rb +0 -9
  61. data/sub/eac_docker/spec/lib/eac_docker/images/coded_spec.rb +0 -12
  62. data/sub/eac_docker/spec/lib/eac_docker/images/coded_spec_files/image1/Dockerfile +0 -1
  63. data/sub/eac_docker/spec/lib/eac_docker/images/templatized_spec.rb +0 -18
  64. data/sub/eac_docker/spec/lib/eac_docker/images/templatized_spec_files/stub_docker_image/Dockerfile +0 -1
  65. data/sub/eac_docker/spec/rubocop_spec.rb +0 -3
  66. data/sub/eac_docker/spec/spec_helper.rb +0 -4
@@ -1,88 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_config/paths_hash'
4
-
5
- RSpec.describe ::EacConfig::PathsHash do
6
- let(:source_hash) do
7
- {
8
- parent: {
9
- child1: {
10
- child1_1: 'v1_1',
11
- child1_2: 'v1_2'
12
- },
13
- child2: 'v2'
14
- }
15
- }
16
- end
17
- let(:instance) { described_class.new(source_hash) }
18
-
19
- describe '#[]' do
20
- {
21
- 'parent.child1.child1_1' => 'v1_1',
22
- 'parent.child1.child1_2' => 'v1_2',
23
- 'parent.child2' => 'v2',
24
- 'no_exist' => nil,
25
- 'parent.child1' => {
26
- child1_1: 'v1_1',
27
- child1_2: 'v1_2'
28
- }
29
- }.each do |entry_key, expected_value|
30
- it { expect(instance[entry_key]).to eq(expected_value) }
31
- end
32
-
33
- ['.only_suffix', '', '.', 'only_prefx.', 'empty..part'].each do |entry_key|
34
- it "invalid entry key \"#{entry_key}\" raises EntryKeyError" do
35
- expect { instance[entry_key] }.to raise_error(::EacConfig::PathsHash::EntryKeyError)
36
- end
37
- end
38
- end
39
-
40
- describe '#[]=' do
41
- let(:source_hash) { {} }
42
-
43
- before do
44
- instance['a.b.c'] = '123'
45
- end
46
-
47
- it { expect(instance.to_h).to eq(a: { b: { c: '123' } }) }
48
- end
49
-
50
- describe '#fetch' do
51
- {
52
- 'parent.child1.child1_1' => 'v1_1',
53
- 'parent.child1.child1_2' => 'v1_2',
54
- 'parent.child1.child1_2.no_exist' => ::EacConfig::PathsHash::EntryKeyError,
55
- 'parent.child1.child1_3' => ::EacConfig::PathsHash::EntryKeyError,
56
- 'parent.child2' => 'v2',
57
- 'no_exist' => ::EacConfig::PathsHash::EntryKeyError,
58
- 'parent.child1' => {
59
- child1_1: 'v1_1',
60
- child1_2: 'v1_2'
61
- }
62
- }.each do |entry_key, expected_value|
63
- if expected_value.is_a?(::Class) && expected_value < ::Exception
64
- it "raise error #{expected_value}" do
65
- expect { instance.fetch(entry_key) }.to raise_error(expected_value)
66
- end
67
- else
68
- it "\#fetch return \"#{expected_value}\"" do
69
- expect(instance.fetch(entry_key)).to eq(expected_value)
70
- end
71
- end
72
- end
73
- end
74
-
75
- describe '#key?' do
76
- {
77
- 'parent.child1.child1_1' => true,
78
- 'parent.child1.child1_2' => true,
79
- 'parent.child1.child1_2.no_exist' => false,
80
- 'parent.child1.child1_3' => false,
81
- 'parent.child2' => true,
82
- 'no_exist' => false,
83
- 'parent.child1' => true
84
- }.each do |entry_key, expected_value|
85
- it { expect(instance.key?(entry_key)).to eq(expected_value) }
86
- end
87
- end
88
- end
@@ -1,52 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/struct'
4
- require 'eac_config/yaml_file_node'
5
-
6
- RSpec.describe ::EacConfig::YamlFileNode do
7
- storages = %w[1 1_1 1_2 1_2_1].map do |suffix|
8
- key = "storage#{suffix}"
9
- subpath = "#{key}.yaml"
10
- subpath = "storage1_2/#{subpath}" if suffix == '1_2_1'
11
- ::EacRubyUtils::Struct.new(suffix: suffix, key: key, subpath: subpath.to_pathname)
12
- end
13
-
14
- let(:fixtures_dir) { ::Pathname.new(__dir__).join('yaml_file_node_spec_files') }
15
- let(:target_dir) { temp_copy(fixtures_dir) }
16
- let(:yaml_file_path) do
17
- r = target_dir.join('storage1.yaml')
18
- r.write(r.read.gsub('%%STORAGE1_2_ABSOLUTE_PATH%%',
19
- target_dir.join('storage1_2.yaml').expand_path.to_path))
20
- r
21
- end
22
- let(:instance) { described_class.new(yaml_file_path) }
23
-
24
- context 'with common entry' do
25
- let(:entry) { instance.entry('common') }
26
-
27
- it { expect(entry.value).to eq('AAA') }
28
- it { expect(entry.found_node).to eq(instance) }
29
- it { expect(entry).to be_found }
30
- end
31
-
32
- storages.each do |storage|
33
- context "with entry in loaded path \"#{storage.subpath}\"" do
34
- let(:entry) { instance.entry(storage.key) }
35
- let(:storage_node) { described_class.new(target_dir.join(storage.subpath)) }
36
-
37
- it { expect(entry).to be_a(::EacConfig::Entry) }
38
- it { expect(entry).to be_found }
39
- it { expect(entry.value).to eq(storage.key) }
40
- it { expect(entry.found_node.url).to eq(storage_node.url) }
41
- end
42
- end
43
-
44
- context 'with not existing entry' do
45
- let(:entry) { instance.entry('no_exist') }
46
-
47
- it { expect(entry).to be_a(::EacConfig::Entry) }
48
- it { expect(entry.value).to eq(nil) }
49
- it { expect(entry.found_node).to eq(nil) }
50
- it { expect(entry).not_to be_found }
51
- end
52
- end
@@ -1,6 +0,0 @@
1
- ---
2
- common: AAA
3
- load_path:
4
- - storage1_1.yaml
5
- - %%STORAGE1_2_ABSOLUTE_PATH%%
6
- storage1: storage1
@@ -1,2 +0,0 @@
1
- ---
2
- storage1_1: storage1_1
@@ -1,4 +0,0 @@
1
- ---
2
- load_path:
3
- - ./storage1_2/storage1_2_1.yaml
4
- storage1_2: storage1_2
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ::EacRubyUtils::Rspec.default_setup.describe_rubocop
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/rspec/default_setup'
4
- ::EacRubyUtils::Rspec.default_setup_create(::File.expand_path('..', __dir__))
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- gemspec
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- $LOAD_PATH.push File.expand_path('lib', __dir__)
4
-
5
- require 'eac_docker/version'
6
-
7
- Gem::Specification.new do |s|
8
- s.name = 'eac_docker'
9
- s.version = EacDocker::VERSION
10
- s.authors = ['Put here the authors']
11
- s.summary = 'Put here de description.'
12
-
13
- s.files = Dir['{lib}/**/*']
14
-
15
- s.add_dependency 'eac_ruby_utils', '~> 0.74'
16
- s.add_dependency 'eac_templates', '~> 0.1'
17
-
18
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.3', '>= 0.3.3'
19
- end
@@ -1,78 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module EacDocker
6
- class Container
7
- enable_immutable
8
- immutable_accessor :interactive, :temporary, :tty, type: :boolean
9
- immutable_accessor :env, type: :hash
10
- immutable_accessor :capability, :command_arg, :volume, type: :array
11
- attr_reader :id
12
- common_constructor :image
13
-
14
- def immutable_constructor_args
15
- [image]
16
- end
17
-
18
- alias immutable_volume volume
19
-
20
- def hostname
21
- ::EacDocker::Executables.docker.command(
22
- 'inspect', '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}',
23
- id
24
- ).execute!.strip
25
- end
26
-
27
- def on_detached
28
- command = ::EacDocker::Executables.docker.command(*(%w[run --detach] + run_command_args))
29
- self.id = command.execute!.strip
30
- begin
31
- yield(self)
32
- ensure
33
- stop
34
- end
35
- end
36
-
37
- def volume(left_part, right_part = null)
38
- immutable_volume(right_part.if_present(left_part) { |v| "#{left_part}:#{v}" })
39
- end
40
-
41
- def run_command
42
- ::EacDocker::Executables.docker.command('run', *run_command_args)
43
- end
44
-
45
- def run_command_args
46
- run_command_boolean_args + run_command_capabilities_args + run_command_envs_args +
47
- run_command_volumes_args + [image.provide.id] + command_args
48
- end
49
-
50
- def stop
51
- ::EacDocker::Executables.docker.command('stop', id).execute!
52
- end
53
-
54
- private
55
-
56
- attr_writer :id
57
-
58
- def run_command_boolean_args
59
- r = []
60
- r << '--interactive' if interactive?
61
- r << '--tty' if tty?
62
- r << '--rm' if temporary?
63
- r
64
- end
65
-
66
- def run_command_capabilities_args
67
- capabilities.flat_map { |capability| ['--cap-add', capability] }
68
- end
69
-
70
- def run_command_volumes_args
71
- volumes.flat_map { |volume| ['--volume', volume] }
72
- end
73
-
74
- def run_command_envs_args
75
- envs.flat_map { |name, value| ['--env', "#{name}=#{value}"] }
76
- end
77
- end
78
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/boolean'
4
-
5
- module EacDocker
6
- module Debug
7
- class << self
8
- ENABLE_ENVVAR = 'EAC_DOCKER_DEBUG'
9
-
10
- def enabled?
11
- ::EacRubyUtils::Boolean.parse(ENV[ENABLE_ENVVAR])
12
- end
13
- end
14
- end
15
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
- require 'eac_ruby_utils/envs'
5
-
6
- module EacDocker
7
- module Executables
8
- class << self
9
- def env
10
- ::EacRubyUtils::Envs.local
11
- end
12
-
13
- def docker
14
- @docker ||= env.executable('docker', '--version')
15
- end
16
- end
17
- end
18
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
- require 'eac_docker/container'
5
-
6
- module EacDocker
7
- module Images
8
- class Base
9
- def container
10
- ::EacDocker::Container.new(self)
11
- end
12
- end
13
- end
14
- end
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_docker/debug'
4
- require 'eac_docker/executables'
5
- require 'eac_docker/images/base'
6
- require 'eac_ruby_utils/core_ext'
7
-
8
- module EacDocker
9
- module Images
10
- class Coded < ::EacDocker::Images::Base
11
- enable_simple_cache
12
- enable_immutable
13
- immutable_accessor :tag
14
- common_constructor :path do
15
- self.path = path.to_pathname
16
- end
17
-
18
- def immutable_constructor_args
19
- [path]
20
- end
21
-
22
- def provide
23
- id
24
- self
25
- end
26
-
27
- private
28
-
29
- def id_uncached
30
- if ::EacDocker::Debug.enabled?
31
- ::EacDocker::Executables.docker.command(*build_args.excluding('--quiet')).system!
32
- end
33
- ::EacDocker::Executables.docker.command(*build_args).execute!.strip
34
- end
35
-
36
- def build_args
37
- args = %w[build --quiet]
38
- args += ['--tag', tag] if tag.present?
39
- args + [path.to_path]
40
- end
41
- end
42
- end
43
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_docker/executables'
4
- require 'eac_docker/images/base'
5
- require 'eac_ruby_utils/core_ext'
6
-
7
- module EacDocker
8
- module Images
9
- class Named < ::EacDocker::Images::Base
10
- common_constructor :source_tag
11
-
12
- def id
13
- source_tag
14
- end
15
-
16
- def provide
17
- provide_command.execute!
18
- self
19
- end
20
-
21
- def provide_command
22
- ::EacDocker::Executables.docker.command(*docker_provide_args)
23
- end
24
-
25
- def docker_provide_args
26
- ['pull', source_tag]
27
- end
28
- end
29
- end
30
- end
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_docker/images/base'
4
- require 'eac_docker/images/coded'
5
- require 'eac_ruby_utils/core_ext'
6
- require 'eac_ruby_utils/fs/temp'
7
- require 'eac_templates/patches/object/template'
8
-
9
- module EacDocker
10
- module Images
11
- class Templatized < ::EacDocker::Images::Base
12
- enable_immutable
13
- immutable_accessor :tag
14
- attr_reader :provide_dir
15
-
16
- def id
17
- tag
18
- end
19
-
20
- def provide
21
- ::EacRubyUtils::Fs::Temp.on_directory do |provide_dir|
22
- begin
23
- self.provide_dir = provide_dir
24
- template.apply(self, provide_dir)
25
- coded_image(provide_dir).tag(tag).provide
26
- ensure
27
- self.provide_dir = nil
28
- end
29
- end
30
- end
31
-
32
- def coded_image(provide_dir)
33
- ::EacDocker::Images::Coded.new(provide_dir)
34
- end
35
-
36
- private
37
-
38
- attr_writer :provide_dir
39
- end
40
- end
41
- end
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module EacDocker
6
- module Images
7
- require_sub __FILE__
8
- end
9
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module EacDocker
6
- class Registry
7
- common_constructor :name
8
-
9
- def to_s
10
- name
11
- end
12
-
13
- def sub(suffix)
14
- self.class.new("#{name}#{suffix}")
15
- end
16
- end
17
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_docker/executables'
4
-
5
- module EacDocker
6
- module Rspec
7
- module Setup
8
- def self.extended(obj)
9
- obj.setup_conditional_docker_executable
10
- end
11
-
12
- def setup_conditional_docker_executable
13
- conditional(:docker) { ::EacDocker::Executables.docker.validate }
14
- end
15
- end
16
- end
17
- end
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module EacDocker
6
- module Rspec
7
- require_sub __FILE__
8
- end
9
- end
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module EacDocker
4
- VERSION = '0.4.1'
5
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module EacDocker
6
- require_sub __FILE__
7
- end
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_docker/executables'
4
-
5
- RSpec.describe(::EacDocker::Executables, docker: true) do
6
- it 'output version' do
7
- expect(described_class.docker.command('--version').execute!).to be_present
8
- end
9
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_docker/images/coded'
4
-
5
- RSpec.describe(::EacDocker::Images::Coded, docker: true) do
6
- let(:fixtures_dir) { ::Pathname.new('coded_spec_files').expand_path(__dir__) }
7
- let(:instance) { described_class.new(fixtures_dir / 'image1') }
8
-
9
- describe '#provide' do
10
- it { expect { instance.provide }.not_to raise_error }
11
- end
12
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_docker/images/templatized'
4
- require 'eac_templates/searcher'
5
-
6
- RSpec.describe(::EacDocker::Images::Templatized, docker: true) do
7
- let(:fixtures_dir) { ::Pathname.new('templatized_spec_files').expand_path(__dir__) }
8
- let(:instance) { StubDockerImage.new }
9
-
10
- before do
11
- ::EacTemplates::Searcher.default.included_paths << fixtures_dir
12
- stub_const('StubDockerImage', Class.new(described_class))
13
- end
14
-
15
- describe '#provide' do
16
- it { expect { instance.provide }.not_to raise_error }
17
- end
18
- end
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ::EacRubyUtils::Rspec.default_setup.describe_rubocop
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/rspec/default_setup'
4
- ::EacRubyUtils::Rspec.default_setup_create(::File.expand_path('..', __dir__))