avm 0.100.0 → 0.101.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 071671b3172d72c37010555f7b88c4df4969064292aac64626f2ee37feca5b6a
4
- data.tar.gz: ec13d8885f0c503ae7a7a2663629145c9bb8504e1946aee11f78141f5a7e5b28
3
+ metadata.gz: c8159d75fec13eab1272dc522e956b2bf755dc473c05ac52aabe9d8e4dcc102a
4
+ data.tar.gz: 56236e1be5fe03bd0d6b780ffa672ea01fdd6420db3c31b714a996e059e12ed4
5
5
  SHA512:
6
- metadata.gz: 5a9872da111a879b1cc808da267ac5c446c3d67adab21a5b0ef497f6d8f9ada5b783b3d6c0896e288cfd93a51cc6df0227f6d36d9f83a50957c00887fecdbef1
7
- data.tar.gz: b81a15f8fb665c9176cda13618169620b56db25a507b531788b950269f60df4b8d47d5c922ce03de5024b18de6136f25d607246c329f406d65fa7cc51c6f25d8
6
+ metadata.gz: 778a55da2129b6517e80deb203ed5c65e430957833f3f6f61e26b679670a073a6f09a5806105c9f952c74d377723803dd7b34639dce98d71a51c95dd02ec842d
7
+ data.tar.gz: 0c92fcecb33b4def2ddf776369187edce9be7f25b70880274a4d813cb60d0b1fc3367ead17fe09c880359821e7a14576ab4dc54db026e17b7546df7d065b7d68
@@ -31,8 +31,8 @@ module Avm
31
31
  end
32
32
  end
33
33
 
34
- def define_inherited_value_proc_method(&block)
35
- entries_provider_class.define_method(inherited_value_proc_name, &block)
34
+ def define_inherited_value_proc_method(&)
35
+ entries_provider_class.define_method(inherited_value_proc_name, &)
36
36
  end
37
37
 
38
38
  def entry_key_path
@@ -14,7 +14,7 @@ module Avm
14
14
 
15
15
  lists.add_string :access, :local, :ssh
16
16
 
17
- ID_PATTERN = /\A([a-z0-9]+(?:-[a-z0-9]+)*)_(.+)\z/.freeze
17
+ ID_PATTERN = /\A([a-z0-9]+(?:-[a-z0-9]+)*)_(.+)\z/
18
18
 
19
19
  class << self
20
20
  def by_id(id)
@@ -4,7 +4,7 @@ module Avm
4
4
  module Instances
5
5
  module Ids
6
6
  ID_PARTS_SEPARATOR = '_'
7
- ID_PATTERN = /\A([a-z0-9]+(?:-[a-z0-9]+)*)_(.+)\z/.freeze
7
+ ID_PATTERN = /\A([a-z0-9]+(?:-[a-z0-9]+)*)_(.+)\z/
8
8
  ID_PARSER = ID_PATTERN.to_parser do |m|
9
9
  ::Struct.new(:application_id, :instance_suffix).new(m[1], m[2])
10
10
  end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ruby-progressbar'
4
+
5
+ module Avm
6
+ module Launcher
7
+ class Context
8
+ class InstanceDiscovery
9
+ class RootSourceWrappers
10
+ acts_as_instance_method
11
+ enable_speaker
12
+
13
+ common_constructor :owner
14
+
15
+ # @return [Enumerable<Avm::Launcher::Context::InstanceDiscovery::SourceWrapper>]
16
+ def result
17
+ owner.root_sources.map do |source|
18
+ ::Avm::Launcher::Context::InstanceDiscovery::SourceWrapper.new(
19
+ owner,
20
+ ::Avm::Launcher::Paths::Logical.new(
21
+ owner.context, nil, source.to_path, "/#{source.basename}"
22
+ ),
23
+ nil
24
+ )
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -6,7 +6,7 @@ module Avm
6
6
  module Launcher
7
7
  class Context
8
8
  class InstanceDiscovery
9
- class RootInstancePaths
9
+ class RootSources
10
10
  acts_as_instance_method
11
11
  enable_speaker
12
12
 
@@ -14,36 +14,33 @@ module Avm
14
14
 
15
15
  # @return [Array<Avm::Launcher::Paths::Logical>]
16
16
  def result
17
- application_user_local_source_paths.map do |path|
18
- ::Avm::Launcher::Paths::Logical.new(owner.context, nil, path.to_path,
19
- "/#{path.basename}")
20
- end
17
+ ::Avm::Registry.applications.available.sort_by { |a| [a.id] }.map do |application|
18
+ application_source(application)
19
+ end.compact_blank.uniq.sort
21
20
  end
22
21
 
23
- private
22
+ protected
24
23
 
25
24
  # @param application [Avm::Applications::Base]
26
25
  # @return [Pathname, nil]
27
- def application_user_local_source_path(application) # rubocop:disable Metrics/MethodLength
26
+ def application_source(application) # rubocop:disable Metrics/MethodLength
28
27
  if application.user_local_source_path.blank?
29
28
  warn "Application \"#{application}\" does not have a user local source set"
30
29
  nil
31
30
  elsif application.user_local_source_path.directory?
32
31
  infov application,
33
- "user local source found in \"#{application.user_local_source_path}"
34
- application.user_local_source_path
32
+ "user local source found in \"#{application.user_local_source_path}\""
33
+ begin
34
+ application.user_local_source_path
35
+ rescue ::Avm::Registry::DetectionError => e
36
+ warn "Application \"#{application}\"'s detection raised the error #{e}"
37
+ nil
38
+ end
35
39
  else
36
40
  warn "Application \"#{application}\"'s local source path is not a directory"
37
41
  nil
38
42
  end
39
43
  end
40
-
41
- # @return [Array<Pathname>]
42
- def application_user_local_source_paths
43
- ::Avm::Registry.applications.available.sort_by { |a| [a.id] }.map do |application|
44
- application_user_local_source_path(application)
45
- end.compact_blank.uniq.sort
46
- end
47
44
  end
48
45
  end
49
46
  end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ruby-progressbar'
4
+
5
+ module Avm
6
+ module Launcher
7
+ class Context
8
+ class InstanceDiscovery
9
+ class SourceWrapper
10
+ enable_simple_cache
11
+ enable_speaker
12
+
13
+ common_constructor :owner, :logical_path, :parent_project
14
+
15
+ # @return [Avm::Launcher::Instances::Base, nil]
16
+ def parent_project_for_sub
17
+ self_project.presence || parent_project
18
+ end
19
+
20
+ # @return [Enumerable<Avm::Launcher::Instances::Base>]
21
+ def projects
22
+ self_project.if_present([]) { |v| [v] } +
23
+ subs.flat_map(&:projects)
24
+ end
25
+
26
+ # @return [Avm::Launcher::Instances::Base, nil]
27
+ def self_project
28
+ return nil unless logical_path.project?
29
+
30
+ ::Avm::Launcher::Instances::Base.instanciate(logical_path,
31
+ parent_project)
32
+ end
33
+
34
+ # @param sub [Avm::Sources::base]
35
+ # @return [Avm::Launcher::Context::InstanceDiscovery::SourceWrapper]
36
+ def sub_wrapper(sub)
37
+ ::Avm::Launcher::Context::InstanceDiscovery::SourceWrapper.new(
38
+ owner,
39
+ logical_path.build_child(sub.relative_path),
40
+ parent_project_for_sub
41
+ )
42
+ end
43
+
44
+ # @return [Enumerable<Avm::Launcher::Instances::Base>]
45
+ def subs
46
+ warped_source.subs.map { |sub| sub_wrapper(sub) }
47
+ rescue StandardError => e
48
+ warn("#{logical_path}: #{e}")
49
+ []
50
+ end
51
+
52
+ protected
53
+
54
+ # @return [Avm::Sources::Base]
55
+ def warped_source_uncached
56
+ ::Avm::Registry.sources.detect(logical_path.warped)
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -17,33 +17,7 @@ module Avm
17
17
 
18
18
  # @return [Array<Avm::Launcher::Instances::Base>]
19
19
  def instances_uncached
20
- root_instance_paths.flat_map { |path| path_instances(path, nil) }
21
- end
22
-
23
- # @param path [Avm::Launcher::Paths::Logical]
24
- # @param parent_instance [Avm::Launcher::Instances::Base]
25
- # @return [Array<Avm::Launcher::Instances::Base>]
26
- def path_instances(path, parent_instance)
27
- on_rescued_path_instances(path) do |r|
28
- if path.project?
29
- parent_instance = ::Avm::Launcher::Instances::Base.instanciate(path, parent_instance)
30
- r << path
31
- end
32
- children = path.children
33
- r.concat(children.flat_map { |c| path_instances(c, parent_instance) })
34
- end
35
- end
36
-
37
- # @param path [Avm::Launcher::Paths::Logical]
38
- # @return [Array<Avm::Launcher::Instances::Base>]
39
- def on_rescued_path_instances(path)
40
- r = []
41
- begin
42
- yield(r) if path.included?
43
- rescue StandardError => e
44
- warn("#{path}: #{e}")
45
- end
46
- r
20
+ root_source_wrappers.flat_map(&:projects)
47
21
  end
48
22
 
49
23
  require_sub __FILE__, require_mode: :kernel
@@ -31,6 +31,17 @@ module Avm
31
31
  stereotypes.any?
32
32
  end
33
33
 
34
+ # @param name [String]
35
+ # @return [Avm::Launcher::Paths::Logical]
36
+ def build_child(name)
37
+ ::Avm::Launcher::Paths::Logical.new(
38
+ context,
39
+ self,
40
+ ::File.join(warped, name),
41
+ ::File.join(logical, name)
42
+ )
43
+ end
44
+
34
45
  def children
35
46
  r = []
36
47
  Dir.entries(warped).each do |c|
@@ -53,15 +64,6 @@ module Avm
53
64
  ::Avm::Launcher::Stereotype.stereotypes.select { |s| s.match?(self) } # rubocop:disable Style/SelectByRegexp
54
65
  end
55
66
 
56
- def build_child(name)
57
- ::Avm::Launcher::Paths::Logical.new(
58
- context,
59
- self,
60
- ::File.join(warped, name),
61
- ::File.join(logical, name)
62
- )
63
- end
64
-
65
67
  def warped_uncached
66
68
  if is_a?(::Avm::Launcher::Instances::Base)
67
69
  stereotypes.each do |s|
@@ -23,8 +23,8 @@ module Avm
23
23
 
24
24
  attr_accessor :cache
25
25
 
26
- def on_cache(&block)
27
- cache.present? ? on_cache_with_cache(&block) : on_cache_with_no_cache(&block)
26
+ def on_cache(&)
27
+ cache.present? ? on_cache_with_cache(&) : on_cache_with_no_cache(&)
28
28
  end
29
29
 
30
30
  def on_cache_with_cache(&block)
@@ -17,6 +17,19 @@ module Avm
17
17
  path.to_pathname.to_path
18
18
  end
19
19
 
20
+ # @param repos [Avm::Git::Launcher::Base]
21
+ # @param subpath [String]
22
+ # @param content [String]
23
+ def commit_file(repos, subpath, content)
24
+ require 'fileutils'
25
+ repos.subpath(subpath).then do |file_path|
26
+ FileUtils.mkdir_p(File.dirname(file_path))
27
+ ::File.write(file_path, content)
28
+ repos.execute!('add', file_path)
29
+ repos.execute!('commit', '-m', subpath)
30
+ end
31
+ end
32
+
20
33
  # @param settings_path [Pathname]
21
34
  # @param projects_root [Pathname]
22
35
  def context_set(settings_path, projects_root)
@@ -79,12 +92,10 @@ module Avm
79
92
  '../../../template/avm/rspec/launcher_controller'.to_pathname.expand_path(__dir__)
80
93
  end
81
94
 
95
+ # @param repos [Avm::Git::Launcher::Base]
96
+ # @param subpath [String]
82
97
  def touch_commit(repos, subpath)
83
- require 'fileutils'
84
- FileUtils.mkdir_p(File.dirname(repos.subpath(subpath)))
85
- FileUtils.touch(repos.subpath(subpath))
86
- repos.execute!('add', repos.subpath(subpath))
87
- repos.execute!('commit', '-m', subpath)
98
+ commit_file(repos, subpath, '')
88
99
  end
89
100
  end
90
101
  end
@@ -5,9 +5,9 @@ RSpec.shared_context 'with_launcher' do
5
5
 
6
6
  before do
7
7
  Avm::Launcher::Context.current = launcher_controller.new_context
8
- launcher_controller.remotes_dir = Dir.mktmpdir
8
+ launcher_controller.remotes_dir = temp_dir
9
9
  end
10
10
 
11
- delegate :application_source_path, :context_set, :init_git, :init_remote, :temp_context,
12
- :projects_root, :projects_root=, :touch_commit, to: :launcher_controller
11
+ delegate :application_source_path, :commit_file, :context_set, :init_git, :init_remote,
12
+ :temp_context, :projects_root, :projects_root=, :touch_commit, to: :launcher_controller
13
13
  end
@@ -10,7 +10,7 @@ module Avm
10
10
  end
11
11
 
12
12
  ISSUE_POINTER_NAME_PREFIX = 'issue_'
13
- POINTER_NAME_TO_ISSUE_PATTERN = /\A#{Regexp.quote(ISSUE_POINTER_NAME_PREFIX)}(\d+)\z/.freeze
13
+ POINTER_NAME_TO_ISSUE_PATTERN = /\A#{Regexp.quote(ISSUE_POINTER_NAME_PREFIX)}(\d+)\z/
14
14
  POINTER_NAME_TO_ISSUE_PARSER = POINTER_NAME_TO_ISSUE_PATTERN.to_parser { |m| m[1] }
15
15
 
16
16
  # @return [String, nil]
@@ -8,8 +8,8 @@ module Avm
8
8
 
9
9
  alias immutable_option option
10
10
 
11
- def option(*args)
12
- immutable_option(::Avm::SourceGenerators::Option.new(*args))
11
+ def option(*)
12
+ immutable_option(::Avm::SourceGenerators::Option.new(*))
13
13
  end
14
14
 
15
15
  # @return [Hash<Symbol, String>]
@@ -6,8 +6,8 @@ module Avm
6
6
  module Testing
7
7
  DEFAULT_TEST_COMMANDS = {}.freeze
8
8
  TEST_KEY = 'test'
9
- TEST_COMMAND_KEY = "#{TEST_KEY}.command"
10
- TEST_COMMANDS_KEY = "#{TEST_KEY}.commands"
9
+ TEST_COMMAND_KEY = "#{TEST_KEY}.command".freeze
10
+ TEST_COMMANDS_KEY = "#{TEST_KEY}.commands".freeze
11
11
 
12
12
  def configured_test_command
13
13
  read_configuration_as_env_command(TEST_COMMAND_KEY)
data/lib/avm/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.100.0'
4
+ VERSION = '0.101.0'
5
5
  end
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.license = 'MIT'
15
15
 
16
16
  s.files = Dir['{exe,lib}/**/*', 'Gemfile', 'MIT-LICENSE', 'README.rdoc']
17
- s.required_ruby_version = '>= 2.7.0'
17
+ s.required_ruby_version = '>= 3.2'
18
18
  s.bindir = 'exe'
19
19
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
 
@@ -12,5 +12,5 @@ Gem::Specification.new do |s|
12
12
  s.authors = ['Esquilo Azul Company']
13
13
  s.summary = 'Ruby gem stub for tests.'
14
14
  s.files = Dir['{lib}/**/*']
15
- s.required_ruby_version = '>= 2.7.0'
15
+ s.required_ruby_version = '>= 3.2'
16
16
  end
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.100.0
4
+ version: 0.101.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: 2026-04-30 00:00:00.000000000 Z
11
+ date: 2026-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eac_cli
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.46'
19
+ version: '0.47'
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.46'
26
+ version: '0.47'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: eac_config
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -61,7 +61,7 @@ dependencies:
61
61
  version: '0.20'
62
62
  - - ">="
63
63
  - !ruby/object:Gem::Version
64
- version: 0.20.1
64
+ version: 0.20.2
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
@@ -71,21 +71,21 @@ dependencies:
71
71
  version: '0.20'
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
- version: 0.20.1
74
+ version: 0.20.2
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: eac_ruby_utils
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '0.130'
81
+ version: '0.131'
82
82
  type: :runtime
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: '0.130'
88
+ version: '0.131'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: eac_templates
91
91
  requirement: !ruby/object:Gem::Requirement
@@ -132,14 +132,20 @@ dependencies:
132
132
  requirements:
133
133
  - - "~>"
134
134
  - !ruby/object:Gem::Version
135
- version: '0.40'
135
+ version: '0.41'
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 0.41.1
136
139
  type: :development
137
140
  prerelease: false
138
141
  version_requirements: !ruby/object:Gem::Requirement
139
142
  requirements:
140
143
  - - "~>"
141
144
  - !ruby/object:Gem::Version
142
- version: '0.40'
145
+ version: '0.41'
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ version: 0.41.1
143
149
  - !ruby/object:Gem::Dependency
144
150
  name: avm-git
145
151
  requirement: !ruby/object:Gem::Requirement
@@ -166,20 +172,14 @@ dependencies:
166
172
  requirements:
167
173
  - - "~>"
168
174
  - !ruby/object:Gem::Version
169
- version: '0.12'
170
- - - ">="
171
- - !ruby/object:Gem::Version
172
- version: 0.12.2
175
+ version: '0.13'
173
176
  type: :development
174
177
  prerelease: false
175
178
  version_requirements: !ruby/object:Gem::Requirement
176
179
  requirements:
177
180
  - - "~>"
178
181
  - !ruby/object:Gem::Version
179
- version: '0.12'
180
- - - ">="
181
- - !ruby/object:Gem::Version
182
- version: 0.12.2
182
+ version: '0.13'
183
183
  description:
184
184
  email:
185
185
  executables: []
@@ -277,7 +277,9 @@ files:
277
277
  - lib/avm/launcher/context.rb
278
278
  - lib/avm/launcher/context/instance_collector.rb
279
279
  - lib/avm/launcher/context/instance_discovery.rb
280
- - lib/avm/launcher/context/instance_discovery/root_instance_paths.rb
280
+ - lib/avm/launcher/context/instance_discovery/root_source_wrappers.rb
281
+ - lib/avm/launcher/context/instance_discovery/root_sources.rb
282
+ - lib/avm/launcher/context/instance_discovery/source_wrapper.rb
281
283
  - lib/avm/launcher/context/instance_manager.rb
282
284
  - lib/avm/launcher/context/instance_manager/cached_instance.rb
283
285
  - lib/avm/launcher/context/instance_manager/cached_instances.rb
@@ -418,7 +420,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
418
420
  requirements:
419
421
  - - ">="
420
422
  - !ruby/object:Gem::Version
421
- version: '2.7'
423
+ version: '3.2'
422
424
  required_rubygems_version: !ruby/object:Gem::Requirement
423
425
  requirements:
424
426
  - - ">="