avm 0.9.0 → 0.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/instances/application.rb +4 -0
- data/lib/avm/instances/entry_keys.rb +1 -1
- data/lib/avm/instances/runner.rb +2 -1
- data/lib/avm/registry/base.rb +11 -9
- data/lib/avm/registry.rb +1 -1
- data/lib/avm/runners/base.rb +0 -4
- data/lib/avm/scms/base.rb +5 -0
- data/lib/avm/scms/inflector.rb +22 -0
- data/lib/avm/sources/base/testing.rb +21 -0
- data/lib/avm/sources/base.rb +5 -18
- data/lib/avm/sources/tester.rb +24 -0
- data/lib/avm/sources/tests/single.rb +1 -1
- data/lib/avm/version.rb +1 -1
- metadata +7 -6
- data/lib/avm/source_stereotypes/base.rb +0 -35
- data/lib/avm/source_stereotypes/tester.rb +0 -52
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e949017d91bbc44c21d53d6d20f778651263e189b74df7b977ec0cadd363834f
|
4
|
+
data.tar.gz: b1fee81908269fe0f8be74cf9a331b1683a16e526c3c4c3ca99b7566676d2ce5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 248e15f73b3e1a022a418ed769fe6a2fe29c90be527e81684e509a0fb71f6139893414ae4db827711fee517bc6631de493b23cfe2883637811d4f693a53bb9ae
|
7
|
+
data.tar.gz: b68181fc9625e26ef5bb103e431d9f1f7150f661d23503aa56252cff69e67615c687165b7d53dfdb257c09ef10672f6701b8bdb496056bdaaadc1ddcab1d4d06
|
data/lib/avm/instances/runner.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'avm/runners/base'
|
3
4
|
require 'eac_cli/core_ext'
|
4
5
|
|
5
6
|
module Avm
|
6
7
|
module Instances
|
7
|
-
class Runner
|
8
|
+
class Runner < ::Avm::Runners::Base
|
8
9
|
class << self
|
9
10
|
def instance_class
|
10
11
|
::Avm.const_get(stereotype_name).const_get('Instance')
|
data/lib/avm/registry/base.rb
CHANGED
@@ -16,7 +16,7 @@ module Avm
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def detect_optional(*registered_initialize_args)
|
19
|
-
registered_modules.lazy.map { |klass| klass.new(*registered_initialize_args) }
|
19
|
+
registered_modules.reverse.lazy.map { |klass| klass.new(*registered_initialize_args) }
|
20
20
|
.find(&:valid?)
|
21
21
|
end
|
22
22
|
|
@@ -39,18 +39,20 @@ module Avm
|
|
39
39
|
private
|
40
40
|
|
41
41
|
def registered_modules_uncached
|
42
|
-
|
43
|
-
|
42
|
+
registered_gems.flat_map { |registry| modules_from_registry(registry) }
|
43
|
+
.select { |v| valid_registered_module?(v) }.uniq
|
44
44
|
end
|
45
45
|
|
46
|
-
def
|
47
|
-
|
46
|
+
def modules_from_registry(registry)
|
47
|
+
if registry.registry.module_suffix == provider_module_suffix
|
48
|
+
registry.registered_module.new.all
|
49
|
+
else
|
50
|
+
[registry.registered_module]
|
51
|
+
end
|
48
52
|
end
|
49
53
|
|
50
|
-
def
|
51
|
-
provider_registry.registered
|
52
|
-
provider_class.new.all
|
53
|
-
end
|
54
|
+
def registered_gems
|
55
|
+
(single_instance_registry.registered + provider_registry.registered).sort
|
54
56
|
end
|
55
57
|
|
56
58
|
def single_instance_registry_uncached
|
data/lib/avm/registry.rb
CHANGED
@@ -7,7 +7,7 @@ module Avm
|
|
7
7
|
module Registry
|
8
8
|
require_sub __FILE__
|
9
9
|
enable_listable
|
10
|
-
lists.add_symbol :category, :instance_stereotypes, :runners, :scms, :
|
10
|
+
lists.add_symbol :category, :instance_stereotypes, :runners, :scms, :sources
|
11
11
|
|
12
12
|
class << self
|
13
13
|
enable_simple_cache
|
data/lib/avm/runners/base.rb
CHANGED
data/lib/avm/scms/base.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Avm
|
4
|
+
module Scms
|
5
|
+
class Inflector
|
6
|
+
class << self
|
7
|
+
def default_instance
|
8
|
+
@default_instance ||= new
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
ISSUE_POINTER_NAME_PREFIX = 'issue_'
|
13
|
+
POINTER_NAME_TO_ISSUE_PATTERN = /\A#{Regexp.quote(ISSUE_POINTER_NAME_PREFIX)}(\d+)\z/.freeze
|
14
|
+
POINTER_NAME_TO_ISSUE_PARSER = POINTER_NAME_TO_ISSUE_PATTERN.to_parser { |m| m[1] }
|
15
|
+
|
16
|
+
# @return [String, nil]
|
17
|
+
def pointer_name_to_issue_id(pointer_name)
|
18
|
+
POINTER_NAME_TO_ISSUE_PARSER.parse(pointer_name)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Sources
|
7
|
+
class Base
|
8
|
+
module Testing
|
9
|
+
# @return [Avm::Sources::Tester]
|
10
|
+
def tester
|
11
|
+
tester_class.new(self)
|
12
|
+
end
|
13
|
+
|
14
|
+
# @return [Class<Avm::Sources::Tester>
|
15
|
+
def tester_class
|
16
|
+
Avm::Sources::Tester
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/avm/sources/base.rb
CHANGED
@@ -9,17 +9,19 @@ module Avm
|
|
9
9
|
class Base
|
10
10
|
require_sub __FILE__, include_modules: true
|
11
11
|
compare_by :path
|
12
|
+
enable_abstract_methods
|
12
13
|
enable_simple_cache
|
13
14
|
enable_listable
|
14
15
|
lists.add_symbol :option, :parent
|
15
16
|
common_constructor :path, :options, default: [{}] do
|
16
17
|
self.path = path.to_pathname.expand_path
|
17
|
-
self.options =
|
18
|
+
self.options = ::Avm::Sources::Base.lists.option.hash_keys_validate!(options)
|
18
19
|
end
|
19
20
|
|
21
|
+
abstract_methods :update, :valid?
|
22
|
+
|
20
23
|
delegate :locale, to: :old_configuration
|
21
24
|
delegate :to_s, to: :path
|
22
|
-
delegate :tester, to: :stereotype
|
23
25
|
|
24
26
|
# @return [Avm::Sources::Base]
|
25
27
|
def parent
|
@@ -35,30 +37,15 @@ module Avm
|
|
35
37
|
|
36
38
|
# @return [Enumerable<Avm::Sources::Base>]
|
37
39
|
def subs
|
38
|
-
|
39
|
-
.map { |subrepo| self.class.new(subrepo.subpath.expand_path(path), parent: self) }
|
40
|
-
end
|
41
|
-
|
42
|
-
def update
|
43
|
-
stereotype.update_source(self)
|
40
|
+
scm.subs.map { |subrepo| ::Avm::Registry.sources.detect(subrepo.path, parent: self) }
|
44
41
|
end
|
45
42
|
|
46
43
|
private
|
47
44
|
|
48
|
-
# @return [EacGit::Local]
|
49
|
-
def git_repo_uncached
|
50
|
-
::EacGit::Local.new(path)
|
51
|
-
end
|
52
|
-
|
53
45
|
# @return [Avm::Scms::Base]
|
54
46
|
def scm_uncached
|
55
47
|
::Avm::Registry.scms.detect(path)
|
56
48
|
end
|
57
|
-
|
58
|
-
# @return [Avm::SourceStereotypes::Base]
|
59
|
-
def stereotype_uncached
|
60
|
-
::Avm::Registry.source_stereotypes.detect(self)
|
61
|
-
end
|
62
49
|
end
|
63
50
|
end
|
64
51
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Sources
|
7
|
+
class Tester
|
8
|
+
enable_abstract_methods
|
9
|
+
common_constructor :source
|
10
|
+
|
11
|
+
abstract_methods :result, :logs
|
12
|
+
|
13
|
+
# @return [EacFs::Logs]
|
14
|
+
def logs
|
15
|
+
raise_abstract_method __method__
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [Avm::Sources::Tests::Result]
|
19
|
+
def result
|
20
|
+
raise_abstract_method __method__
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/avm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo H. Bogoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11
|
11
|
+
date: 2021-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eac_cli
|
@@ -64,14 +64,14 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '0.
|
67
|
+
version: '0.80'
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '0.
|
74
|
+
version: '0.80'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: eac_templates
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -230,18 +230,19 @@ files:
|
|
230
230
|
- lib/avm/runners/base.rb
|
231
231
|
- lib/avm/scms/base.rb
|
232
232
|
- lib/avm/scms/commit.rb
|
233
|
+
- lib/avm/scms/inflector.rb
|
233
234
|
- lib/avm/self/docker_image.rb
|
234
235
|
- lib/avm/self/instance.rb
|
235
236
|
- lib/avm/self/instance/entry_keys.rb
|
236
|
-
- lib/avm/source_stereotypes/base.rb
|
237
|
-
- lib/avm/source_stereotypes/tester.rb
|
238
237
|
- lib/avm/sources.rb
|
239
238
|
- lib/avm/sources/base.rb
|
240
239
|
- lib/avm/sources/base/configuration.rb
|
240
|
+
- lib/avm/sources/base/testing.rb
|
241
241
|
- lib/avm/sources/configuration.rb
|
242
242
|
- lib/avm/sources/configuration/_locale.rb
|
243
243
|
- lib/avm/sources/configuration/_rubocop.rb
|
244
244
|
- lib/avm/sources/configuration/_tests.rb
|
245
|
+
- lib/avm/sources/tester.rb
|
245
246
|
- lib/avm/sources/tests.rb
|
246
247
|
- lib/avm/sources/tests/builder.rb
|
247
248
|
- lib/avm/sources/tests/performer.rb
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/source_stereotypes/tester'
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
5
|
-
require 'eac_ruby_utils/envs'
|
6
|
-
|
7
|
-
module Avm
|
8
|
-
module SourceStereotypes
|
9
|
-
class Base
|
10
|
-
common_constructor :source
|
11
|
-
|
12
|
-
def name
|
13
|
-
self.class.name
|
14
|
-
end
|
15
|
-
|
16
|
-
# @return [Avm::SourceStereotypes::Tester]
|
17
|
-
def tester
|
18
|
-
tester_class.new(self)
|
19
|
-
end
|
20
|
-
|
21
|
-
# @return [Class<Avm::SourceStereotypes::Tester>
|
22
|
-
def tester_class
|
23
|
-
Avm::SourceStereotypes::Tester
|
24
|
-
end
|
25
|
-
|
26
|
-
def to_s
|
27
|
-
name
|
28
|
-
end
|
29
|
-
|
30
|
-
def valid?
|
31
|
-
true
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module SourceStereotypes
|
7
|
-
class Tester
|
8
|
-
TEST_COMMAND_CONFIGURATION_KEY = :test_command
|
9
|
-
|
10
|
-
enable_simple_cache
|
11
|
-
common_constructor :source_stereotype
|
12
|
-
delegate :source, to: :source_stereotype
|
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
|
-
private
|
23
|
-
|
24
|
-
def logs_uncached
|
25
|
-
::EacRubyUtils::Fs::Logs.new.add(:stdout).add(:stderr)
|
26
|
-
end
|
27
|
-
|
28
|
-
# @return [Avm::Sources::Tests::Result]
|
29
|
-
def result_uncached
|
30
|
-
return ::Avm::Sources::Tests::Result::NONEXISTENT if test_command.blank?
|
31
|
-
|
32
|
-
if execute_command_and_log(test_command)
|
33
|
-
::Avm::Sources::Tests::Result::SUCESSFUL
|
34
|
-
else
|
35
|
-
::Avm::Sources::Tests::Result::FAILED
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def run_test_command
|
40
|
-
execute_command_and_log(test_command)
|
41
|
-
end
|
42
|
-
|
43
|
-
# @return [true, false]
|
44
|
-
def execute_command_and_log(command)
|
45
|
-
r = command.execute
|
46
|
-
logs[:stdout].write(r[:stdout])
|
47
|
-
logs[:stderr].write(r[:stderr])
|
48
|
-
r[:exit_code].zero?
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|