avm 0.90.1 → 0.91.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/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/rspec/setup.rb +2 -1
- 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/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24587b61abe782918bcfe1b372328d0e9f9ca88db23c9c3990883a8cd88d444b
|
4
|
+
data.tar.gz: 2b1f1f7d2aa5cb42e8ca326d659b7b749aa7f50278c81347432dbc4e68a32b8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c97c2ad6f2857a9b6ccf70f0854b02e39cda4c555aec46174fc7a19ab41f440e7a1b505f6e3c1f377423efad38738a8e843417b30038dda054f151715402401e
|
7
|
+
data.tar.gz: b0231edc3a011674a2c2cbf048ad4efc66139171f91798e175dc867f889b94888d4086350f27a916f94471956f3f366e0242ffb7c832b9e0ae37589fd6647828
|
@@ -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]
|
@@ -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,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
|
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.91.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-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eac_cli
|
@@ -284,6 +284,7 @@ files:
|
|
284
284
|
- lib/avm/launcher/context.rb
|
285
285
|
- lib/avm/launcher/context/instance_collector.rb
|
286
286
|
- lib/avm/launcher/context/instance_discovery.rb
|
287
|
+
- lib/avm/launcher/context/instance_discovery/root_instance_paths.rb
|
287
288
|
- lib/avm/launcher/context/instance_manager.rb
|
288
289
|
- lib/avm/launcher/context/instance_manager/cached_instance.rb
|
289
290
|
- lib/avm/launcher/context/instance_manager/cached_instances.rb
|
@@ -337,6 +338,7 @@ files:
|
|
337
338
|
- lib/avm/rspec/shared_examples/entries_values.rb
|
338
339
|
- lib/avm/rspec/shared_examples/in_avm_registry.rb
|
339
340
|
- lib/avm/rspec/shared_examples/not_in_avm_registry.rb
|
341
|
+
- lib/avm/rspec/shared_examples/with_config.rb
|
340
342
|
- lib/avm/runners/base.rb
|
341
343
|
- lib/avm/scms.rb
|
342
344
|
- lib/avm/scms/auto_commit.rb
|