avm 0.90.1 → 0.92.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/avm/applications/base/local_source.rb +6 -1
- data/lib/avm/docker/runner.rb +11 -0
- data/lib/avm/instances/data/package.rb +2 -2
- data/lib/avm/instances/data/unit.rb +2 -2
- data/lib/avm/launcher/context/instance_discovery/root_instance_paths.rb +53 -0
- data/lib/avm/launcher/context/instance_discovery.rb +25 -6
- data/lib/avm/launcher/context.rb +3 -3
- data/lib/avm/launcher/paths/real.rb +1 -1
- data/lib/avm/rspec/setup.rb +2 -1
- data/lib/avm/rspec/shared_examples/avm_source_generated.rb +5 -2
- data/lib/avm/rspec/shared_examples/entries_values.rb +1 -3
- data/lib/avm/rspec/shared_examples/with_config.rb +11 -0
- data/lib/avm/source_generators/base.rb +31 -1
- data/lib/avm/version.rb +1 -1
- metadata +10 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15b1096b5fdec594a25fe5197312d72392f7e46fece8012263421f80f2d827a4
|
4
|
+
data.tar.gz: 49250daa335c7484229ad130bcb978133a0891bd7b9d41793ae20b8f85668e39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc2292dc7acbfbdef138d2e8a8c97e87f96f2e4947669c11f399f1fd3ab45b73f2808e43d29a9ed5fe24f320b61bf26876b7333cb9d1fd2c6ae50254ac2957d8
|
7
|
+
data.tar.gz: 937555ba04232ed2364767d3420ccf4046096e5edeacfb378bb728afc7b296601ca97c94e739fd4fc7246dc306482af4980bb1a6cd0227cfa24ef2dc15cd59f6
|
@@ -10,7 +10,7 @@ module Avm
|
|
10
10
|
module LocalSource
|
11
11
|
# @return [Pathname]
|
12
12
|
def local_source_path
|
13
|
-
|
13
|
+
user_local_source_path || auto_local_source_path
|
14
14
|
end
|
15
15
|
|
16
16
|
# @return [EacConfig::Entry]
|
@@ -18,6 +18,11 @@ module Avm
|
|
18
18
|
::EacConfig::Node.context.current.entry([local_instance_id, 'install', 'path'])
|
19
19
|
end
|
20
20
|
|
21
|
+
# @return [Path, nil]
|
22
|
+
def user_local_source_path
|
23
|
+
local_source_path_entry.value.if_present(&:to_pathname)
|
24
|
+
end
|
25
|
+
|
21
26
|
private
|
22
27
|
|
23
28
|
# @return [Avm::Sources::Base]
|
data/lib/avm/docker/runner.rb
CHANGED
@@ -7,6 +7,7 @@ module Avm
|
|
7
7
|
module Docker
|
8
8
|
class Runner
|
9
9
|
DOCKER_DEFAULT_REGISTRY_METHOD = :docker_default_registry
|
10
|
+
DOCKER_DEFAULT_REGISTRY_NAME = 'local'
|
10
11
|
|
11
12
|
enable_speaker
|
12
13
|
enable_simple_cache
|
@@ -33,6 +34,11 @@ module Avm
|
|
33
34
|
container_run
|
34
35
|
end
|
35
36
|
|
37
|
+
# @return [EacDocker::Registry, nil]
|
38
|
+
def docker_default_registry
|
39
|
+
::EacDocker::Registry.new(default_docker_registry_name)
|
40
|
+
end
|
41
|
+
|
36
42
|
private
|
37
43
|
|
38
44
|
def setup
|
@@ -65,6 +71,11 @@ module Avm
|
|
65
71
|
instance.docker_container
|
66
72
|
end
|
67
73
|
|
74
|
+
# @return [String]
|
75
|
+
def default_docker_registry_name
|
76
|
+
DOCKER_DEFAULT_REGISTRY_NAME
|
77
|
+
end
|
78
|
+
|
68
79
|
def docker_image
|
69
80
|
instance.docker_image
|
70
81
|
end
|
@@ -21,8 +21,8 @@ module Avm
|
|
21
21
|
instance.data_package.units.key(self) || raise("No identifier found for #{self}")
|
22
22
|
end
|
23
23
|
|
24
|
-
def load(
|
25
|
-
instance.on_disabled_processes { super
|
24
|
+
def load(...)
|
25
|
+
instance.on_disabled_processes { super }
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ruby-progressbar'
|
4
|
+
require 'avm/launcher/instances/base'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Launcher
|
9
|
+
class Context
|
10
|
+
class InstanceDiscovery
|
11
|
+
class RootInstancePaths
|
12
|
+
acts_as_instance_method
|
13
|
+
enable_speaker
|
14
|
+
|
15
|
+
common_constructor :owner
|
16
|
+
|
17
|
+
# @return [Array<Avm::Launcher::Paths::Logical>]
|
18
|
+
def result
|
19
|
+
application_user_local_source_paths.map do |path|
|
20
|
+
::Avm::Launcher::Paths::Logical.new(owner.context, nil, path.to_path,
|
21
|
+
"/#{path.basename}")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
# @param application [Avm::Applications::Base]
|
28
|
+
# @return [Pathname, nil]
|
29
|
+
def application_user_local_source_path(application) # rubocop:disable Metrics/MethodLength
|
30
|
+
if application.user_local_source_path.blank?
|
31
|
+
warn "Application \"#{application}\" does not have a user local source set"
|
32
|
+
nil
|
33
|
+
elsif application.user_local_source_path.directory?
|
34
|
+
infov application,
|
35
|
+
"user local source found in \"#{application.user_local_source_path}"
|
36
|
+
application.user_local_source_path
|
37
|
+
else
|
38
|
+
warn "Application \"#{application}\"'s local source path is not a directory"
|
39
|
+
nil
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# @return [Array<Pathname>]
|
44
|
+
def application_user_local_source_paths
|
45
|
+
::Avm::Registry.applications.available.sort_by { |a| [a.id] }.map do |application|
|
46
|
+
application_user_local_source_path(application)
|
47
|
+
end.compact_blank.uniq.sort
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -2,23 +2,34 @@
|
|
2
2
|
|
3
3
|
require 'ruby-progressbar'
|
4
4
|
require 'avm/launcher/instances/base'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
5
6
|
|
6
7
|
module Avm
|
7
8
|
module Launcher
|
8
9
|
class Context
|
9
10
|
class InstanceDiscovery
|
10
|
-
|
11
|
+
enable_simple_cache
|
11
12
|
|
12
|
-
|
13
|
-
|
13
|
+
# @!method instances
|
14
|
+
# @return [Array<Avm::Launcher::Instances::Base>]
|
15
|
+
|
16
|
+
# @!method initialize(context)
|
17
|
+
# @param context [Avm::Launcher::Context]
|
18
|
+
common_constructor :context
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
# @return [Array<Avm::Launcher::Instances::Base>]
|
23
|
+
def instances_uncached
|
14
24
|
@progress = ::ProgressBar.create(title: 'Instance discovery', total: 1)
|
15
|
-
|
25
|
+
root_instance_paths.flat_map { |path| path_instances(path, nil) }
|
16
26
|
ensure
|
17
27
|
@progress&.finish
|
18
28
|
end
|
19
29
|
|
20
|
-
|
21
|
-
|
30
|
+
# @param path [Avm::Launcher::Paths::Logical]
|
31
|
+
# @param parent_instance [Avm::Launcher::Instances::Base]
|
32
|
+
# @return [Array<Avm::Launcher::Instances::Base>]
|
22
33
|
def path_instances(path, parent_instance)
|
23
34
|
update_progress_format(path)
|
24
35
|
on_rescued_path_instances(path) do |r|
|
@@ -32,6 +43,8 @@ module Avm
|
|
32
43
|
end
|
33
44
|
end
|
34
45
|
|
46
|
+
# @param path [Avm::Launcher::Paths::Logical]
|
47
|
+
# @return [Array<Avm::Launcher::Instances::Base>]
|
35
48
|
def on_rescued_path_instances(path)
|
36
49
|
r = []
|
37
50
|
begin
|
@@ -42,14 +55,20 @@ module Avm
|
|
42
55
|
r
|
43
56
|
end
|
44
57
|
|
58
|
+
# @param path [Avm::Launcher::Paths::Logical]
|
59
|
+
# @return [void]
|
45
60
|
def update_progress_format(path)
|
46
61
|
@progress.format = "%t (Paths: %c/%C, Current: #{path.logical}) |%B| %a"
|
47
62
|
end
|
48
63
|
|
64
|
+
# @param path [Array<Avm::Launcher::Paths::Logical>]
|
65
|
+
# @return [void]
|
49
66
|
def update_progress_count(children)
|
50
67
|
@progress.total += children.count
|
51
68
|
@progress.increment
|
52
69
|
end
|
70
|
+
|
71
|
+
require_sub __FILE__, require_mode: :kernel
|
53
72
|
end
|
54
73
|
end
|
55
74
|
end
|
data/lib/avm/launcher/context.rb
CHANGED
@@ -29,14 +29,14 @@ module Avm
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
attr_reader :
|
32
|
+
attr_reader :settings, :cache_root
|
33
33
|
attr_accessor :publish_options, :recache, :instance_manager
|
34
34
|
|
35
35
|
CONFIG_PATH_PREFIX = 'launcher'
|
36
|
+
FS_OBJECT_ID = 'unique'
|
36
37
|
|
37
38
|
def initialize(options = {})
|
38
39
|
@options = options.with_indifferent_access
|
39
|
-
@root = ::Avm::Launcher::Paths::Logical.new(self, nil, build_option(:projects_root), '/')
|
40
40
|
@settings = ::Avm::Launcher::Context::Settings.new(build_option(:settings_file))
|
41
41
|
@cache_root = build_option(:cache_root)
|
42
42
|
@publish_options = { new: false, confirm: false, stereotype: nil }
|
@@ -45,7 +45,7 @@ module Avm
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def fs_object_id
|
48
|
-
|
48
|
+
FS_OBJECT_ID
|
49
49
|
end
|
50
50
|
|
51
51
|
def instance(name)
|
data/lib/avm/rspec/setup.rb
CHANGED
@@ -8,7 +8,8 @@ module Avm
|
|
8
8
|
module Setup
|
9
9
|
require_sub __FILE__
|
10
10
|
EXAMPLES = %w[avm_file_formats_with_fixtures avm_file_format_file_resource_name
|
11
|
-
avm_source_generated entries_values in_avm_registry not_in_avm_registry
|
11
|
+
avm_source_generated entries_values in_avm_registry not_in_avm_registry
|
12
|
+
with_config].freeze
|
12
13
|
|
13
14
|
def self.extended(obj)
|
14
15
|
obj.setup_examples
|
@@ -4,15 +4,18 @@ require 'eac_fs/comparator'
|
|
4
4
|
require 'eac_ruby_utils/core_ext'
|
5
5
|
|
6
6
|
RSpec.shared_examples 'avm_source_generated' do |spec_file, stereotype, options = {}|
|
7
|
-
|
7
|
+
include_context 'spec_paths', spec_file
|
8
|
+
block_on_each_source = options.delete(:block_on_each_source)
|
8
9
|
|
9
|
-
|
10
|
+
spec_paths_controller.fixtures_directory.children.select(&:directory?).each do |target_dir|
|
10
11
|
context "when target is \"#{target_dir.basename}\"" do
|
11
12
|
let(:source) { avm_source(stereotype, options.merge(target_basename: target_dir.basename)) }
|
12
13
|
|
13
14
|
it do
|
14
15
|
expect(fs_comparator.build(source.path)).to eq(fs_comparator.build(target_dir))
|
15
16
|
end
|
17
|
+
|
18
|
+
instance_exec(&block_on_each_source) if block_on_each_source
|
16
19
|
end
|
17
20
|
end
|
18
21
|
|
@@ -4,9 +4,7 @@ require 'eac_ruby_utils/core_ext'
|
|
4
4
|
|
5
5
|
RSpec.shared_examples 'entries_values' do |spec_file, expected_values|
|
6
6
|
describe '#read_entry' do
|
7
|
-
|
8
|
-
config_path = config_path.dirname.join("#{config_path.basename_noext}_files", 'config.yml')
|
9
|
-
EacRubyUtils::Rspec.default_setup.stub_eac_config_node(self, config_path)
|
7
|
+
include_examples 'with_config', spec_file
|
10
8
|
|
11
9
|
expected_values.each do |instance_id, values|
|
12
10
|
values.each do |input, expected|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
RSpec.shared_examples 'with_config' do |spec_file|
|
6
|
+
config_path = spec_file.to_pathname
|
7
|
+
config_path = config_path.dirname.join("#{config_path.basename_noext}_files", 'config.yml')
|
8
|
+
temp_config_path = EacRubyUtils::Fs::Temp.file
|
9
|
+
FileUtils.cp(config_path, temp_config_path)
|
10
|
+
EacRubyUtils::Rspec.default_setup.stub_eac_config_node(self, temp_config_path)
|
11
|
+
end
|
@@ -8,6 +8,8 @@ module Avm
|
|
8
8
|
module SourceGenerators
|
9
9
|
class Base
|
10
10
|
acts_as_abstract
|
11
|
+
enable_settings_provider
|
12
|
+
enable_speaker
|
11
13
|
include ::Avm::With::ApplicationStereotype
|
12
14
|
|
13
15
|
class << self
|
@@ -17,19 +19,29 @@ module Avm
|
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
22
|
+
OPTION_NAME = 'name'
|
23
|
+
JOBS = [].freeze
|
24
|
+
|
20
25
|
common_constructor :target_path, :options, default: [{}] do
|
21
26
|
self.target_path = target_path.to_pathname
|
22
27
|
self.options = option_list.validate(options)
|
23
28
|
end
|
24
29
|
|
30
|
+
# @return [String]
|
31
|
+
def name
|
32
|
+
options[OPTION_NAME].if_present(target_path.basename.to_path)
|
33
|
+
end
|
34
|
+
|
25
35
|
# @return [Avm::SourceGenerators::OptionList]
|
26
36
|
def option_list
|
27
37
|
self.class.option_list
|
28
38
|
end
|
29
39
|
|
30
40
|
def perform
|
41
|
+
start_banner
|
31
42
|
assert_clear_directory
|
32
43
|
apply_template
|
44
|
+
perform_jobs
|
33
45
|
end
|
34
46
|
|
35
47
|
def assert_clear_directory
|
@@ -38,7 +50,25 @@ module Avm
|
|
38
50
|
end
|
39
51
|
|
40
52
|
def apply_template
|
41
|
-
|
53
|
+
root_template.apply(self, target_path)
|
54
|
+
end
|
55
|
+
|
56
|
+
def perform_jobs
|
57
|
+
setting_value(:jobs).each do |job|
|
58
|
+
infom "Generating #{job.humanize}..."
|
59
|
+
send("generate_#{job}")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# @return [void]
|
64
|
+
def start_banner
|
65
|
+
infov 'Target path', target_path
|
66
|
+
infov 'Application name', name
|
67
|
+
end
|
68
|
+
|
69
|
+
# @return [EacTemlates::Modules::Base]
|
70
|
+
def root_template
|
71
|
+
template
|
42
72
|
end
|
43
73
|
end
|
44
74
|
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.92.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: 2024-
|
11
|
+
date: 2024-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eac_cli
|
@@ -16,20 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
20
|
-
- - ">="
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 0.40.1
|
19
|
+
version: '0.41'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0.
|
30
|
-
- - ">="
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 0.40.1
|
26
|
+
version: '0.41'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: eac_config
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,34 +78,28 @@ dependencies:
|
|
84
78
|
requirements:
|
85
79
|
- - "~>"
|
86
80
|
- !ruby/object:Gem::Version
|
87
|
-
version: '0.
|
81
|
+
version: '0.122'
|
88
82
|
type: :runtime
|
89
83
|
prerelease: false
|
90
84
|
version_requirements: !ruby/object:Gem::Requirement
|
91
85
|
requirements:
|
92
86
|
- - "~>"
|
93
87
|
- !ruby/object:Gem::Version
|
94
|
-
version: '0.
|
88
|
+
version: '0.122'
|
95
89
|
- !ruby/object:Gem::Dependency
|
96
90
|
name: eac_templates
|
97
91
|
requirement: !ruby/object:Gem::Requirement
|
98
92
|
requirements:
|
99
93
|
- - "~>"
|
100
94
|
- !ruby/object:Gem::Version
|
101
|
-
version: '0.
|
102
|
-
- - ">="
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: 0.5.1
|
95
|
+
version: '0.7'
|
105
96
|
type: :runtime
|
106
97
|
prerelease: false
|
107
98
|
version_requirements: !ruby/object:Gem::Requirement
|
108
99
|
requirements:
|
109
100
|
- - "~>"
|
110
101
|
- !ruby/object:Gem::Version
|
111
|
-
version: '0.
|
112
|
-
- - ">="
|
113
|
-
- !ruby/object:Gem::Version
|
114
|
-
version: 0.5.1
|
102
|
+
version: '0.7'
|
115
103
|
- !ruby/object:Gem::Dependency
|
116
104
|
name: minitar
|
117
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -284,6 +272,7 @@ files:
|
|
284
272
|
- lib/avm/launcher/context.rb
|
285
273
|
- lib/avm/launcher/context/instance_collector.rb
|
286
274
|
- lib/avm/launcher/context/instance_discovery.rb
|
275
|
+
- lib/avm/launcher/context/instance_discovery/root_instance_paths.rb
|
287
276
|
- lib/avm/launcher/context/instance_manager.rb
|
288
277
|
- lib/avm/launcher/context/instance_manager/cached_instance.rb
|
289
278
|
- lib/avm/launcher/context/instance_manager/cached_instances.rb
|
@@ -337,6 +326,7 @@ files:
|
|
337
326
|
- lib/avm/rspec/shared_examples/entries_values.rb
|
338
327
|
- lib/avm/rspec/shared_examples/in_avm_registry.rb
|
339
328
|
- lib/avm/rspec/shared_examples/not_in_avm_registry.rb
|
329
|
+
- lib/avm/rspec/shared_examples/with_config.rb
|
340
330
|
- lib/avm/runners/base.rb
|
341
331
|
- lib/avm/scms.rb
|
342
332
|
- lib/avm/scms/auto_commit.rb
|