eac_tools 0.7.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +43 -31
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm/avm.gemspec +1 -0
- data/sub/avm/lib/avm/application_stereotypes/base/by_gem.rb +17 -0
- data/sub/avm/lib/avm/application_stereotypes/base/detection.rb +34 -0
- data/sub/avm/lib/avm/application_stereotypes/base.rb +21 -0
- data/sub/avm/lib/avm/application_stereotypes.rb +9 -0
- data/sub/avm/lib/avm/{instances/application.rb → applications/base.rb} +5 -6
- data/sub/avm/lib/avm/applications.rb +9 -0
- data/sub/avm/lib/avm/docker/image.rb +12 -2
- data/sub/avm/lib/avm/instances/base.rb +7 -2
- data/sub/avm/lib/avm/instances.rb +1 -1
- data/sub/avm/lib/avm/registry/application_stereotypes/build_available.rb +46 -0
- data/sub/avm/lib/avm/registry/application_stereotypes/stereotype_builder.rb +30 -0
- data/sub/avm/lib/avm/registry/application_stereotypes.rb +36 -0
- data/sub/avm/lib/avm/registry/{base.rb → from_gems.rb} +13 -4
- data/sub/avm/lib/avm/registry/instances.rb +16 -0
- data/sub/avm/lib/avm/registry/runners.rb +10 -0
- data/sub/avm/lib/avm/registry/scms.rb +10 -0
- data/sub/avm/lib/avm/registry/sources.rb +10 -0
- data/sub/avm/lib/avm/registry/with_path/cache.rb +31 -0
- data/sub/avm/lib/avm/registry/with_path.rb +33 -7
- data/sub/avm/lib/avm/registry.rb +3 -7
- data/sub/avm/lib/avm/rspec/shared_examples/not_in_avm_registry.rb +1 -1
- data/sub/avm/lib/avm/sources/base/configuration.rb +23 -2
- data/sub/avm/lib/avm/sources/base/instance.rb +2 -2
- data/sub/avm/lib/avm/sources/base/locale.rb +1 -1
- data/sub/avm/lib/avm/sources/base/parent.rb +8 -11
- data/sub/avm/lib/avm/sources/base/subs_paths.rb +1 -1
- data/sub/avm/lib/avm/sources/base/testing.rb +4 -4
- data/sub/avm/lib/avm/sources/base.rb +4 -0
- data/sub/avm/lib/avm/sources/tests/builder.rb +5 -10
- data/sub/avm/lib/avm/version.rb +1 -1
- data/sub/avm/lib/avm/with_application_stereotype.rb +23 -0
- data/sub/avm/lib/avm/with_dynamic_runners.rb +42 -0
- data/sub/{avm-tools/spec/lib/avm/instances/application_spec.rb → avm/spec/lib/avm/applications/base_spec.rb} +3 -3
- data/sub/{avm-tools/spec/lib/avm/instances/application_spec_fixture.yml → avm/spec/lib/avm/applications/base_spec_fixture.yml} +0 -0
- data/sub/{avm-tools → avm}/spec/lib/avm/instances/base_spec.rb +0 -0
- data/sub/{avm-tools → avm}/spec/lib/avm/instances/base_spec_configs_storage.yml +0 -0
- data/sub/avm-eac_generic_base0/avm-eac_generic_base0.gemspec +2 -2
- data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/sources/docker/runner.rb +61 -0
- data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/sources/docker.rb +13 -0
- data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/version.rb +1 -1
- data/sub/avm-eac_rails_base0/Gemfile +3 -0
- data/sub/avm-eac_redmine_base0/avm-eac_redmine_base0.gemspec +1 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources/runners/docker.rb +19 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/version.rb +1 -1
- data/sub/avm-eac_redmine_plugin_base0/avm-eac_redmine_plugin_base0.gemspec +1 -1
- data/sub/avm-eac_redmine_plugin_base0/lib/avm/eac_redmine_plugin_base0/sources/base.rb +15 -4
- data/sub/avm-eac_redmine_plugin_base0/lib/avm/eac_redmine_plugin_base0/version.rb +1 -1
- data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +1 -1
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base/bundler.rb +1 -1
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base/rake.rb +14 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
- data/sub/avm-tools/Gemfile +3 -0
- data/sub/avm-tools/avm-tools.gemspec +1 -1
- data/sub/avm-tools/lib/avm/tools/runner/app_src/info.rb +19 -0
- data/sub/avm-tools/lib/avm/tools/runner/application_stereotypes/list.rb +31 -0
- data/sub/avm-tools/lib/avm/tools/runner/application_stereotypes.rb +16 -0
- data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
- data/sub/eac_cli/Gemfile +3 -0
- data/sub/eac_cli/lib/eac_cli/version.rb +1 -1
- data/sub/eac_config/Gemfile +8 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/eac_config.gemspec +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/entry.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/entry_path.rb +5 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/envvars_node/entry.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/envvars_node.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/load_nodes_search.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/load_path.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/node.rb +6 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/node_entry.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/node_uri.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/old_configs/base.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/old_configs/file.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/old_configs.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/paths_hash/entry_key_error.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/paths_hash/node.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/paths_hash/path_search.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/paths_hash.rb +0 -0
- data/sub/eac_config/lib/eac_config/prefixed_path_node/entry.rb +25 -0
- data/sub/eac_config/lib/eac_config/prefixed_path_node.rb +19 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/rspec/setup.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/rspec.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/version.rb +1 -1
- data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/yaml_file_node/entry.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config/yaml_file_node.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/lib/eac_config.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/entry_path_spec.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/envvars_node/entry_spec.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/envvars_node_spec.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/old_configs_spec.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/paths_hash_spec.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/yaml_file_node_spec.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/yaml_file_node_spec_files/storage1.yaml +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/yaml_file_node_spec_files/storage1_1.yaml +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2/storage1_2_1.yaml +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2.yaml +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/spec/rubocop_spec.rb +0 -0
- data/sub/{avm-tools/sub/eac_config → eac_config}/spec/spec_helper.rb +0 -0
- data/sub/eac_docker/Gemfile +8 -0
- data/sub/{avm-tools/sub/eac_docker → eac_docker}/eac_docker.gemspec +3 -3
- data/sub/{avm-tools/sub/eac_docker → eac_docker}/lib/eac_docker/container.rb +4 -3
- data/sub/{avm-tools/sub/eac_docker → eac_docker}/lib/eac_docker/debug.rb +0 -0
- data/sub/{avm-tools/sub/eac_docker → eac_docker}/lib/eac_docker/executables.rb +0 -0
- data/sub/{avm-tools/sub/eac_docker → eac_docker}/lib/eac_docker/images/base.rb +0 -0
- data/sub/{avm-tools/sub/eac_docker → eac_docker}/lib/eac_docker/images/coded.rb +0 -0
- data/sub/{avm-tools/sub/eac_docker → eac_docker}/lib/eac_docker/images/named.rb +0 -0
- data/sub/{avm-tools/sub/eac_docker → eac_docker}/lib/eac_docker/images/templatized.rb +0 -0
- data/sub/{avm-tools/sub/eac_docker → eac_docker}/lib/eac_docker/images.rb +0 -0
- data/sub/{avm-tools/sub/eac_docker → eac_docker}/lib/eac_docker/registry.rb +0 -0
- data/sub/{avm-tools/sub/eac_docker → eac_docker}/lib/eac_docker/rspec/setup.rb +0 -0
- data/sub/{avm-tools/sub/eac_docker → eac_docker}/lib/eac_docker/rspec.rb +0 -0
- data/sub/{avm-tools/sub/eac_docker → eac_docker}/lib/eac_docker/version.rb +1 -1
- data/sub/{avm-tools/sub/eac_docker → eac_docker}/lib/eac_docker.rb +0 -0
- data/sub/{avm-tools/sub/eac_docker → eac_docker}/spec/lib/eac_docker/executables_spec.rb +0 -0
- data/sub/{avm-tools/sub/eac_docker → eac_docker}/spec/lib/eac_docker/images/coded_spec.rb +0 -0
- data/sub/{avm-tools/sub/eac_docker → eac_docker}/spec/lib/eac_docker/images/coded_spec_files/image1/Dockerfile +0 -0
- data/sub/{avm-tools/sub/eac_docker → eac_docker}/spec/lib/eac_docker/images/templatized_spec.rb +0 -0
- data/sub/{avm-tools/sub/eac_docker → eac_docker}/spec/lib/eac_docker/images/templatized_spec_files/stub_docker_image/Dockerfile +0 -0
- data/sub/{avm-tools/sub/eac_docker → eac_docker}/spec/rubocop_spec.rb +0 -0
- data/sub/{avm-tools/sub/eac_docker → eac_docker}/spec/spec_helper.rb +0 -0
- data/sub/eac_fs/Gemfile +3 -0
- data/sub/eac_fs/lib/eac_fs/version.rb +1 -1
- data/sub/eac_ruby_base0/Gemfile +3 -0
- data/sub/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
- data/sub/eac_ruby_utils/Gemfile +2 -10
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/immutable/array_accessor.rb +22 -5
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/immutable_spec.rb +34 -0
- metadata +101 -87
- data/sub/avm/lib/avm/sources/base/runners.rb +0 -47
- data/sub/avm-tools/Gemfile.lock +0 -296
- data/sub/avm-tools/lib/avm/tools/runner/eac_redmine_base0/dev_docker.rb +0 -17
- data/sub/avm-tools/sub/eac_config/Gemfile +0 -5
- data/sub/avm-tools/sub/eac_docker/Gemfile +0 -5
@@ -1,22 +1,48 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/registry/
|
3
|
+
require 'avm/registry/from_gems'
|
4
4
|
require 'eac_ruby_utils/core_ext'
|
5
5
|
|
6
6
|
module Avm
|
7
7
|
module Registry
|
8
|
-
class WithPath < ::Avm::Registry::
|
8
|
+
class WithPath < ::Avm::Registry::FromGems
|
9
|
+
require_sub __FILE__
|
10
|
+
|
11
|
+
# @return [Object, nil]
|
12
|
+
def class_detect(klass, detect_args)
|
13
|
+
r = klass.new(*detect_args)
|
14
|
+
r.valid? ? r : nil
|
15
|
+
end
|
16
|
+
|
9
17
|
def detect_by_path(path)
|
10
18
|
detect_by_path_optional(path) || raise_not_found(path)
|
11
19
|
end
|
12
20
|
|
13
21
|
def detect_by_path_optional(path)
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
22
|
+
on_cache do
|
23
|
+
cache.detect_optional(path)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
attr_accessor :cache
|
30
|
+
|
31
|
+
def on_cache(&block)
|
32
|
+
cache.present? ? on_cache_with_cache(&block) : on_cache_with_no_cache(&block)
|
33
|
+
end
|
34
|
+
|
35
|
+
def on_cache_with_cache(&block)
|
36
|
+
block.call
|
37
|
+
end
|
38
|
+
|
39
|
+
def on_cache_with_no_cache(&block)
|
40
|
+
self.cache = ::Avm::Registry::WithPath::Cache.new(self)
|
41
|
+
begin
|
42
|
+
block.call
|
43
|
+
ensure
|
44
|
+
self.cache = nil
|
18
45
|
end
|
19
|
-
nil
|
20
46
|
end
|
21
47
|
end
|
22
48
|
end
|
data/sub/avm/lib/avm/registry.rb
CHANGED
@@ -7,14 +7,14 @@ module Avm
|
|
7
7
|
module Registry
|
8
8
|
require_sub __FILE__
|
9
9
|
enable_listable
|
10
|
-
lists.add_symbol :category, :
|
10
|
+
lists.add_symbol :category, :application_stereotypes, :instances, :runners, :scms, :sources
|
11
11
|
|
12
12
|
WITH_PATH = [CATEGORY_SCMS, CATEGORY_SOURCES].freeze
|
13
13
|
|
14
14
|
class << self
|
15
15
|
enable_simple_cache
|
16
16
|
|
17
|
-
# @return [Array<Avm::Registry::
|
17
|
+
# @return [Array<Avm::Registry::FromGems>]
|
18
18
|
def registries
|
19
19
|
lists.category.values.map { |c| send(c) }
|
20
20
|
end
|
@@ -28,11 +28,7 @@ module Avm
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def registry_class(category)
|
31
|
-
|
32
|
-
::Avm::Registry::WithPath
|
33
|
-
else
|
34
|
-
::Avm::Registry::Base
|
35
|
-
end
|
31
|
+
::Avm::Registry.const_get(category.to_s.camelize)
|
36
32
|
end
|
37
33
|
end
|
38
34
|
end
|
@@ -7,7 +7,7 @@ require 'avm/registry'
|
|
7
7
|
.each do |registry|
|
8
8
|
context "when registry is #{registry}" do
|
9
9
|
it 'is not in the avm registry' do
|
10
|
-
expect(registry.
|
10
|
+
expect(registry.available).not_to include(described_class)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -9,8 +9,19 @@ module Avm
|
|
9
9
|
module Sources
|
10
10
|
class Base
|
11
11
|
module Configuration
|
12
|
+
PARENT_CONFIGURATION_SUFFIX = %w[subs at].freeze
|
12
13
|
CONFIGURATION_FILENAMES = %w[.avm.yml .avm.yaml].freeze
|
13
14
|
|
15
|
+
# @return [EacConfig::NodeEntry]
|
16
|
+
def configuration_entry(*entry_args)
|
17
|
+
parent_configuration.if_present do |v|
|
18
|
+
parent_entry = v.entry(*entry_args)
|
19
|
+
return parent_entry if parent_entry.found?
|
20
|
+
end
|
21
|
+
|
22
|
+
configuration.entry(*entry_args)
|
23
|
+
end
|
24
|
+
|
14
25
|
# @return [EacRubyUtils::Envs::Command, nil]
|
15
26
|
def configuration_value_to_env_command(value)
|
16
27
|
configuration_value_to_shell_words(value).if_present { |v| env.command(v).chdir(path) }
|
@@ -25,13 +36,13 @@ module Avm
|
|
25
36
|
|
26
37
|
# @return [Array<String>, nil]
|
27
38
|
def read_configuration_as_shell_words(key)
|
28
|
-
configuration_value_to_shell_words(
|
39
|
+
configuration_value_to_shell_words(configuration_entry(key).value)
|
29
40
|
end
|
30
41
|
|
31
42
|
# Utility to read a configuration as a [EacRubyUtils::Envs::Command].
|
32
43
|
# @return [EacRubyUtils::Envs::Command]
|
33
44
|
def read_configuration_as_env_command(key)
|
34
|
-
configuration_value_to_env_command(
|
45
|
+
configuration_value_to_env_command(configuration_entry(key).value)
|
35
46
|
end
|
36
47
|
|
37
48
|
private
|
@@ -44,6 +55,16 @@ module Avm
|
|
44
55
|
configuration_with_filename(CONFIGURATION_FILENAMES.first, false)
|
45
56
|
end
|
46
57
|
|
58
|
+
# @return [String]
|
59
|
+
def parent_configuration_prefix
|
60
|
+
PARENT_CONFIGURATION_SUFFIX + [relative_path]
|
61
|
+
end
|
62
|
+
|
63
|
+
# @return [EacConfig::PrefixedPathNode]
|
64
|
+
def parent_configuration_uncached
|
65
|
+
parent.if_present { |v| v.configuration.with_prefix(parent_configuration_prefix) }
|
66
|
+
end
|
67
|
+
|
47
68
|
# @return [EacConfig::YamlFileNode, nil]
|
48
69
|
def configuration_with_filename(filename, needs_exist)
|
49
70
|
file_path = path.join(filename)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/
|
3
|
+
require 'avm/applications/base'
|
4
4
|
require 'avm/instances/base'
|
5
5
|
|
6
6
|
module Avm
|
@@ -16,7 +16,7 @@ module Avm
|
|
16
16
|
private
|
17
17
|
|
18
18
|
def application_uncached
|
19
|
-
::Avm::
|
19
|
+
::Avm::Applications::Base.new(path.basename)
|
20
20
|
end
|
21
21
|
|
22
22
|
def instance_uncached
|
@@ -6,11 +6,6 @@ module Avm
|
|
6
6
|
module Sources
|
7
7
|
class Base
|
8
8
|
module Parent
|
9
|
-
# @return [Avm::Sources::Base]
|
10
|
-
def parent
|
11
|
-
parent_by_option || parent_by_search
|
12
|
-
end
|
13
|
-
|
14
9
|
# @return [Avm::Sources::Base]
|
15
10
|
def parent_by_option
|
16
11
|
options[OPTION_PARENT]
|
@@ -18,12 +13,14 @@ module Avm
|
|
18
13
|
|
19
14
|
# @return [Avm::Sources::Base]
|
20
15
|
def parent_by_search
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
16
|
+
::Avm::Registry.sources.detect_by_path_optional(path.parent)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
# @return [Avm::Sources::Base]
|
22
|
+
def parent_uncached
|
23
|
+
parent_by_option || parent_by_search
|
27
24
|
end
|
28
25
|
end
|
29
26
|
end
|
@@ -18,12 +18,12 @@ module Avm
|
|
18
18
|
|
19
19
|
# @return [Hash<String, EacRubyUtils::Envs::Command>, nil]
|
20
20
|
def configured_test_commands
|
21
|
-
configured_value_as_test_commands(
|
21
|
+
configured_value_as_test_commands(configuration_entry(TEST_COMMANDS_KEY).value)
|
22
22
|
end
|
23
23
|
|
24
24
|
# @return [Hash<String, EacRubyUtils::Envs::Command>, nil]
|
25
25
|
def configured_value_as_test_commands(value)
|
26
|
-
return nil if value.
|
26
|
+
return nil if value.nil?
|
27
27
|
|
28
28
|
[::EacRubyUtils::Envs::Command, ::Hash, ::Enumerable].each do |type|
|
29
29
|
next unless value.is_a?(type)
|
@@ -45,8 +45,8 @@ module Avm
|
|
45
45
|
# @return [Enumerable<EacRubyUtils::Envs::Command>]
|
46
46
|
def test_commands
|
47
47
|
configured_test_commands ||
|
48
|
-
configured_value_as_test_commands(configured_test_command)
|
49
|
-
|
48
|
+
configured_value_as_test_commands(configured_test_command) ||
|
49
|
+
default_test_commands
|
50
50
|
end
|
51
51
|
|
52
52
|
protected
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'avm/registry'
|
4
4
|
require 'avm/scms/null'
|
5
|
+
require 'avm/with_application_stereotype'
|
6
|
+
require 'avm/with_dynamic_runners'
|
5
7
|
require 'eac_git'
|
6
8
|
require 'eac_ruby_utils/core_ext'
|
7
9
|
|
@@ -9,6 +11,8 @@ module Avm
|
|
9
11
|
module Sources
|
10
12
|
class Base
|
11
13
|
require_sub __FILE__, include_modules: true
|
14
|
+
include ::Avm::WithApplicationStereotype
|
15
|
+
include ::Avm::WithDynamicRunners
|
12
16
|
compare_by :path
|
13
17
|
enable_abstract_methods
|
14
18
|
enable_simple_cache
|
@@ -35,7 +35,7 @@ module Avm
|
|
35
35
|
# @return [Array<Avm::Sources::Tests::Single>]
|
36
36
|
def available_units
|
37
37
|
@available_units ||= ([main_source] + main_source.subs)
|
38
|
-
.
|
38
|
+
.flat_map { |a_source| create_source_units(a_source) }
|
39
39
|
end
|
40
40
|
|
41
41
|
def available_units_from_main
|
@@ -62,20 +62,15 @@ module Avm
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
# @return [Avm::Sources::Tests::Single]
|
66
|
-
def create_unit(source)
|
67
|
-
::Avm::Sources::Tests::Single.new(self, source)
|
68
|
-
end
|
69
|
-
|
70
65
|
# @return [Array<Avm::Sources::Tests::Single>]
|
71
66
|
def create_units(sources)
|
72
67
|
sources.flat_map { |a_source| create_source_units(a_source) }
|
73
68
|
end
|
74
69
|
|
75
70
|
# @return [Avm::Sources::Tests::Single]
|
76
|
-
def
|
77
|
-
r = available_units.
|
78
|
-
return r if r
|
71
|
+
def create_units_by_id(source_id)
|
72
|
+
r = available_units.select { |unit| unit.source.relative_path.to_path == source_id.to_s }
|
73
|
+
return r if r.any?
|
79
74
|
|
80
75
|
raise ::ArgumentError, "Source not found with ID=#{source_id}" \
|
81
76
|
"(Available: #{available_units.map(&:id).join(', ')})"
|
@@ -83,7 +78,7 @@ module Avm
|
|
83
78
|
|
84
79
|
# @return [Array<Avm::Sources::Tests::Single>]
|
85
80
|
def select_units_from_ids
|
86
|
-
include_ids.
|
81
|
+
include_ids.flat_map { |source_id| create_units_by_id(source_id) }
|
87
82
|
end
|
88
83
|
|
89
84
|
# @return [Array<Avm::Sources::Tests::Single>]
|
data/sub/avm/lib/avm/version.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/runner_with/subcommands'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module WithApplicationStereotype
|
8
|
+
common_concern do
|
9
|
+
include ClassMethods
|
10
|
+
end
|
11
|
+
|
12
|
+
module ClassMethods
|
13
|
+
# @return [Module]
|
14
|
+
def stereotype_namespace_module
|
15
|
+
module_parent.module_parent
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def stereotype_namespace_module
|
20
|
+
self.class.stereotype_namespace_module
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/runner_with/subcommands'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module WithDynamicRunners
|
8
|
+
# @return [Hash<String, EacCli::Runner>]
|
9
|
+
def extra_available_subcommands
|
10
|
+
extra_available_subcommands_from_runners_module
|
11
|
+
end
|
12
|
+
|
13
|
+
# @return [Hash<String, EacCli::Runner>]
|
14
|
+
def extra_available_subcommands_from_runners_module
|
15
|
+
self.class.ancestors.reverse.inject({}) do |a, e|
|
16
|
+
a.merge(RunnersFromModule.new(e).result)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class RunnersFromModule
|
21
|
+
enable_simple_cache
|
22
|
+
common_constructor :the_module
|
23
|
+
|
24
|
+
# @return [Hash<String, EacCli::Runner>]
|
25
|
+
def result
|
26
|
+
return {} if runners_module.blank?
|
27
|
+
|
28
|
+
::EacCli::RunnerWith::Subcommands.subcommands_from_module(runners_module)
|
29
|
+
end
|
30
|
+
|
31
|
+
def runners_module_uncached
|
32
|
+
return nil if the_module.module_parent.blank?
|
33
|
+
|
34
|
+
begin
|
35
|
+
the_module.module_parent.const_get('Runners')
|
36
|
+
rescue ::NameError
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/
|
3
|
+
require 'avm/applications/base'
|
4
4
|
|
5
|
-
RSpec.describe ::Avm::
|
5
|
+
RSpec.describe ::Avm::Applications::Base do
|
6
6
|
let(:instance) { described_class.new('avm-tools') }
|
7
7
|
|
8
8
|
::EacRubyUtils::Rspec
|
9
9
|
.default_setup
|
10
|
-
.stub_eac_config_node(self, ::File.join(__dir__, '
|
10
|
+
.stub_eac_config_node(self, ::File.join(__dir__, 'base_spec_fixture.yml'))
|
11
11
|
|
12
12
|
describe '#id' do
|
13
13
|
it { expect(instance.id).to eq('avm-tools') }
|
File without changes
|
File without changes
|
File without changes
|
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib,locale}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'avm', '~> 0.
|
16
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
15
|
+
s.add_dependency 'avm', '~> 0.28'
|
16
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.96'
|
17
17
|
|
18
18
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
19
19
|
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacGenericBase0
|
7
|
+
module Sources
|
8
|
+
module Docker
|
9
|
+
class Runner
|
10
|
+
CONTAINER_SOURCE_PATH = '/app'
|
11
|
+
|
12
|
+
enable_abstract_methods
|
13
|
+
abstract_methods :docker_image
|
14
|
+
|
15
|
+
runner_with :help do
|
16
|
+
desc 'Run a Docker container with source mapped.'
|
17
|
+
arg_opt '-c', '--command-arg', 'Arguments for [COMMAND] [ARG...].', optional: true,
|
18
|
+
repeat: true
|
19
|
+
end
|
20
|
+
|
21
|
+
def run
|
22
|
+
start_banner
|
23
|
+
docker_container.run_command.system!
|
24
|
+
end
|
25
|
+
|
26
|
+
def start_banner
|
27
|
+
infov 'Image', docker_image
|
28
|
+
infov 'Command', ::Shellwords.join(command_args)
|
29
|
+
end
|
30
|
+
|
31
|
+
def bash_command_args
|
32
|
+
%w[/bin/bash]
|
33
|
+
end
|
34
|
+
|
35
|
+
def command_args
|
36
|
+
if parsed.command_arg.any?
|
37
|
+
parsed.command_arg
|
38
|
+
else
|
39
|
+
default_command_args
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def default_command_args
|
44
|
+
bash_command_args
|
45
|
+
end
|
46
|
+
|
47
|
+
def docker_container
|
48
|
+
docker_image.container
|
49
|
+
.volume(runner_context.call(:subject).path, CONTAINER_SOURCE_PATH)
|
50
|
+
.interactive(true).tty(true).command_args(command_args)
|
51
|
+
end
|
52
|
+
|
53
|
+
# @return [EacDocker::Images::Base]
|
54
|
+
def docker_image
|
55
|
+
raise_abstract_method __method__
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -12,6 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib,locale,template}/**/*']
|
14
14
|
|
15
|
+
s.add_dependency 'avm-eac_generic_base0', '~> 0.4'
|
15
16
|
s.add_dependency 'avm-eac_rails_base1', '~> 0.4', '>= 0.4.1'
|
16
17
|
s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.3'
|
17
18
|
s.add_dependency 'curb', '~> 0.9.11'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_generic_base0/sources/docker/runner'
|
4
|
+
require 'avm/eac_ubuntu_base0/docker_image'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module EacRedmineBase0
|
8
|
+
module Sources
|
9
|
+
module Runners
|
10
|
+
class Docker < ::Avm::EacGenericBase0::Sources::Docker::Runner
|
11
|
+
# @return [Avm::EacUbuntuBase0::DockerImage]
|
12
|
+
def docker_image
|
13
|
+
::Avm::EacUbuntuBase0::DockerImage.new
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'avm-eac_ruby_base1', '~> 0.
|
15
|
+
s.add_dependency 'avm-eac_ruby_base1', '~> 0.11'
|
16
16
|
s.add_dependency 'eac_ruby_utils', '~> 0.95', '>= 0.95.1'
|
17
17
|
|
18
18
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5', '>= 0.5.1'
|
@@ -8,6 +8,7 @@ module Avm
|
|
8
8
|
module Sources
|
9
9
|
class Base < ::Avm::EacRubyBase1::Sources::Base
|
10
10
|
DEFAULT_GEMFILE_PATH = 'SelfGemfile'
|
11
|
+
RUBOCOP_GEM_NAME = 'rubocop'
|
11
12
|
RUBOCOP_TEST_NAME = 'rubocop'
|
12
13
|
PARENT_RAKE_TASK_TEST_NAME = 'parent_rake_task'
|
13
14
|
INIT_SUBPATH = 'init.rb'
|
@@ -19,10 +20,10 @@ module Avm
|
|
19
20
|
|
20
21
|
# @return [Hash<String, EacRubyUtils::Envs::Command>]
|
21
22
|
def default_test_commands
|
22
|
-
{
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
r = {}
|
24
|
+
r[PARENT_RAKE_TASK_TEST_NAME] = parent_rake_test_command if parent_rake_test_command?
|
25
|
+
r[RUBOCOP_TEST_NAME] = rubocop_test_command if rubocop_test_command?
|
26
|
+
r
|
26
27
|
end
|
27
28
|
|
28
29
|
# @return [String]
|
@@ -35,6 +36,11 @@ module Avm
|
|
35
36
|
[gem_name, 'test'].map(&:variableize).join(':')
|
36
37
|
end
|
37
38
|
|
39
|
+
# @return [Boolean]
|
40
|
+
def parent_rake_test_command?
|
41
|
+
ruby_parent.rake_task?(parent_rake_test_task_name)
|
42
|
+
end
|
43
|
+
|
38
44
|
# @return [EacRubyUtils::Envs::Command]
|
39
45
|
def parent_rake_test_command
|
40
46
|
ruby_parent.rake(parent_rake_test_task_name).chdir_root.envvar('RAILS_ENV', 'test')
|
@@ -47,6 +53,11 @@ module Avm
|
|
47
53
|
.chdir_root
|
48
54
|
end
|
49
55
|
|
56
|
+
# @return [Boolean]
|
57
|
+
def rubocop_test_command?
|
58
|
+
gemfile_path.exist? && gemfile_lock_gem_version(RUBOCOP_GEM_NAME).present?
|
59
|
+
end
|
60
|
+
|
50
61
|
# @return [Boolean]
|
51
62
|
def valid?
|
52
63
|
init_path.exist?
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib,locale}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'avm', '~> 0.
|
15
|
+
s.add_dependency 'avm', '~> 0.26'
|
16
16
|
s.add_dependency 'avm-eac_generic_base0', '~> 0.2'
|
17
17
|
s.add_dependency 'eac_ruby_utils', '~> 0.95', '>= 0.95.1'
|
18
18
|
|
@@ -9,6 +9,9 @@ module Avm
|
|
9
9
|
class Base < ::Avm::EacGenericBase0::Sources::Base
|
10
10
|
module Rake
|
11
11
|
RAKEFILE_BASENAME = 'Rakefile'
|
12
|
+
RAKE_TASKS_LINE_PARSER = /\Arake\s+(\S+)\s+/.to_parser do |m|
|
13
|
+
m[1]
|
14
|
+
end
|
12
15
|
|
13
16
|
# @return [Avm::EacRubyBase1::Sources::Base::BundleCommand]
|
14
17
|
def rake(*args)
|
@@ -21,6 +24,17 @@ module Avm
|
|
21
24
|
def rakefile_path
|
22
25
|
path.join(RAKEFILE_BASENAME)
|
23
26
|
end
|
27
|
+
|
28
|
+
# @return [Boolean]
|
29
|
+
def rake_task?(task_name)
|
30
|
+
rake_tasks.include?(task_name)
|
31
|
+
end
|
32
|
+
|
33
|
+
# @return [Array<String>]
|
34
|
+
def rake_tasks
|
35
|
+
rake('--all', '--tasks').execute!.each_line
|
36
|
+
.map { |line| RAKE_TASKS_LINE_PARSER.parse!(line) }
|
37
|
+
end
|
24
38
|
end
|
25
39
|
end
|
26
40
|
end
|