avm-eac_generic_base0 0.2.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/eac_generic_base0/instances/base.rb +12 -0
- data/lib/avm/eac_generic_base0/instances.rb +11 -0
- data/lib/avm/eac_generic_base0/sources/base.rb +0 -6
- data/lib/avm/eac_generic_base0/sources/docker/runner.rb +61 -0
- data/lib/avm/eac_generic_base0/sources/docker.rb +13 -0
- data/lib/avm/eac_generic_base0/version.rb +1 -1
- metadata +12 -9
- data/lib/avm/eac_generic_base0/sources/tester.rb +0 -56
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a2df9ff48b4d95d5964e1811139cdc8486b5ecbcbab4580295a7f1a9af64ffe
|
4
|
+
data.tar.gz: b8c0fa13005e94546eb0ee14853e8a4e86a03a38cb084d5ff599961331540c43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dbf73ddf3b27142676f149b1170909aa41f8389e37e3ae515c5db32a9e0a13f4ebe12c46807993359a5de1d68ea8c82837fd7d848da7cd87ab3178ea043cd55
|
7
|
+
data.tar.gz: 85ff887c1af1c19bf3d30bb9d0252aa3be7d33a02465c7336053a463bec0299b35aa13532dd6c6461bdc6e9b5da956fa1209355bd53bb05e048b40435739217e
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/eac_generic_base0/sources/tester'
|
4
3
|
require 'avm/sources/base'
|
5
4
|
require 'eac_ruby_utils/core_ext'
|
6
5
|
|
@@ -11,11 +10,6 @@ module Avm
|
|
11
10
|
require_sub __FILE__, include_modules: true
|
12
11
|
enable_abstract_methods
|
13
12
|
|
14
|
-
# @return [Avm::EacGenericBase0::Sources::Tester]
|
15
|
-
def tester_class
|
16
|
-
Avm::EacGenericBase0::Sources::Tester
|
17
|
-
end
|
18
|
-
|
19
13
|
def valid?
|
20
14
|
::Avm::Registry.scms.detect_optional(path).present?
|
21
15
|
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
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avm-eac_generic_base0
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Put here the authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avm
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.28'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.28'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: eac_ruby_utils
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.96'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
40
|
+
version: '0.96'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: eac_ruby_gem_support
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 0.5.1
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 0.5.1
|
55
55
|
description:
|
56
56
|
email:
|
57
57
|
executables: []
|
@@ -59,10 +59,13 @@ extensions: []
|
|
59
59
|
extra_rdoc_files: []
|
60
60
|
files:
|
61
61
|
- lib/avm/eac_generic_base0.rb
|
62
|
+
- lib/avm/eac_generic_base0/instances.rb
|
63
|
+
- lib/avm/eac_generic_base0/instances/base.rb
|
62
64
|
- lib/avm/eac_generic_base0/sources.rb
|
63
65
|
- lib/avm/eac_generic_base0/sources/base.rb
|
64
66
|
- lib/avm/eac_generic_base0/sources/base/version_bump.rb
|
65
|
-
- lib/avm/eac_generic_base0/sources/
|
67
|
+
- lib/avm/eac_generic_base0/sources/docker.rb
|
68
|
+
- lib/avm/eac_generic_base0/sources/docker/runner.rb
|
66
69
|
- lib/avm/eac_generic_base0/version.rb
|
67
70
|
- locale/en.yml
|
68
71
|
- locale/pt-BR.yml
|
@@ -1,56 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/sources/tester'
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
5
|
-
|
6
|
-
module Avm
|
7
|
-
module EacGenericBase0
|
8
|
-
module Sources
|
9
|
-
class Tester < ::Avm::Sources::Tester
|
10
|
-
TEST_COMMAND_CONFIGURATION_KEY = :test_command
|
11
|
-
|
12
|
-
enable_simple_cache
|
13
|
-
|
14
|
-
# @return [EacRubyUtils::Envs::Command, nil]
|
15
|
-
def test_command
|
16
|
-
source.read_configuration_as_shell_words(TEST_COMMAND_CONFIGURATION_KEY)
|
17
|
-
.if_present do |args|
|
18
|
-
::EacRubyUtils::Envs.local.command(args).chdir(source.path)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
# @return [EacFs::Logs]
|
23
|
-
def logs
|
24
|
-
@logs ||= ::EacFs::Logs.new.add(:stdout).add(:stderr)
|
25
|
-
end
|
26
|
-
|
27
|
-
# @return [Avm::Sources::Tests::Result]
|
28
|
-
def result
|
29
|
-
@result ||= begin
|
30
|
-
if test_command.blank?
|
31
|
-
::Avm::Sources::Tests::Result::NONEXISTENT
|
32
|
-
elsif run_test_command
|
33
|
-
::Avm::Sources::Tests::Result::SUCESSFUL
|
34
|
-
else
|
35
|
-
::Avm::Sources::Tests::Result::FAILED
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
protected
|
41
|
-
|
42
|
-
def run_test_command
|
43
|
-
execute_command_and_log(test_command)
|
44
|
-
end
|
45
|
-
|
46
|
-
# @return [true, false]
|
47
|
-
def execute_command_and_log(command)
|
48
|
-
r = command.execute
|
49
|
-
logs[:stdout].write(r[:stdout])
|
50
|
-
logs[:stderr].write(r[:stderr])
|
51
|
-
r[:exit_code].zero?
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|