avm 0.8.0 → 0.12.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/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 +12 -10
- 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/configuration.rb +37 -0
- data/lib/avm/sources/base/testing.rb +21 -0
- data/lib/avm/sources/base.rb +9 -25
- data/lib/avm/sources/tester.rb +24 -0
- data/lib/avm/sources/tests/builder.rb +83 -0
- data/lib/avm/sources/tests/performer.rb +35 -0
- data/lib/avm/sources/tests/result.rb +15 -0
- data/lib/avm/sources/tests/single.rb +56 -0
- data/lib/avm/sources/tests.rb +11 -0
- data/lib/avm/version.rb +1 -1
- metadata +13 -5
- data/lib/avm/source_stereotypes/base.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc36c269f09f7478ca47f4aff0e2877748894fcef575a346a4dde720cac71f3d
|
4
|
+
data.tar.gz: f3473069c2bc78a36851dcd2789dbc1c90e85cf0a53de4e2504a0ff36725a667
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8124307bb3412c4976462bb808c733d9a7836b4795377f5e2bddea35a4a1bcd9bffb3a05047d68cbd2253ce42b01e62b1659ec3a15e7c19568426313135748d
|
7
|
+
data.tar.gz: 0c4ea2d83fa19a8ce1f62f468c7096b1681c8501a62444d59aaaf036fd5dfd11e52dc1251120fd95c764cbd4d45726edb6b756ba3cd1d88cf8f811d9d694bfc0
|
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
@@ -12,11 +12,11 @@ module Avm
|
|
12
12
|
def detect(*registered_initialize_args)
|
13
13
|
detect_optional(*registered_initialize_args) ||
|
14
14
|
raise("No registered module valid for #{registered_initialize_args}" \
|
15
|
-
" (Module suffix: #{module_suffix})")
|
15
|
+
" (Module suffix: #{module_suffix}, Available: #{registered_modules.join(', ')})")
|
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,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'eac_ruby_utils/yaml'
|
5
|
+
require 'shellwords'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Sources
|
9
|
+
class Base
|
10
|
+
module Configuration
|
11
|
+
# @return [Array<String>, nil]
|
12
|
+
def read_configuration_as_shell_words(key)
|
13
|
+
configuration[key].if_present do |v|
|
14
|
+
v.is_a?(::Enumerable) ? v.map(&:to_s) : ::Shellwords.split(v.to_s)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
# @return [Hash]
|
21
|
+
def configuration_uncached
|
22
|
+
::Avm::Sources::Configuration::FILENAMES.each do |filename|
|
23
|
+
file_path = path.join(filename)
|
24
|
+
return ::EacRubyUtils::Yaml.load_file(file_path).with_indifferent_access if
|
25
|
+
file_path.exist?
|
26
|
+
end
|
27
|
+
{}
|
28
|
+
end
|
29
|
+
|
30
|
+
# @return [Avm::Sources::Configuration]
|
31
|
+
def old_configuration_uncached
|
32
|
+
::Avm::Sources::Configuration.find_in_path(path)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
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
@@ -7,16 +7,20 @@ require 'eac_ruby_utils/core_ext'
|
|
7
7
|
module Avm
|
8
8
|
module Sources
|
9
9
|
class Base
|
10
|
-
require_sub __FILE__
|
10
|
+
require_sub __FILE__, include_modules: true
|
11
|
+
compare_by :path
|
12
|
+
enable_abstract_methods
|
11
13
|
enable_simple_cache
|
12
14
|
enable_listable
|
13
15
|
lists.add_symbol :option, :parent
|
14
16
|
common_constructor :path, :options, default: [{}] do
|
15
|
-
self.path = path.to_pathname
|
16
|
-
self.options =
|
17
|
+
self.path = path.to_pathname.expand_path
|
18
|
+
self.options = ::Avm::Sources::Base.lists.option.hash_keys_validate!(options)
|
17
19
|
end
|
18
20
|
|
19
|
-
|
21
|
+
abstract_methods :update, :valid?
|
22
|
+
|
23
|
+
delegate :locale, to: :old_configuration
|
20
24
|
delegate :to_s, to: :path
|
21
25
|
|
22
26
|
# @return [Avm::Sources::Base]
|
@@ -33,35 +37,15 @@ module Avm
|
|
33
37
|
|
34
38
|
# @return [Enumerable<Avm::Sources::Base>]
|
35
39
|
def subs
|
36
|
-
|
37
|
-
.map { |subrepo| self.class.new(subrepo.subpath.expand_path(path), parent: self) }
|
38
|
-
end
|
39
|
-
|
40
|
-
def update
|
41
|
-
stereotype.update_source(self)
|
40
|
+
scm.subs.map { |subrepo| self.class.new(subrepo.path, parent: self) }
|
42
41
|
end
|
43
42
|
|
44
43
|
private
|
45
44
|
|
46
|
-
# @return [Avm::Sources::Configuration]
|
47
|
-
def configuration_uncached
|
48
|
-
::Avm::Sources::Configuration.find_in_path(path) || ::Avm::Sources::Configuration.new
|
49
|
-
end
|
50
|
-
|
51
|
-
# @return [EacGit::Local]
|
52
|
-
def git_repo_uncached
|
53
|
-
::EacGit::Local.new(path)
|
54
|
-
end
|
55
|
-
|
56
45
|
# @return [Avm::Scms::Base]
|
57
46
|
def scm_uncached
|
58
47
|
::Avm::Registry.scms.detect(path)
|
59
48
|
end
|
60
|
-
|
61
|
-
# @return [Avm::SourceStereotypes::Base]
|
62
|
-
def stereotype_uncached
|
63
|
-
::Avm::Registry.source_stereotypes.detect(self)
|
64
|
-
end
|
65
49
|
end
|
66
50
|
end
|
67
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
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/sources/tests/performer'
|
4
|
+
require 'avm/sources/tests/single'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Sources
|
9
|
+
module Tests
|
10
|
+
class Builder
|
11
|
+
require_sub __FILE__
|
12
|
+
enable_immutable
|
13
|
+
|
14
|
+
immutable_accessor :include_main, :include_subs, type: :boolean
|
15
|
+
immutable_accessor :include_id, type: :array
|
16
|
+
common_constructor :main_source
|
17
|
+
|
18
|
+
def immutable_constructor_args
|
19
|
+
[main_source]
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return [Avm::Sources::Tests::Performer]
|
23
|
+
def performer
|
24
|
+
::Avm::Sources::Tests::Performer.new(self)
|
25
|
+
end
|
26
|
+
|
27
|
+
def selected_units
|
28
|
+
(select_units_from_subs + select_units_from_main + select_units_from_ids).sort.uniq
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
# @return [Array<Avm::Sources::Tests::Single>]
|
34
|
+
def available_units
|
35
|
+
@available_units ||= ([main_source] + main_source.subs)
|
36
|
+
.map { |a_source| create_unit(a_source) }
|
37
|
+
end
|
38
|
+
|
39
|
+
def available_units_from_main
|
40
|
+
create_units([main_source])
|
41
|
+
end
|
42
|
+
|
43
|
+
def available_units_from_subs
|
44
|
+
create_units(main_source.subs)
|
45
|
+
end
|
46
|
+
|
47
|
+
# @return [Avm::Sources::Tests::Single]
|
48
|
+
def create_unit(source)
|
49
|
+
::Avm::Sources::Tests::Single.new(self, source)
|
50
|
+
end
|
51
|
+
|
52
|
+
# @return [Array<Avm::Sources::Tests::Single>]
|
53
|
+
def create_units(sources)
|
54
|
+
sources.map { |a_source| create_unit(a_source) }
|
55
|
+
end
|
56
|
+
|
57
|
+
# @return [Avm::Sources::Tests::Single]
|
58
|
+
def create_unit_by_id(source_id)
|
59
|
+
r = available_units.find { |unit| unit.id == source_id }
|
60
|
+
return r if r
|
61
|
+
|
62
|
+
raise ::ArgumentError, "Source not found with ID=#{source_id}" \
|
63
|
+
"(Available: #{available_units.map(&:id).join(', ')})"
|
64
|
+
end
|
65
|
+
|
66
|
+
# @return [Array<Avm::Sources::Tests::Single>]
|
67
|
+
def select_units_from_ids
|
68
|
+
include_ids.map { |source_id| create_unit_by_id(source_id) }
|
69
|
+
end
|
70
|
+
|
71
|
+
# @return [Array<Avm::Sources::Tests::Single>]
|
72
|
+
def select_units_from_main
|
73
|
+
include_main? ? available_units_from_main : []
|
74
|
+
end
|
75
|
+
|
76
|
+
# @return [Array<Avm::Sources::Tests::Single>]
|
77
|
+
def select_units_from_subs
|
78
|
+
include_subs? ? available_units_from_subs : []
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/sources/tests/result'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Sources
|
8
|
+
module Tests
|
9
|
+
class Performer
|
10
|
+
enable_simple_cache
|
11
|
+
|
12
|
+
common_constructor(:owner)
|
13
|
+
|
14
|
+
def non_failed_units
|
15
|
+
units.reject(&:failed?)
|
16
|
+
end
|
17
|
+
|
18
|
+
def failed_units
|
19
|
+
units.select(&:failed?)
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return [Boolean]
|
23
|
+
def successful?
|
24
|
+
failed_units.none?
|
25
|
+
end
|
26
|
+
|
27
|
+
protected
|
28
|
+
|
29
|
+
def units_uncached
|
30
|
+
owner.selected_units
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/sources/tests/result'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
require 'eac_fs/logs'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Sources
|
9
|
+
module Tests
|
10
|
+
class Single
|
11
|
+
MAIN_SOURCE_ID = '#main'
|
12
|
+
|
13
|
+
compare_by :order_group, :id
|
14
|
+
enable_simple_cache
|
15
|
+
enable_speaker
|
16
|
+
|
17
|
+
common_constructor :builder, :source
|
18
|
+
|
19
|
+
delegate :logs, :result, to: :tester
|
20
|
+
delegate :to_s, to: :id
|
21
|
+
|
22
|
+
def failed?
|
23
|
+
result == ::Avm::Sources::Tests::Result::FAILED
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [String]
|
27
|
+
def id
|
28
|
+
if main?
|
29
|
+
MAIN_SOURCE_ID
|
30
|
+
else
|
31
|
+
relative_path_from_main_source.to_s
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def main?
|
36
|
+
relative_path_from_main_source.to_s == '.'
|
37
|
+
end
|
38
|
+
|
39
|
+
def order_group
|
40
|
+
main? ? 1 : 0
|
41
|
+
end
|
42
|
+
|
43
|
+
# @return [Pathname]
|
44
|
+
def relative_path_from_main_source
|
45
|
+
source.path.relative_path_from(builder.main_source.path)
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def tester_uncached
|
51
|
+
source.tester
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
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.0
|
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
|
+
date: 2021-12-08 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,16 +230,24 @@ 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
237
|
- lib/avm/sources.rb
|
238
238
|
- lib/avm/sources/base.rb
|
239
|
+
- lib/avm/sources/base/configuration.rb
|
240
|
+
- lib/avm/sources/base/testing.rb
|
239
241
|
- lib/avm/sources/configuration.rb
|
240
242
|
- lib/avm/sources/configuration/_locale.rb
|
241
243
|
- lib/avm/sources/configuration/_rubocop.rb
|
242
244
|
- lib/avm/sources/configuration/_tests.rb
|
245
|
+
- lib/avm/sources/tester.rb
|
246
|
+
- lib/avm/sources/tests.rb
|
247
|
+
- lib/avm/sources/tests/builder.rb
|
248
|
+
- lib/avm/sources/tests/performer.rb
|
249
|
+
- lib/avm/sources/tests/result.rb
|
250
|
+
- lib/avm/sources/tests/single.rb
|
243
251
|
- lib/avm/sync.rb
|
244
252
|
- lib/avm/version.rb
|
245
253
|
- lib/avm/version_number.rb
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module SourceStereotypes
|
7
|
-
class Base
|
8
|
-
enable_abstract_methods
|
9
|
-
abstract_methods :valid?
|
10
|
-
common_constructor :source
|
11
|
-
|
12
|
-
def name
|
13
|
-
self.class.name
|
14
|
-
end
|
15
|
-
|
16
|
-
def to_s
|
17
|
-
name
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|