avm-tools 0.121.1 → 0.123.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) 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 -60
  8. data/sub/avm-eac_rails_base0/Gemfile +0 -5
  9. data/sub/avm-eac_rails_base0/avm-eac_rails_base0.gemspec +0 -19
  10. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/apache_host.rb +0 -10
  11. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/apache_path.rb +0 -19
  12. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/deploy.rb +0 -53
  13. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/instance.rb +0 -11
  14. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/runners/base.rb +0 -26
  15. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/runners.rb +0 -11
  16. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/sources/base.rb +0 -27
  17. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/version.rb +0 -7
  18. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0.rb +0 -9
  19. data/sub/avm-eac_rails_base0/spec/lib/avm/eac_rails_base0/apache_host_spec.rb +0 -22
  20. data/sub/avm-eac_rails_base0/spec/lib/avm/eac_rails_base0/apache_host_spec_files/apache_host_spec_no_ssl_content.conf +0 -11
  21. data/sub/avm-eac_rails_base0/spec/lib/avm/eac_rails_base0/apache_path_spec.rb +0 -23
  22. data/sub/avm-eac_rails_base0/spec/lib/avm/eac_rails_base0/apache_path_spec_files/stub-app_0_apache_path.conf +0 -14
  23. data/sub/avm-eac_rails_base0/spec/rubocop_spec.rb +0 -3
  24. data/sub/avm-eac_rails_base0/spec/spec_helper.rb +0 -5
  25. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/apache_path/extra_content.conf +0 -5
  26. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/deploy/config/database.yml.template +0 -21
  27. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/deploy/config/envvars.d/email.yml.template +0 -11
  28. data/sub/eac_config/Gemfile +0 -5
  29. data/sub/eac_config/eac_config.gemspec +0 -19
  30. data/sub/eac_config/lib/eac_config/entry.rb +0 -53
  31. data/sub/eac_config/lib/eac_config/entry_path.rb +0 -41
  32. data/sub/eac_config/lib/eac_config/envvars_node/entry.rb +0 -54
  33. data/sub/eac_config/lib/eac_config/envvars_node.rb +0 -25
  34. data/sub/eac_config/lib/eac_config/load_nodes_search.rb +0 -39
  35. data/sub/eac_config/lib/eac_config/load_path.rb +0 -28
  36. data/sub/eac_config/lib/eac_config/node.rb +0 -67
  37. data/sub/eac_config/lib/eac_config/node_entry.rb +0 -22
  38. data/sub/eac_config/lib/eac_config/node_uri.rb +0 -38
  39. data/sub/eac_config/lib/eac_config/old_configs/base.rb +0 -43
  40. data/sub/eac_config/lib/eac_config/old_configs/file.rb +0 -47
  41. data/sub/eac_config/lib/eac_config/old_configs.rb +0 -75
  42. data/sub/eac_config/lib/eac_config/paths_hash/entry_key_error.rb +0 -8
  43. data/sub/eac_config/lib/eac_config/paths_hash/node.rb +0 -67
  44. data/sub/eac_config/lib/eac_config/paths_hash/path_search.rb +0 -39
  45. data/sub/eac_config/lib/eac_config/paths_hash.rb +0 -63
  46. data/sub/eac_config/lib/eac_config/rspec/setup.rb +0 -65
  47. data/sub/eac_config/lib/eac_config/rspec.rb +0 -9
  48. data/sub/eac_config/lib/eac_config/version.rb +0 -5
  49. data/sub/eac_config/lib/eac_config/yaml_file_node/entry.rb +0 -36
  50. data/sub/eac_config/lib/eac_config/yaml_file_node.rb +0 -47
  51. data/sub/eac_config/lib/eac_config.rb +0 -7
  52. data/sub/eac_config/spec/lib/eac_config/entry_path_spec.rb +0 -30
  53. data/sub/eac_config/spec/lib/eac_config/envvars_node/entry_spec.rb +0 -14
  54. data/sub/eac_config/spec/lib/eac_config/envvars_node_spec.rb +0 -40
  55. data/sub/eac_config/spec/lib/eac_config/old_configs_spec.rb +0 -46
  56. data/sub/eac_config/spec/lib/eac_config/paths_hash_spec.rb +0 -88
  57. data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec.rb +0 -52
  58. data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1.yaml +0 -6
  59. data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_1.yaml +0 -2
  60. data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2/storage1_2_1.yaml +0 -2
  61. data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2.yaml +0 -4
  62. data/sub/eac_config/spec/rubocop_spec.rb +0 -3
  63. data/sub/eac_config/spec/spec_helper.rb +0 -4
@@ -1,65 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
- require 'eac_ruby_utils/fs/temp'
5
- require 'eac_config/envvars_node'
6
- require 'eac_config/node'
7
- require 'eac_config/yaml_file_node'
8
-
9
- module EacConfig
10
- module Rspec
11
- module Setup
12
- def self.extended(obj)
13
- obj.rspec_config.around do |example|
14
- obj.on_envvars_load_path_clean(example)
15
- end
16
- end
17
-
18
- def on_envvars_load_path_clean(example)
19
- old_value = envvars_load_path_entry.value
20
- begin
21
- envvars_load_path_entry.value = old_value = []
22
- example.run
23
- ensure
24
- envvars_load_path_entry.value = old_value
25
- end
26
- end
27
-
28
- def envvars_load_path_entry
29
- ::EacConfig::EnvvarsNode.new.load_path.entry
30
- end
31
-
32
- # Wraps a RSpec example in a EacConfig node using a alternative file.
33
- #
34
- # @param target_example [RSpec::Core::ExampleGroup] The example to wrap. If not provided,
35
- # it is applied to all examples.
36
- # @param target_file [Pathname] The file used by the EacConfig node. If not provided, a
37
- # temporary file is used.
38
- # @param node_builder [Proc] Should return the desired EacConfig node. If not provided, a
39
- # EacConfig::YamlFileNode is created.
40
- def stub_eac_config_node(target_example = nil, target_file = nil, &node_builder)
41
- parent_self = self
42
- (target_example || rspec_config).around do |example|
43
- parent_self.stub_eac_config_node_on_file(target_file) do |file|
44
- ::EacConfig::Node
45
- .context.on(parent_self.stub_eac_config_node_build(file, &node_builder)) do
46
- example.run
47
- end
48
- end
49
- end
50
- end
51
-
52
- def stub_eac_config_node_build(file, &node_builder)
53
- node_builder.present? ? node_builder.call(file) : ::EacConfig::YamlFileNode.new(file)
54
- end
55
-
56
- def stub_eac_config_node_on_file(target_file)
57
- if target_file
58
- yield(target_file.to_pathname)
59
- else
60
- ::EacRubyUtils::Fs::Temp.on_file { |file| yield(file) }
61
- end
62
- end
63
- end
64
- end
65
- end
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_exts'
4
-
5
- module EacConfig
6
- module Rspec
7
- require_sub __FILE__
8
- end
9
- end
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module EacConfig
4
- VERSION = '0.8.1'
5
- end
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_config/entry_path'
4
- require 'eac_config/node_entry'
5
- require 'eac_ruby_utils/core_ext'
6
-
7
- module EacConfig
8
- class YamlFileNode
9
- class Entry < ::EacConfig::NodeEntry
10
- enable_simple_cache
11
-
12
- def found?
13
- paths_hash.key?(to_paths_hash_key)
14
- end
15
-
16
- def value
17
- paths_hash[to_paths_hash_key]
18
- end
19
-
20
- def value=(a_value)
21
- node.persist_data(paths_hash.write(to_paths_hash_key, a_value).root.to_h)
22
- end
23
-
24
- private
25
-
26
- # @return [EacConfig::PathsHash]
27
- def paths_hash
28
- ::EacConfig::PathsHash.new(node.data)
29
- end
30
-
31
- def to_paths_hash_key
32
- path.parts.join('.')
33
- end
34
- end
35
- end
36
- end
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'addressable'
4
- require 'eac_config/node'
5
- require 'eac_ruby_utils/core_ext'
6
- require 'eac_ruby_utils/yaml'
7
-
8
- module EacConfig
9
- class YamlFileNode
10
- require_sub __FILE__
11
- include ::EacConfig::Node
12
- enable_simple_cache
13
-
14
- class << self
15
- def from_uri(uri)
16
- return new(uri.to_addressable.path) if uri.to_addressable.scheme == 'file'
17
- end
18
- end
19
-
20
- common_constructor :path do
21
- self.path = path.to_pathname
22
- end
23
-
24
- def persist_data(new_data)
25
- path.parent.mkpath
26
- ::EacRubyUtils::Yaml.dump_file(path, new_data)
27
- reset_cache(:data)
28
- end
29
-
30
- def url
31
- ::Addressable::URI.parse("file://#{path.expand_path}")
32
- end
33
-
34
- private
35
-
36
- def data_uncached
37
- r = nil
38
- if path.file?
39
- r = ::EacRubyUtils::Yaml.load_file(path)
40
- elsif path.exist?
41
- raise("\"#{path}\" is a not a file")
42
- end
43
-
44
- r.is_a?(::Hash) ? r : {}
45
- end
46
- end
47
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module EacConfig
6
- require_sub __FILE__
7
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_config/entry_path'
4
-
5
- RSpec.describe ::EacConfig::EntryPath do
6
- describe '#assert' do
7
- {
8
- ['a.b.c'] => %w[a b c],
9
- [['a', 1], 'b', []] => %w[a 1 b],
10
- ['a', 'b', ['c', 1.2], 'd', 'e.f'] => %w[a b c 1 2 d e f]
11
- }.each do |data|
12
- source = data[0]
13
- expected_parts = data[1]
14
-
15
- context "when source is #{source}" do
16
- let(:instance) { described_class.assert(source) }
17
-
18
- it { expect(instance.parts).to eq(expected_parts) }
19
- end
20
- end
21
-
22
- [['a..c'], ['a', ' ']].each do |source|
23
- context "when invalid source is #{source}" do
24
- it do
25
- expect { described_class.assert(source) }.to raise_error(::ArgumentError)
26
- end
27
- end
28
- end
29
- end
30
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_config/envvars_node/entry'
4
-
5
- RSpec.describe ::EacConfig::EnvvarsNode::Entry do
6
- describe '#entry_key_to_envvar_name' do
7
- {
8
- 'a.entry.value' => 'A_ENTRY_VALUE',
9
- 'appli-cation_0.var_one' => 'APPLICATION_0_VAR_ONE'
10
- }.each do |input, expected_result|
11
- it { expect(described_class.entry_path_to_envvar_name(input)).to eq(expected_result) }
12
- end
13
- end
14
- end
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_config/envvars_node'
4
-
5
- RSpec.describe ::EacConfig::EnvvarsNode do
6
- let(:instance) { described_class.new }
7
-
8
- before do
9
- ENV['COMMON'] = 'AAA'
10
- ENV['BLANK'] = ''
11
- ENV.delete('NO_EXIST')
12
- end
13
-
14
- context 'with common entry' do
15
- let(:entry) { instance.entry('common') }
16
-
17
- it { expect(entry).to be_a(::EacConfig::Entry) }
18
- it { expect(entry.value).to eq('AAA') }
19
- it { expect(entry.found_node).to eq(instance) }
20
- it { expect(entry).to be_found }
21
- end
22
-
23
- context 'with blank entry' do
24
- let(:entry) { instance.entry('blank') }
25
-
26
- it { expect(entry).to be_a(::EacConfig::Entry) }
27
- it { expect(entry.value).to eq('') }
28
- it { expect(entry.found_node).to eq(instance) }
29
- it { expect(entry).to be_found }
30
- end
31
-
32
- context 'with not existing entry' do
33
- let(:entry) { instance.entry('no.exist') }
34
-
35
- it { expect(entry).to be_a(::EacConfig::Entry) }
36
- it { expect(entry.value).to eq(nil) }
37
- it { expect(entry.found_node).to eq(nil) }
38
- it { expect(entry).not_to be_found }
39
- end
40
- end
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'tempfile'
4
- require 'eac_config/old_configs'
5
-
6
- RSpec.describe ::EacConfig::OldConfigs do
7
- let(:configs_key) { 'configsspec' }
8
- let(:storage_path) do
9
- file = ::Tempfile.new(configs_key)
10
- path = file.path
11
- file.close
12
- file.unlink
13
- path
14
- end
15
- let(:instance) { described_class.new(configs_key, storage_path: storage_path) }
16
-
17
- describe '#storage_path' do
18
- it { expect(instance.storage_path).to eq(storage_path) }
19
- end
20
-
21
- describe '#write' do
22
- let(:entry_key) { 'parent.child' }
23
-
24
- before do
25
- instance[entry_key] = 'value1'
26
- instance.save
27
- end
28
-
29
- it { expect(::YAML.load_file(storage_path)).to eq(parent: { child: 'value1' }) }
30
- end
31
-
32
- describe '#read' do
33
- let(:present_key) { 'a.present.key' }
34
- let(:blank_key) { 'a.blank.key' }
35
-
36
- before do
37
- instance[present_key] = 'A value'
38
- instance[blank_key] = ''
39
- instance.save
40
- instance.load
41
- end
42
-
43
- it { expect(instance[present_key]).to be_present }
44
- it { expect(instance[blank_key]).to be_present }
45
- end
46
- end
@@ -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__))