avm 0.26.0 → 0.29.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 409db17d04ee296956e9770e61a5f65919fbf2b0c8bea4efae0ed68fb169572a
4
- data.tar.gz: 3c7e6ea386a2527ed86c3bb9ef8a71b1767d17a204d48b1ecc3b74c015772328
3
+ metadata.gz: 2c59abe8a0046009874c49f168a3fba854d33721aaaf0bfbb95d96c0556c9aae
4
+ data.tar.gz: 8308f974d093782ed03f490365580fa4e5c838cd55da3c76fd4edf6972f59ccf
5
5
  SHA512:
6
- metadata.gz: 302b99ff7495bf6c3f4624432e63f1f2668f8b5d2a2ac91bc721f3206baf9595520c192fa4ead326ad7ce3c646253ca7f1a71a48ee1b11080e1898efe4fef5f8
7
- data.tar.gz: 7b85ae2c2a03f3abfeed96924ab6e0180d17709ec422cd3b0638f7075cc750c25a8118d7654554ecfe80519fdeb505da9aa720f2109fdf7bcacfdf7bf884d141
6
+ metadata.gz: 3544c95b8ffef42a7e9c8d1ad9e16f6984c945e861e2d5b0ce48c5744295087d5941dfa3c9191aefd96703762b2704cb630346f109a4c1348560e4361011b3f9
7
+ data.tar.gz: bbe9fb54467880e6b69d3954d79c72cac7cd541a300761ebc8cde38b234e5eead3febc889b81871d8079cf4ba95ec33b781ddf26d2ade447660a1c31e03c7486
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module ApplicationStereotypes
7
+ class Base
8
+ common_constructor :namespace_module, :instance_class, :source_class
9
+
10
+ # @return [String]
11
+ def name
12
+ namespace_module.name.demodulize
13
+ end
14
+
15
+ # @return [String]
16
+ def to_s
17
+ name
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module ApplicationStereotypes
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/registry'
4
+
5
+ module Avm
6
+ module Applications
7
+ class Base
8
+ module Stereotype
9
+ # @return [Avm::ApplicationStereotypes::Base, nil]
10
+ def stereotype_by_configuration
11
+ entry('stereotype').optional_value.if_present do |v|
12
+ ::Avm::Registry.application_stereotypes.detect(v)
13
+ end
14
+ end
15
+
16
+ # @return [Avm::ApplicationStereotypes::Base, nil]
17
+ def stereotype_by_source
18
+ ::Avm::Registry.application_stereotypes.detect_optional(local_source.class)
19
+ end
20
+
21
+ private
22
+
23
+ # @return [Avm::ApplicationStereotypes::Base]
24
+ def stereotype_uncached
25
+ stereotype_by_configuration || stereotype_by_source ||
26
+ raise("Could not find stereotype for application \"#{self}\"")
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/entries'
4
+ require 'avm/registry'
5
+ require 'eac_ruby_utils/core_ext'
6
+
7
+ module Avm
8
+ module Applications
9
+ class Base
10
+ enable_simple_cache
11
+ require_sub __FILE__, include_modules: true
12
+ include ::Avm::Instances::Entries
13
+
14
+ LOCAL_INSTANCE_SUFFIX = 'dev'
15
+
16
+ common_constructor :id do
17
+ self.id = id.to_s
18
+ end
19
+
20
+ def to_s
21
+ id
22
+ end
23
+
24
+ def instance(suffix)
25
+ ::Avm::Instances::Base.new(self, suffix)
26
+ end
27
+
28
+ def name
29
+ entry(::Avm::Instances::EntryKeys::NAME).read
30
+ end
31
+
32
+ private
33
+
34
+ # @return [Avm::Instances::Base]
35
+ def local_instance_uncached
36
+ instance(LOCAL_INSTANCE_SUFFIX)
37
+ end
38
+
39
+ # @return [Avm::Sources::Base]
40
+ def local_source_uncached
41
+ ::Avm::Registry.sources.detect(local_instance.fs_path)
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Applications
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -3,16 +3,26 @@
3
3
  require 'avm/version'
4
4
  require 'eac_ruby_utils/core_ext'
5
5
  require 'eac_docker/images/templatized'
6
+ require 'eac_docker/registry'
6
7
 
7
8
  module Avm
8
9
  module Docker
9
10
  class Image < ::EacDocker::Images::Templatized
11
+ DEFAULT_REGISTRY_NAME = 'local'
12
+
13
+ class << self
14
+ # @return [EacDocker::Registry]
15
+ def default_registry
16
+ ::EacDocker::Registry.new(DEFAULT_REGISTRY_NAME)
17
+ end
18
+ end
19
+
10
20
  attr_reader :registry
11
21
  attr_accessor :snapshot
12
22
  attr_accessor :version
13
23
 
14
- def initialize(registry)
15
- @registry = registry
24
+ def initialize(registry = nil)
25
+ @registry = registry || self.class.default_registry
16
26
  self.snapshot = true
17
27
  self.version = true
18
28
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/with_application_stereotype'
4
+ require 'avm/with_dynamic_runners'
3
5
  require 'eac_ruby_utils/require_sub'
4
6
  require 'eac_ruby_utils/simple_cache'
5
7
  require 'avm/instances/entries'
@@ -7,10 +9,13 @@ require 'avm/instances/entries'
7
9
  module Avm
8
10
  module Instances
9
11
  class Base
12
+ enable_abstract_methods
10
13
  enable_listable
11
14
  enable_simple_cache
12
15
  require_sub __FILE__, include_modules: true
13
16
  include ::Avm::Instances::Entries
17
+ include ::Avm::WithDynamicRunners
18
+ include ::Avm::WithApplicationStereotype
14
19
 
15
20
  lists.add_string :access, :local, :ssh
16
21
 
@@ -19,8 +24,8 @@ module Avm
19
24
  class << self
20
25
  def by_id(id)
21
26
  application_id, suffix = parse_id(id)
22
- require 'avm/instances/application'
23
- new(::Avm::Instances::Application.new(application_id), suffix)
27
+ require 'avm/applications/base'
28
+ new(::Avm::Applications::Base.new(application_id), suffix)
24
29
  end
25
30
 
26
31
  private
data/lib/avm/instances.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Avm
4
4
  module Instances
5
- require 'avm/instances/application'
5
+ require 'avm/applications/base'
6
6
  require 'avm/instances/entries'
7
7
  end
8
8
  end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/registry/application_stereotypes/stereotype_builder'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Registry
8
+ class ApplicationStereotypes
9
+ class BuildAvailable
10
+ enable_method_class
11
+
12
+ common_constructor :owner
13
+
14
+ def result
15
+ reset_buffer
16
+ read_instances_registry
17
+ read_sources_registry
18
+ buffer.values.map(&:build)
19
+ end
20
+
21
+ private
22
+
23
+ attr_accessor :buffer
24
+
25
+ def read_object(type, object)
26
+ buffer[object.stereotype_namespace_module] ||=
27
+ ::Avm::Registry::ApplicationStereotypes::StereotypeBuilder
28
+ .new(object.stereotype_namespace_module)
29
+ buffer[object.stereotype_namespace_module].add_object(type, object)
30
+ end
31
+
32
+ def read_instances_registry
33
+ ::Avm::Registry.instances.available.each { |instance| read_object(:instance, instance) }
34
+ end
35
+
36
+ def read_sources_registry
37
+ ::Avm::Registry.sources.available.each { |source| read_object(:source, source) }
38
+ end
39
+
40
+ def reset_buffer
41
+ self.buffer = {}
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/application_stereotypes/base'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Registry
8
+ class ApplicationStereotypes
9
+ class StereotypeBuilder
10
+ common_constructor :namespace_module
11
+
12
+ def add_object(type, object)
13
+ attr_method = "#{type}_class"
14
+ raise "#{attr_method} is already present" if send(attr_method).present?
15
+
16
+ send("#{attr_method}=", object)
17
+ end
18
+
19
+ # @return [Avm::ApplicationStereotypes::Base]
20
+ def build
21
+ ::Avm::ApplicationStereotypes::Base.new(namespace_module, instance_class, source_class)
22
+ end
23
+
24
+ private
25
+
26
+ attr_accessor :instance_class, :source_class
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/base'
4
+ require 'avm/sources/base'
5
+ require 'eac_ruby_utils/core_ext'
6
+
7
+ module Avm
8
+ module Registry
9
+ class ApplicationStereotypes
10
+ require_sub __FILE__, require_dependency: true
11
+ enable_simple_cache
12
+
13
+ common_constructor :module_suffix
14
+
15
+ def detect(obj)
16
+ detect_optional(obj) || raise_not_found(obj)
17
+ end
18
+
19
+ def detect_optional(obj)
20
+ detect_by_instance_class(obj) || detect_by_source_class(obj) || detecy_by_name(obj)
21
+ end
22
+
23
+ private
24
+
25
+ def available_uncached
26
+ build_available
27
+ end
28
+
29
+ def detect_by_instance_class(obj)
30
+ return nil unless obj.is_a?(::Class) && obj < ::Avm::Instances::Base
31
+
32
+ available.find { |a| a.instance_class == obj }
33
+ end
34
+
35
+ def detecy_by_name(obj)
36
+ return nil unless obj.is_a?(::String)
37
+
38
+ available.find { |a| a.name == obj }
39
+ end
40
+
41
+ def detect_by_source_class(obj)
42
+ return nil unless obj.is_a?(::Class) && obj < ::Avm::Sources::Base
43
+
44
+ available.find { |a| a.source_class == obj }
45
+ end
46
+
47
+ def raise_not_found(obj)
48
+ raise("No registered module valid for #{obj} (Available: #{available.join(', ')})")
49
+ end
50
+ end
51
+ end
52
+ end
@@ -5,18 +5,27 @@ require 'eac_ruby_utils/gems_registry'
5
5
 
6
6
  module Avm
7
7
  module Registry
8
- class Base
8
+ class FromGems
9
+ enable_abstract_methods
9
10
  enable_simple_cache
10
11
  common_constructor :module_suffix
11
12
 
13
+ def available
14
+ registered_modules.reject(&:abstract?)
15
+ end
16
+
17
+ def class_detect(_klass, _detect_args)
18
+ raise_abstract_method __method__
19
+ end
20
+
12
21
  def detect(*registered_initialize_args)
13
22
  detect_optional(*registered_initialize_args) ||
14
23
  raise_not_found(*registered_initialize_args)
15
24
  end
16
25
 
17
26
  def detect_optional(*registered_initialize_args)
18
- registered_modules.reverse.lazy.map { |klass| klass.new(*registered_initialize_args) }
19
- .find(&:valid?)
27
+ available.reverse.lazy
28
+ .map { |klass| class_detect(klass, registered_initialize_args) }.find(&:present?)
20
29
  end
21
30
 
22
31
  def provider_module_suffix
@@ -39,7 +48,7 @@ module Avm
39
48
 
40
49
  def raise_not_found(*args)
41
50
  raise("No registered module valid for #{args}" \
42
- " (Module suffix: #{module_suffix}, Available: #{registered_modules.join(', ')})")
51
+ " (Module suffix: #{module_suffix}, Available: #{available.join(', ')})")
43
52
  end
44
53
 
45
54
  def registered_modules_uncached
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/base'
4
+ require 'avm/registry/from_gems'
5
+
6
+ module Avm
7
+ module Registry
8
+ class Instances < ::Avm::Registry::FromGems
9
+ # @return [Avm::Instances::Base, nil]
10
+ def class_detect(klass, detect_args)
11
+ r = ::Avm::Instances::Base.by_id(*detect_args)
12
+ r.application.stereotype.instance_class == klass ? klass.by_id(*detect_args) : nil
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/registry/from_gems'
4
+
5
+ module Avm
6
+ module Registry
7
+ class Runners < ::Avm::Registry::FromGems
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/registry/with_path'
4
+
5
+ module Avm
6
+ module Registry
7
+ class Scms < ::Avm::Registry::WithPath
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/registry/with_path'
4
+
5
+ module Avm
6
+ module Registry
7
+ class Sources < ::Avm::Registry::WithPath
8
+ end
9
+ end
10
+ end
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/registry/base'
3
+ require 'avm/registry/from_gems'
4
4
  require 'eac_ruby_utils/core_ext'
5
5
 
6
6
  module Avm
7
7
  module Registry
8
- class WithPath < ::Avm::Registry::Base
8
+ class WithPath < ::Avm::Registry::FromGems
9
9
  class Cache
10
10
  enable_simple_cache
11
11
  common_constructor :owner
@@ -1,13 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/registry/base'
3
+ require 'avm/registry/from_gems'
4
4
  require 'eac_ruby_utils/core_ext'
5
5
 
6
6
  module Avm
7
7
  module Registry
8
- class WithPath < ::Avm::Registry::Base
8
+ class WithPath < ::Avm::Registry::FromGems
9
9
  require_sub __FILE__
10
10
 
11
+ # @return [Object, nil]
12
+ def class_detect(klass, detect_args)
13
+ r = klass.new(*detect_args)
14
+ r.valid? ? r : nil
15
+ end
16
+
11
17
  def detect_by_path(path)
12
18
  detect_by_path_optional(path) || raise_not_found(path)
13
19
  end
data/lib/avm/registry.rb CHANGED
@@ -7,14 +7,14 @@ module Avm
7
7
  module Registry
8
8
  require_sub __FILE__
9
9
  enable_listable
10
- lists.add_symbol :category, :instance_stereotypes, :runners, :scms, :sources
10
+ lists.add_symbol :category, :application_stereotypes, :instances, :runners, :scms, :sources
11
11
 
12
12
  WITH_PATH = [CATEGORY_SCMS, CATEGORY_SOURCES].freeze
13
13
 
14
14
  class << self
15
15
  enable_simple_cache
16
16
 
17
- # @return [Array<Avm::Registry::Base>]
17
+ # @return [Array<Avm::Registry::FromGems>]
18
18
  def registries
19
19
  lists.category.values.map { |c| send(c) }
20
20
  end
@@ -28,11 +28,7 @@ module Avm
28
28
  end
29
29
 
30
30
  def registry_class(category)
31
- if WITH_PATH.include?(category)
32
- ::Avm::Registry::WithPath
33
- else
34
- ::Avm::Registry::Base
35
- end
31
+ ::Avm::Registry.const_get(category.to_s.camelize)
36
32
  end
37
33
  end
38
34
  end
@@ -7,7 +7,7 @@ require 'avm/registry'
7
7
  .each do |registry|
8
8
  context "when registry is #{registry}" do
9
9
  it 'is not in the avm registry' do
10
- expect(registry.registered_modules).not_to include(described_class)
10
+ expect(registry.available).not_to include(described_class)
11
11
  end
12
12
  end
13
13
  end
data/lib/avm/scms/base.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/with_application_stereotype'
3
4
  require 'eac_ruby_utils/core_ext'
4
5
 
5
6
  module Avm
@@ -7,6 +8,7 @@ module Avm
7
8
  class Base
8
9
  enable_abstract_methods
9
10
  enable_simple_cache
11
+ include ::Avm::WithApplicationStereotype
10
12
  abstract_methods :update, :valid?
11
13
  common_constructor :path do
12
14
  self.path = path.to_pathname
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/instances/application'
3
+ require 'avm/applications/base'
4
4
  require 'avm/instances/base'
5
5
 
6
6
  module Avm
@@ -16,7 +16,7 @@ module Avm
16
16
  private
17
17
 
18
18
  def application_uncached
19
- ::Avm::Instances::Application.new(path.basename)
19
+ ::Avm::Applications::Base.new(path.basename)
20
20
  end
21
21
 
22
22
  def instance_uncached
@@ -2,6 +2,8 @@
2
2
 
3
3
  require 'avm/registry'
4
4
  require 'avm/scms/null'
5
+ require 'avm/with_application_stereotype'
6
+ require 'avm/with_dynamic_runners'
5
7
  require 'eac_git'
6
8
  require 'eac_ruby_utils/core_ext'
7
9
 
@@ -9,6 +11,8 @@ module Avm
9
11
  module Sources
10
12
  class Base
11
13
  require_sub __FILE__, include_modules: true
14
+ include ::Avm::WithApplicationStereotype
15
+ include ::Avm::WithDynamicRunners
12
16
  compare_by :path
13
17
  enable_abstract_methods
14
18
  enable_simple_cache
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.26.0'
4
+ VERSION = '0.29.0'
5
5
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/runner_with/subcommands'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module WithApplicationStereotype
8
+ common_concern do
9
+ include ClassMethods
10
+ end
11
+
12
+ module ClassMethods
13
+ # @return [Module]
14
+ def stereotype_namespace_module
15
+ module_parent.module_parent
16
+ end
17
+ end
18
+
19
+ def stereotype_namespace_module
20
+ self.class.stereotype_namespace_module
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/runner_with/subcommands'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module WithDynamicRunners
8
+ # @return [Hash<String, EacCli::Runner>]
9
+ def extra_available_subcommands
10
+ extra_available_subcommands_from_runners_module
11
+ end
12
+
13
+ # @return [Hash<String, EacCli::Runner>]
14
+ def extra_available_subcommands_from_runners_module
15
+ self.class.ancestors.reverse.inject({}) do |a, e|
16
+ a.merge(RunnersFromModule.new(e).result)
17
+ end
18
+ end
19
+
20
+ class RunnersFromModule
21
+ enable_simple_cache
22
+ common_constructor :the_module
23
+
24
+ # @return [Hash<String, EacCli::Runner>]
25
+ def result
26
+ return {} if runners_module.blank?
27
+
28
+ ::EacCli::RunnerWith::Subcommands.subcommands_from_module(runners_module)
29
+ end
30
+
31
+ def runners_module_uncached
32
+ return nil if the_module.module_parent.blank?
33
+
34
+ begin
35
+ the_module.module_parent.const_get('Runners')
36
+ rescue ::NameError
37
+ nil
38
+ end
39
+ end
40
+ end
41
+ end
42
+ 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.26.0
4
+ version: 0.29.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: 2022-07-21 00:00:00.000000000 Z
11
+ date: 2022-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eac_cli
@@ -195,6 +195,11 @@ extensions: []
195
195
  extra_rdoc_files: []
196
196
  files:
197
197
  - lib/avm.rb
198
+ - lib/avm/application_stereotypes.rb
199
+ - lib/avm/application_stereotypes/base.rb
200
+ - lib/avm/applications.rb
201
+ - lib/avm/applications/base.rb
202
+ - lib/avm/applications/base/stereotype.rb
198
203
  - lib/avm/data/instance.rb
199
204
  - lib/avm/data/instance/files_unit.rb
200
205
  - lib/avm/data/instance/package.rb
@@ -210,7 +215,6 @@ files:
210
215
  - lib/avm/docker/runner.rb
211
216
  - lib/avm/executables.rb
212
217
  - lib/avm/instances.rb
213
- - lib/avm/instances/application.rb
214
218
  - lib/avm/instances/base.rb
215
219
  - lib/avm/instances/base/auto_values.rb
216
220
  - lib/avm/instances/base/auto_values/access.rb
@@ -239,7 +243,14 @@ files:
239
243
  - lib/avm/launcher/publish/check_result.rb
240
244
  - lib/avm/path_string.rb
241
245
  - lib/avm/registry.rb
242
- - lib/avm/registry/base.rb
246
+ - lib/avm/registry/application_stereotypes.rb
247
+ - lib/avm/registry/application_stereotypes/build_available.rb
248
+ - lib/avm/registry/application_stereotypes/stereotype_builder.rb
249
+ - lib/avm/registry/from_gems.rb
250
+ - lib/avm/registry/instances.rb
251
+ - lib/avm/registry/runners.rb
252
+ - lib/avm/registry/scms.rb
253
+ - lib/avm/registry/sources.rb
243
254
  - lib/avm/registry/with_path.rb
244
255
  - lib/avm/registry/with_path/cache.rb
245
256
  - lib/avm/result.rb
@@ -261,7 +272,6 @@ files:
261
272
  - lib/avm/sources/base/instance.rb
262
273
  - lib/avm/sources/base/locale.rb
263
274
  - lib/avm/sources/base/parent.rb
264
- - lib/avm/sources/base/runners.rb
265
275
  - lib/avm/sources/base/subs.rb
266
276
  - lib/avm/sources/base/subs_paths.rb
267
277
  - lib/avm/sources/base/testing.rb
@@ -275,6 +285,8 @@ files:
275
285
  - lib/avm/sync.rb
276
286
  - lib/avm/version.rb
277
287
  - lib/avm/version_number.rb
288
+ - lib/avm/with_application_stereotype.rb
289
+ - lib/avm/with_dynamic_runners.rb
278
290
  homepage:
279
291
  licenses: []
280
292
  metadata: {}
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/instances/entries'
4
-
5
- module Avm
6
- module Instances
7
- class Application
8
- include ::Avm::Instances::Entries
9
-
10
- attr_reader :id
11
-
12
- def initialize(id)
13
- @id = id.to_s
14
- end
15
-
16
- def to_s
17
- id
18
- end
19
-
20
- def instance(suffix)
21
- ::Avm::Instances::Base.new(self, suffix)
22
- end
23
-
24
- def name
25
- entry(::Avm::Instances::EntryKeys::NAME).read
26
- end
27
- end
28
- end
29
- end
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/sources/base/subs_paths'
4
- require 'eac_cli/runner_with/subcommands'
5
- require 'eac_ruby_utils/core_ext'
6
-
7
- module Avm
8
- module Sources
9
- class Base
10
- module Runners
11
- # @return [Hash<String, EacCli::Runner>]
12
- def extra_available_subcommands
13
- extra_available_subcommands_from_runners_module
14
- end
15
-
16
- # @return [Hash<String, EacCli::Runner>]
17
- def extra_available_subcommands_from_runners_module
18
- self.class.ancestors.reverse.inject({}) do |a, e|
19
- a.merge(RunnersFromModule.new(e).result)
20
- end
21
- end
22
-
23
- class RunnersFromModule
24
- enable_simple_cache
25
- common_constructor :the_module
26
-
27
- # @return [Hash<String, EacCli::Runner>]
28
- def result
29
- return {} if runners_module.blank?
30
-
31
- ::EacCli::RunnerWith::Subcommands.subcommands_from_module(runners_module)
32
- end
33
-
34
- def runners_module_uncached
35
- return nil if the_module.module_parent.blank?
36
-
37
- begin
38
- the_module.module_parent.const_get('Runners')
39
- rescue ::NameError
40
- nil
41
- end
42
- end
43
- end
44
- end
45
- end
46
- end
47
- end