eac_tools 0.8.0 → 0.11.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 +25 -19
- data/lib/eac_tools/version.rb +1 -1
- 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/applications/base/stereotype.rb +31 -0
- data/sub/avm/lib/avm/applications/base.rb +45 -0
- 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 +52 -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 +2 -2
- data/sub/avm/lib/avm/registry/with_path.rb +8 -2
- 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/scms/base.rb +2 -0
- data/sub/avm/lib/avm/sources/base/instance.rb +2 -2
- data/sub/avm/lib/avm/sources/base.rb +4 -0
- 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_redmine_base0/avm-eac_redmine_base0.gemspec +2 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base.rb +14 -0
- data/sub/{avm-tools/lib/avm/tools/runner/eac_redmine_base0 → avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners}/docker.rb +3 -3
- data/sub/{avm-tools/lib/avm/tools/runner/eac_redmine_base0 → avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners}/project_rename.rb +3 -3
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners.rb +13 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/runners/base.rb +25 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources/runners/core_update.rb +1 -3
- 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-tools/avm-tools.gemspec +1 -2
- 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/runner/instance/info.rb +1 -0
- data/sub/avm-tools/lib/avm/tools/runner/instance.rb +6 -1
- data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
- 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_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 +62 -50
- data/sub/avm/lib/avm/instances/application.rb +0 -29
- data/sub/avm/lib/avm/sources/base/runners.rb +0 -47
- data/sub/avm-tools/Gemfile.lock +0 -291
- data/sub/avm-tools/lib/avm/tools/runner/eac_redmine_base0/dev_docker.rb +0 -17
- data/sub/avm-tools/lib/avm/tools/runner/eac_redmine_base0.rb +0 -15
- data/sub/avm-tools/sub/eac_docker/Gemfile +0 -5
@@ -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
|
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,8 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib,locale,template}/**/*']
|
14
14
|
|
15
|
+
s.add_dependency 'avm', '~> 0.29'
|
16
|
+
s.add_dependency 'avm-eac_generic_base0', '~> 0.4'
|
15
17
|
s.add_dependency 'avm-eac_rails_base1', '~> 0.4', '>= 0.4.1'
|
16
18
|
s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.3'
|
17
19
|
s.add_dependency 'curb', '~> 0.9.11'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/instances/base'
|
4
|
+
require 'avm/eac_redmine_base0/instances/runners'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module EacRedmineBase0
|
9
|
+
module Instances
|
10
|
+
class Base < ::Avm::Instances::Base
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -3,9 +3,9 @@
|
|
3
3
|
require 'avm/docker/runner'
|
4
4
|
|
5
5
|
module Avm
|
6
|
-
module
|
7
|
-
|
8
|
-
|
6
|
+
module EacRedmineBase0
|
7
|
+
module Instances
|
8
|
+
module Runners
|
9
9
|
class Docker < ::Avm::Docker::Runner
|
10
10
|
def use_default_registry?
|
11
11
|
false
|
@@ -4,9 +4,9 @@ require 'eac_cli/core_ext'
|
|
4
4
|
require 'avm/eac_rails_base1/runner/code_runner'
|
5
5
|
|
6
6
|
module Avm
|
7
|
-
module
|
8
|
-
|
9
|
-
|
7
|
+
module EacRedmineBase0
|
8
|
+
module Instances
|
9
|
+
module Runners
|
10
10
|
class ProjectRename
|
11
11
|
runner_with ::Avm::EacRailsBase1::RunnerWith::Bundle do
|
12
12
|
pos_arg :from
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_redmine_base0/instance'
|
4
|
+
require 'avm/eac_redmine_base0/deploy'
|
5
|
+
require 'avm/eac_redmine_base0/apache_host'
|
6
|
+
require 'avm/eac_rails_base1/runner'
|
7
|
+
require 'eac_ruby_utils/core_ext'
|
8
|
+
|
9
|
+
module Avm
|
10
|
+
module EacRedmineBase0
|
11
|
+
module Runners
|
12
|
+
class Base < ::Avm::EacRailsBase1::Runner
|
13
|
+
require_sub __FILE__
|
14
|
+
|
15
|
+
STEREOTYPE_NAME = 'EacRedmineBase0'
|
16
|
+
|
17
|
+
class << self
|
18
|
+
def stereotype_name
|
19
|
+
STEREOTYPE_NAME
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -1,10 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'avm/eac_rails_base1/sources/base'
|
3
4
|
require 'avm/eac_redmine_base0/core_update'
|
4
5
|
require 'eac_cli/core_ext'
|
5
|
-
require 'avm/eac_rails_base1/sources/base'
|
6
|
-
require 'avm/eac_redmine_base0/sources/runners'
|
7
|
-
require 'eac_ruby_utils/core_ext'
|
8
6
|
|
9
7
|
module Avm
|
10
8
|
module EacRedmineBase0
|
@@ -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
|
@@ -15,10 +15,9 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
16
16
|
|
17
17
|
s.add_dependency 'aranha-parsers', '~> 0.4'
|
18
|
-
s.add_dependency 'avm', '~> 0.
|
18
|
+
s.add_dependency 'avm', '~> 0.27'
|
19
19
|
s.add_dependency 'avm-eac_asciidoctor_base0', '~> 0.3', '>= 0.3.4'
|
20
20
|
s.add_dependency 'avm-eac_rails_base0', '~> 0.3'
|
21
|
-
s.add_dependency 'avm-eac_redmine_base0', '~> 0.5', '>= 0.5.2'
|
22
21
|
s.add_dependency 'avm-eac_ruby_base1', '~> 0.8'
|
23
22
|
s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.3'
|
24
23
|
s.add_dependency 'avm-files', '~> 0.1'
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/tools/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Tools
|
7
|
+
class Runner
|
8
|
+
class ApplicationStereotypes
|
9
|
+
class List
|
10
|
+
runner_with :help, :output
|
11
|
+
|
12
|
+
def run
|
13
|
+
infov 'Found', stereotypes.count
|
14
|
+
run_output
|
15
|
+
end
|
16
|
+
|
17
|
+
def output_content
|
18
|
+
stereotypes.map { |s| "#{s}\n" }.join
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def stereotypes
|
24
|
+
::Avm::Registry.application_stereotypes.available
|
25
|
+
.sort_by { |s| [s.name, s.namespace_module] }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'avm/instances/base'
|
4
|
+
require 'avm/registry'
|
4
5
|
require 'eac_cli/core_ext'
|
5
6
|
|
6
7
|
module Avm
|
@@ -14,10 +15,14 @@ module Avm
|
|
14
15
|
subcommands
|
15
16
|
end
|
16
17
|
|
18
|
+
def extra_available_subcommands
|
19
|
+
instance.if_present({}, &:extra_available_subcommands)
|
20
|
+
end
|
21
|
+
|
17
22
|
private
|
18
23
|
|
19
24
|
def instance_uncached
|
20
|
-
::Avm::
|
25
|
+
::Avm::Registry.instances.detect(parsed.instance_id)
|
21
26
|
end
|
22
27
|
end
|
23
28
|
end
|
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
16
|
-
s.add_dependency 'eac_templates', '~> 0.1'
|
15
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.96'
|
16
|
+
s.add_dependency 'eac_templates', '~> 0.3', '>= 0.3.1'
|
17
17
|
|
18
|
-
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.
|
18
|
+
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
19
19
|
end
|
@@ -34,7 +34,7 @@ module EacDocker
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
def volume(left_part, right_part =
|
37
|
+
def volume(left_part, right_part = nil)
|
38
38
|
immutable_volume(right_part.if_present(left_part) { |v| "#{left_part}:#{v}" })
|
39
39
|
end
|
40
40
|
|
@@ -43,8 +43,9 @@ module EacDocker
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def run_command_args
|
46
|
-
|
47
|
-
|
46
|
+
%w[boolean capabilities envs volumes]
|
47
|
+
.inject([]) { |a, e| a + send("run_command_#{e}_args") } +
|
48
|
+
[image.provide.id] + command_args
|
48
49
|
end
|
49
50
|
|
50
51
|
def stop
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/sub/{avm-tools/sub/eac_docker → eac_docker}/spec/lib/eac_docker/images/templatized_spec.rb
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -8,13 +8,26 @@ module EacRubyUtils
|
|
8
8
|
module Immutable
|
9
9
|
class ArrayAccessor < ::EacRubyUtils::Immutable::BaseAccessor
|
10
10
|
def apply(klass)
|
11
|
+
apply_singular(klass)
|
12
|
+
apply_plural(klass)
|
13
|
+
end
|
14
|
+
|
15
|
+
def apply_plural(klass)
|
11
16
|
accessor = self
|
12
|
-
klass.send(:define_method, name) do |
|
13
|
-
|
17
|
+
klass.send(:define_method, ::ActiveSupport::Inflector.pluralize(name)) do |*args|
|
18
|
+
case args.count
|
19
|
+
when 0 then next accessor.immutable_value_get(self)
|
20
|
+
when 1 then next accessor.immutable_value_set(self, args.first)
|
21
|
+
else
|
22
|
+
raise ::ArgumentError, "wrong number of arguments (given #{args.count}, expected 0..1)"
|
23
|
+
end
|
14
24
|
end
|
25
|
+
end
|
15
26
|
|
16
|
-
|
17
|
-
|
27
|
+
def apply_singular(klass)
|
28
|
+
accessor = self
|
29
|
+
klass.send(:define_method, name) do |value|
|
30
|
+
accessor.immutable_value_push(self, value)
|
18
31
|
end
|
19
32
|
end
|
20
33
|
|
@@ -22,11 +35,15 @@ module EacRubyUtils
|
|
22
35
|
super || []
|
23
36
|
end
|
24
37
|
|
25
|
-
def
|
38
|
+
def immutable_value_push(object, value)
|
26
39
|
duplicate_object(object) do |old_value|
|
27
40
|
(old_value || []) + [value]
|
28
41
|
end
|
29
42
|
end
|
43
|
+
|
44
|
+
def immutable_value_set(object, value)
|
45
|
+
duplicate_object(object) { |_old_value| value }
|
46
|
+
end
|
30
47
|
end
|
31
48
|
end
|
32
49
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
::RSpec.describe ::EacRubyUtils::Immutable do
|
4
|
+
let(:stub_class) do
|
5
|
+
the_described_class = described_class
|
6
|
+
::Class.new do
|
7
|
+
include the_described_class
|
8
|
+
|
9
|
+
immutable_accessor :array_attr, type: :array
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:initial_instance) { stub_class.new }
|
14
|
+
|
15
|
+
it do
|
16
|
+
expect(initial_instance.array_attrs).to eq([])
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'when array_attr pushs for' do
|
20
|
+
let(:change1_instance) { initial_instance.array_attr('A') }
|
21
|
+
|
22
|
+
it { expect(change1_instance).to be_a(initial_instance.class) }
|
23
|
+
it { expect(change1_instance.object_id).not_to eq(initial_instance.object_id) }
|
24
|
+
it { expect(change1_instance.array_attrs).to eq(%w[A]) }
|
25
|
+
|
26
|
+
context 'when array_attrs sets for' do
|
27
|
+
let(:change2_instance) { initial_instance.array_attrs(%w[B]) }
|
28
|
+
|
29
|
+
it { expect(change2_instance).to be_a(initial_instance.class) }
|
30
|
+
it { expect(change2_instance.object_id).not_to eq(change1_instance.object_id) }
|
31
|
+
it { expect(change2_instance.array_attrs).to eq(%w[B]) }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|