avm 0.30.0 → 0.33.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: 056fb39001835d22921692f1801a184d8b94852259e282520eb992ce5ffa29f4
4
- data.tar.gz: 4f951bd5a35dfe20f25c27f67e7c6ee6c1db3cc4a6d9a8529d614b57bd655cee
3
+ metadata.gz: a138a71c9d6253cf06cb24540bdb765dff78cea3cd9a93689952bdb60795833e
4
+ data.tar.gz: fa16c54d070882c7c3babda535010f0cfd66727a6c126e65a0b7da58b7e328d3
5
5
  SHA512:
6
- metadata.gz: 69a12b474da5a2aa07e41250569f4ce0786e51800958157b6d437a74480f5244e5f2846ca7b8ee2c495a5907adf8c7d289f7eef8e313244cc8ccc8f2066ef29e
7
- data.tar.gz: a52eb72873f40f8fe55ed3009ecb3b3914512f8a17159f1dbed1aeda3383d76911947c7eef2ccb7a33af1a3c8294ee0767f18a6dc4a03cf78a8faa1f9f998325
6
+ metadata.gz: 9bf6e089f8eba0bfed6ad0783c28948d1ee2653f3940c879e8e1d6451ff49009f639dff737c606e5d5baafd45108cf645b8dcc772481f2fb116f73cbb90586b1
7
+ data.tar.gz: fd7986157d7b494b934ebe1d491040252d2b2a73cc000eba1b25e29bbf26bc935a9ab07b54ab8e5fca0a42fefbea4ee7e82820c635d990d5194b6e44976ec288
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/instances/entries'
3
+ require 'avm/entries/base'
4
4
  require 'avm/registry'
5
5
  require 'eac_ruby_utils/core_ext'
6
6
 
@@ -9,7 +9,7 @@ module Avm
9
9
  class Base
10
10
  enable_simple_cache
11
11
  require_sub __FILE__, include_modules: true
12
- include ::Avm::Instances::Entries
12
+ include ::Avm::Entries::Base
13
13
 
14
14
  LOCAL_INSTANCE_SUFFIX = 'dev'
15
15
 
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_config/node'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Entries
8
+ module AutoValues
9
+ class Entry
10
+ class << self
11
+ def auto_value_method_name(suffix)
12
+ "auto_#{suffix.to_s.gsub('.', '_')}"
13
+ end
14
+ end
15
+
16
+ common_constructor :entries_provider, :suffix
17
+
18
+ def auto_value_method
19
+ self.class.auto_value_method_name(suffix)
20
+ end
21
+
22
+ def found?
23
+ entries_provider.respond_to?(auto_value_method, true)
24
+ end
25
+
26
+ def value
27
+ entries_provider.if_respond(auto_value_method)
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Entries
7
+ module AutoValues
8
+ require_sub __FILE__
9
+ end
10
+ end
11
+ end
@@ -1,17 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/core_ext'
4
- require 'avm/instances/entry'
4
+ require 'avm/entries/entry'
5
5
 
6
6
  module Avm
7
- module Instances
8
- module Entries
7
+ module Entries
8
+ module Base
9
+ def entries_provider_id
10
+ id
11
+ end
12
+
9
13
  def entry(suffix, options = {})
10
- ::Avm::Instances::Entry.new(self, suffix, options)
14
+ ::Avm::Entries::Entry.new(self, suffix, options)
11
15
  end
12
16
 
13
17
  def path_prefix
14
- @path_prefix ||= [id].freeze
18
+ @path_prefix ||= [entries_provider_id].freeze
15
19
  end
16
20
 
17
21
  def read_entry(entry_suffix, options = {})
@@ -1,25 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/entries/auto_values/entry'
3
4
  require 'eac_config/node'
4
5
  require 'eac_ruby_utils/core_ext'
5
6
 
6
7
  module Avm
7
- module Instances
8
+ module Entries
8
9
  class Entry
9
- class << self
10
- def auto_value_method_name(suffix)
11
- "auto_#{suffix.to_s.gsub('.', '_')}"
12
- end
13
- end
14
-
15
10
  common_constructor :parent, :suffix, :options
16
11
 
17
12
  def auto_value
18
- parent.respond_to?(auto_value_method, true) ? parent.send(auto_value_method) : nil
19
- end
20
-
21
- def auto_value_method
22
- self.class.auto_value_method_name(suffix)
13
+ ::Avm::Entries::AutoValues::Entry.new(parent, suffix).value
23
14
  end
24
15
 
25
16
  def full_path
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Entries
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -6,11 +6,11 @@ module Avm
6
6
  module AutoValues
7
7
  module Admin
8
8
  def auto_admin_email
9
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'admin.email')
9
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID, 'admin.email')
10
10
  end
11
11
 
12
12
  def auto_admin_name
13
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'admin.name')
13
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID, 'admin.name')
14
14
  end
15
15
  end
16
16
  end
@@ -61,7 +61,7 @@ module Avm
61
61
  def database_auto_common(suffix)
62
62
  database_key = ::Avm::Instances::EntryKeys.const_get("database_#{suffix}".upcase)
63
63
  inherited_entry_value(::Avm::Instances::EntryKeys::DATABASE_ID, database_key) ||
64
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, database_key)
64
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID, database_key)
65
65
  end
66
66
 
67
67
  def database_port_by_system
@@ -8,29 +8,30 @@ module Avm
8
8
  module AutoValues
9
9
  module Filesystem
10
10
  def auto_fs_path
11
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID,
11
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
12
12
  ::Avm::Instances::EntryKeys::FS_PATH) { |v| v + '/' + id }
13
13
  end
14
14
 
15
15
  def auto_data_fs_path
16
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID,
16
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
17
17
  ::Avm::Instances::EntryKeys::DATA_FS_PATH) { |v| v + '/' + id }
18
18
  end
19
19
 
20
20
  def auto_fs_url
21
- auto_fs_url_with_ssh || auto_fs_url_without_ssh
21
+ auto_fs_url_with_install || auto_fs_url_without_install
22
22
  end
23
23
 
24
- def auto_fs_url_with_ssh
25
- read_entry_optional('ssh.url').if_present do |ssh_url|
24
+ def auto_fs_url_with_install
25
+ read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_URL)
26
+ .if_present do |install_url|
26
27
  read_entry_optional('fs_path').if_present do |fs_path|
27
- "#{ssh_url}#{fs_path}"
28
+ "#{install_url}#{fs_path}"
28
29
  end
29
30
  end
30
31
  end
31
32
 
32
- def auto_fs_url_without_ssh
33
- return nil if read_entry_optional('ssh.url').present?
33
+ def auto_fs_url_without_install
34
+ return nil if read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_URL).present?
34
35
 
35
36
  read_entry_optional('fs_path').if_present do |fs_path|
36
37
  "file://#{fs_path}"
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/entry_keys'
4
+
5
+ module Avm
6
+ module Instances
7
+ class Base
8
+ module AutoValues
9
+ module Install
10
+ def auto_access
11
+ read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_URL).present? ? 'ssh' : 'local'
12
+ end
13
+
14
+ def auto_install_hostname
15
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
16
+ ::Avm::Instances::EntryKeys::INSTALL_HOSTNAME)
17
+ end
18
+
19
+ def auto_install_port
20
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
21
+ ::Avm::Instances::EntryKeys::INSTALL_PORT) || 22
22
+ end
23
+
24
+ def auto_install_username
25
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
26
+ ::Avm::Instances::EntryKeys::INSTALL_USERNAME)
27
+ end
28
+
29
+ def auto_install_url
30
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
31
+ ::Avm::Instances::EntryKeys::INSTALL_URL) ||
32
+ auto_install_url_by_parts
33
+ end
34
+
35
+ def auto_install_url_by_parts
36
+ read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_HOSTNAME).if_present do |a|
37
+ a = read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_USERNAME)
38
+ .if_present(a) { |v| "#{v}@#{a}" }
39
+ a = read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_PORT)
40
+ .if_present(a) { |v| "#{a}:#{v}" }
41
+ "ssh://#{a}"
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/instances/entry'
3
+ require 'avm/entries/auto_values/entry'
4
+ require 'avm/entries/entry'
4
5
  require 'avm/instances/entry_keys'
5
6
 
6
7
  module Avm
@@ -11,15 +12,15 @@ module Avm
11
12
  ::Avm::Instances::EntryKeys.all.select { |c| c.to_s.start_with?('mailer.') }
12
13
  .reject { |c| c == ::Avm::Instances::EntryKeys::MAILER_ID }
13
14
  .each do |mailer_key|
14
- define_method ::Avm::Instances::Entry.auto_value_method_name(mailer_key) do
15
+ define_method ::Avm::Entries::AutoValues::Entry.auto_value_method_name(mailer_key) do
15
16
  mailer_auto_common(mailer_key)
16
17
  end
17
18
  end
18
19
 
19
20
  def auto_mailer_id
20
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID,
21
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
21
22
  ::Avm::Instances::EntryKeys::MAILER_ID) ||
22
- read_entry_optional(::Avm::Instances::EntryKeys::HOST_ID)
23
+ read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_ID)
23
24
  end
24
25
 
25
26
  private
@@ -6,7 +6,7 @@ module Avm
6
6
  module AutoValues
7
7
  module Ruby
8
8
  def auto_ruby_version
9
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'ruby.version')
9
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID, 'ruby.version')
10
10
  end
11
11
  end
12
12
  end
@@ -8,12 +8,12 @@ module Avm
8
8
  module AutoValues
9
9
  module System
10
10
  def auto_system_username
11
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'system.username') ||
12
- read_entry_optional('ssh.username')
11
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID, 'system.username') ||
12
+ read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_USERNAME)
13
13
  end
14
14
 
15
15
  def auto_system_groupname
16
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'system.groupname') ||
16
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID, 'system.groupname') ||
17
17
  read_entry_optional('system.username')
18
18
  end
19
19
  end
@@ -1,16 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/require_sub'
4
- ::EacRubyUtils.require_sub(__FILE__)
3
+ require 'eac_ruby_utils/core_ext'
5
4
 
6
5
  module Avm
7
6
  module Instances
8
7
  class Base
9
8
  module AutoValues
10
- extend ::ActiveSupport::Concern
9
+ require_sub __FILE__
11
10
 
12
- included do
13
- %w[Access Admin Data Database Filesystem Mailer Ruby Source System Web]
11
+ common_concern do
12
+ %w[Admin Data Database Filesystem Install Mailer Ruby Source System Web]
14
13
  .each do |class_name|
15
14
  include const_get(class_name)
16
15
  end
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/with_application_stereotype'
4
- require 'avm/with_dynamic_runners'
3
+ require 'avm/with/application_stereotype'
4
+ require 'avm/with/extra_subcommands'
5
5
  require 'eac_ruby_utils/require_sub'
6
6
  require 'eac_ruby_utils/simple_cache'
7
- require 'avm/instances/entries'
7
+ require 'avm/entries/base'
8
8
 
9
9
  module Avm
10
10
  module Instances
@@ -13,9 +13,9 @@ module Avm
13
13
  enable_listable
14
14
  enable_simple_cache
15
15
  require_sub __FILE__, include_modules: true
16
- include ::Avm::Instances::Entries
17
- include ::Avm::WithDynamicRunners
18
- include ::Avm::WithApplicationStereotype
16
+ include ::Avm::Entries::Base
17
+ include ::Avm::With::ExtraSubcommands
18
+ include ::Avm::With::ApplicationStereotype
19
19
 
20
20
  lists.add_string :access, :local, :ssh
21
21
 
@@ -51,11 +51,11 @@ module Avm
51
51
  end
52
52
 
53
53
  def host_env_uncached
54
- access = read_entry(:access, list: ::Avm::Instances::Base.lists.access.values)
55
- case access
54
+ install_uri = entry(::Avm::Instances::EntryKeys::INSTALL_URL).value.to_uri
55
+ case install_uri.scheme
56
56
  when 'local' then ::EacRubyUtils::Envs.local
57
- when 'ssh' then ::EacRubyUtils::Envs.ssh(read_entry('ssh.url'))
58
- else raise("Unmapped access value: \"#{access}\"")
57
+ when 'ssh' then ::EacRubyUtils::Envs.ssh(install_uri)
58
+ else raise("Unmapped access value: \"#{install_uri}\"")
59
59
  end
60
60
  end
61
61
 
@@ -5,6 +5,8 @@ require 'eac_ruby_utils/core_ext'
5
5
  module Avm
6
6
  module Instances
7
7
  module EntryKeys
8
+ URI_FIELDS = %i[fragment hostname password path port query scheme url username].freeze
9
+
8
10
  class << self
9
11
  def all
10
12
  all_keys.to_a
@@ -42,18 +44,17 @@ module Avm
42
44
  end
43
45
 
44
46
  {
45
- '' => %w[data_fs_path fs_path host_id name source_instance_id],
46
- admin: %w[username password api_key],
47
- database: %w[id hostname limit name password port system timeout username extra],
47
+ '' => %w[data_fs_path fs_path name source_instance_id],
48
+ admin: URI_FIELDS + %w[api_key],
49
+ database: URI_FIELDS + %w[id limit name system timeout extra],
48
50
  docker: %w[registry],
49
51
  fs: %w[url],
52
+ install: URI_FIELDS + %w[id],
50
53
  mailer: {
51
54
  '' => %w[id from reply_to],
52
- smtp: %w[address port domain username password authentication openssl_verify_mode
53
- starttls_auto tls]
55
+ smtp: URI_FIELDS + %w[address domain authentication openssl_verify_mode starttls_auto tls]
54
56
  },
55
- ssh: %w[hostname port url username],
56
- web: %w[authority hostname path port scheme url userinfo]
57
+ web: URI_FIELDS + %w[authority userinfo]
57
58
  }.each { |prefix, suffixes| keys_consts_set(prefix, suffixes) }
58
59
  end
59
60
  end
data/lib/avm/instances.rb CHANGED
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'eac_ruby_utils/core_ext'
4
+
3
5
  module Avm
4
6
  module Instances
5
- require 'avm/applications/base'
6
- require 'avm/instances/entries'
7
+ require_sub __FILE__
7
8
  end
8
9
  end
data/lib/avm/scms/base.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/with_application_stereotype'
3
+ require 'avm/with/application_stereotype'
4
4
  require 'eac_ruby_utils/core_ext'
5
5
 
6
6
  module Avm
@@ -8,7 +8,7 @@ module Avm
8
8
  class Base
9
9
  enable_abstract_methods
10
10
  enable_simple_cache
11
- include ::Avm::WithApplicationStereotype
11
+ include ::Avm::With::ApplicationStereotype
12
12
  abstract_methods :update, :valid?
13
13
  common_constructor :path do
14
14
  self.path = path.to_pathname
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/with_application_stereotype'
3
+ require 'avm/with/application_stereotype'
4
4
  require 'eac_ruby_utils/core_ext'
5
5
 
6
6
  module Avm
7
7
  module SourceGenerators
8
8
  class Base
9
- include ::Avm::WithApplicationStereotype
9
+ include ::Avm::With::ApplicationStereotype
10
10
  common_constructor :target_path do
11
11
  self.target_path = target_path.to_pathname
12
12
  end
@@ -2,8 +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
+ require 'avm/with/application_stereotype'
6
+ require 'avm/with/extra_subcommands'
7
7
  require 'eac_git'
8
8
  require 'eac_ruby_utils/core_ext'
9
9
 
@@ -11,8 +11,8 @@ module Avm
11
11
  module Sources
12
12
  class Base
13
13
  require_sub __FILE__, include_modules: true
14
- include ::Avm::WithApplicationStereotype
15
- include ::Avm::WithDynamicRunners
14
+ include ::Avm::With::ApplicationStereotype
15
+ include ::Avm::With::ExtraSubcommands
16
16
  compare_by :path
17
17
  enable_abstract_methods
18
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.30.0'
4
+ VERSION = '0.33.0'
5
5
  end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module With
7
+ module ApplicationStereotype
8
+ common_concern do
9
+ include ClassMethods
10
+ end
11
+
12
+ module ClassMethods
13
+ # @return [Avm::ApplicationStereotype::Base]
14
+ def application_stereotype
15
+ @application_stereotype ||=
16
+ ::Avm::Registry.application_stereotypes.detect(application_stereotype_name)
17
+ end
18
+
19
+ # @return [String]
20
+ def application_stereotype_name
21
+ stereotype_namespace_module.name.demodulize
22
+ end
23
+
24
+ # @return [Module]
25
+ def stereotype_namespace_module
26
+ module_parent.module_parent
27
+ end
28
+ end
29
+
30
+ def stereotype_namespace_module
31
+ self.class.stereotype_namespace_module
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,44 @@
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 With
8
+ module ExtraSubcommands
9
+ # @return [Hash<String, EacCli::Runner>]
10
+ def extra_available_subcommands
11
+ extra_available_subcommands_from_runners_module
12
+ end
13
+
14
+ # @return [Hash<String, EacCli::Runner>]
15
+ def extra_available_subcommands_from_runners_module
16
+ self.class.ancestors.reverse.inject({}) do |a, e|
17
+ a.merge(RunnersFromModule.new(e).result)
18
+ end
19
+ end
20
+
21
+ class RunnersFromModule
22
+ enable_simple_cache
23
+ common_constructor :the_module
24
+
25
+ # @return [Hash<String, EacCli::Runner>]
26
+ def result
27
+ return {} if runners_module.blank?
28
+
29
+ ::EacCli::RunnerWith::Subcommands.subcommands_from_module(runners_module)
30
+ end
31
+
32
+ def runners_module_uncached
33
+ return nil if the_module.module_parent.blank?
34
+
35
+ begin
36
+ the_module.module_parent.const_get('Runners')
37
+ rescue ::NameError
38
+ nil
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ 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.30.0
4
+ version: 0.33.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-27 00:00:00.000000000 Z
11
+ date: 2022-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eac_cli
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0.9'
39
+ version: '0.10'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0.9'
46
+ version: '0.10'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: eac_docker
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -78,14 +78,14 @@ dependencies:
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '0.95'
81
+ version: '0.97'
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.95'
88
+ version: '0.97'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: eac_templates
91
91
  requirement: !ruby/object:Gem::Requirement
@@ -213,15 +213,20 @@ files:
213
213
  - lib/avm/docker/container.rb
214
214
  - lib/avm/docker/image.rb
215
215
  - lib/avm/docker/runner.rb
216
+ - lib/avm/entries.rb
217
+ - lib/avm/entries/auto_values.rb
218
+ - lib/avm/entries/auto_values/entry.rb
219
+ - lib/avm/entries/base.rb
220
+ - lib/avm/entries/entry.rb
216
221
  - lib/avm/executables.rb
217
222
  - lib/avm/instances.rb
218
223
  - lib/avm/instances/base.rb
219
224
  - lib/avm/instances/base/auto_values.rb
220
- - lib/avm/instances/base/auto_values/access.rb
221
225
  - lib/avm/instances/base/auto_values/admin.rb
222
226
  - lib/avm/instances/base/auto_values/data.rb
223
227
  - lib/avm/instances/base/auto_values/database.rb
224
228
  - lib/avm/instances/base/auto_values/filesystem.rb
229
+ - lib/avm/instances/base/auto_values/install.rb
225
230
  - lib/avm/instances/base/auto_values/mailer.rb
226
231
  - lib/avm/instances/base/auto_values/ruby.rb
227
232
  - lib/avm/instances/base/auto_values/source.rb
@@ -230,8 +235,6 @@ files:
230
235
  - lib/avm/instances/base/dockerizable.rb
231
236
  - lib/avm/instances/base/entry_keys.rb
232
237
  - lib/avm/instances/docker_image.rb
233
- - lib/avm/instances/entries.rb
234
- - lib/avm/instances/entry.rb
235
238
  - lib/avm/instances/entry_keys.rb
236
239
  - lib/avm/instances/runner.rb
237
240
  - lib/avm/jobs.rb
@@ -288,8 +291,8 @@ files:
288
291
  - lib/avm/sync.rb
289
292
  - lib/avm/version.rb
290
293
  - lib/avm/version_number.rb
291
- - lib/avm/with_application_stereotype.rb
292
- - lib/avm/with_dynamic_runners.rb
294
+ - lib/avm/with/application_stereotype.rb
295
+ - lib/avm/with/extra_subcommands.rb
293
296
  homepage:
294
297
  licenses: []
295
298
  metadata: {}
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Avm
4
- module Instances
5
- class Base
6
- module AutoValues
7
- module Access
8
- def auto_access
9
- read_entry_optional('ssh.url').present? ? 'ssh' : 'local'
10
- end
11
-
12
- def auto_ssh_hostname
13
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'ssh.hostname')
14
- end
15
-
16
- def auto_ssh_port
17
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'ssh.port') || 22
18
- end
19
-
20
- def auto_ssh_username
21
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'ssh.username')
22
- end
23
-
24
- def auto_ssh_url
25
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'ssh.url') ||
26
- auto_ssh_url_by_parts
27
- end
28
-
29
- def auto_ssh_url_by_parts
30
- read_entry_optional('ssh.hostname').if_present do |a|
31
- a = read_entry_optional('ssh.username').if_present(a) { |v| "#{v}@#{a}" }
32
- a = read_entry_optional('ssh.port').if_present(a) { |v| "#{a}:#{v}" }
33
- "ssh://#{a}"
34
- end
35
- end
36
- end
37
- end
38
- end
39
- end
40
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Avm
6
- module WithApplicationStereotype
7
- common_concern do
8
- include ClassMethods
9
- end
10
-
11
- module ClassMethods
12
- # @return [Avm::ApplicationStereotype::Base]
13
- def application_stereotype
14
- @application_stereotype ||=
15
- ::Avm::Registry.application_stereotypes.detect(application_stereotype_name)
16
- end
17
-
18
- # @return [String]
19
- def application_stereotype_name
20
- stereotype_namespace_module.name.demodulize
21
- end
22
-
23
- # @return [Module]
24
- def stereotype_namespace_module
25
- module_parent.module_parent
26
- end
27
- end
28
-
29
- def stereotype_namespace_module
30
- self.class.stereotype_namespace_module
31
- end
32
- end
33
- end
@@ -1,42 +0,0 @@
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