avm 0.35.1 → 0.38.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: 4ebc7e5eed486245f3a85a5dba5ecaa430af32cc398b9ef8fffd7c111cab8dd6
4
- data.tar.gz: bfc1ad0135ec283b838820e3e002e465a2f2770ab848909d7c04cb3ed2ebc92f
3
+ metadata.gz: dc4f65ada3e6c902df6d77b491ac3a043e6ebb7fc93812873fb6d2d7b0d50624
4
+ data.tar.gz: 5dfb61ddeed3edb2c55f98133e281a18aa28f7024e69f2e1942b3fccc03453a1
5
5
  SHA512:
6
- metadata.gz: 1059898047cbf217a4b7e21f9e18d18ba9a6a8f81216803c27cab4b87654ce4fbeffb044aeebb7a1b92931add5e69264fa9fcdbb7683aa75837e38464d3fe80f
7
- data.tar.gz: 3998adffe3154008f6b0fd14234d1d400a1efe437e132ecd032076b665054d27b26dde8fe62d5f058f507cf9b5470d46d88470bcbbd2a4a557859ccb295f35b4
6
+ metadata.gz: 142224b13cfcf3129c0fb24650724af9e66d892247668fb249e526fb9b050df749f0da51c1d0de95106ef85bceae03f563ca93adcf41f2464327cae6153341a0
7
+ data.tar.gz: 8968321777cca2c10902856df6bb9654f98d7e4b84a9c5781c741ef2483e9b1ca5283d281288c9351f34de83bb7e22992894c611059985d8359fcf42b1fd92a7
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/entries/uri_builder'
4
+ require 'eac_config/entry_path'
5
+ require 'eac_ruby_utils/core_ext'
6
+
7
+ module Avm
8
+ module Entries
9
+ module Base
10
+ class UriComponentEntryValue
11
+ enable_method_class
12
+ common_constructor :entries_provider, :component_entry_path do
13
+ self.component_entry_path = ::EacConfig::EntryPath.assert(component_entry_path)
14
+ end
15
+
16
+ def inherited_result
17
+ entries_provider.inherited_entry_value(
18
+ id_entry_path.to_string,
19
+ component_entry_path.to_string
20
+ )
21
+ end
22
+
23
+ # @return [EacConfig::EntryPath]
24
+ def id_entry_path
25
+ root_entry_path + %w[id]
26
+ end
27
+
28
+ # @return [String, nil]
29
+ def result
30
+ if url_entry.context_found?
31
+ return ::Avm::Entries::UriBuilder.from_source(url_entry.value.to_uri)
32
+ .avm_field_get(component)
33
+ end
34
+
35
+ inherited_result
36
+ end
37
+
38
+ # @return [EacConfig::EntryPath]
39
+ def root_entry_path
40
+ component_entry_path[0..-2]
41
+ end
42
+
43
+ # @return [Avm::Entries::Entry]
44
+ def url_entry
45
+ entries_provider.entry((root_entry_path + %w[url]).to_string)
46
+ end
47
+
48
+ # @return [String]
49
+ def component
50
+ component_entry_path.last
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -6,6 +6,8 @@ require 'avm/entries/entry'
6
6
  module Avm
7
7
  module Entries
8
8
  module Base
9
+ require_sub __FILE__, require_dependency: true
10
+
9
11
  def entries_provider_id
10
12
  id
11
13
  end
@@ -10,7 +10,16 @@ module Avm
10
10
  common_constructor :parent, :suffix, :options
11
11
 
12
12
  def auto_value
13
- ::Avm::Entries::AutoValues::Entry.new(parent, suffix).value
13
+ auto_value_entry.value
14
+ end
15
+
16
+ def auto_value_entry
17
+ @auto_value_entry ||= ::Avm::Entries::AutoValues::Entry.new(parent, suffix)
18
+ end
19
+
20
+ # @return [Boolean]
21
+ def context_found?
22
+ context_entry.found?
14
23
  end
15
24
 
16
25
  def full_path
@@ -42,6 +42,10 @@ module Avm
42
42
 
43
43
  common_constructor :data, default: [{}]
44
44
 
45
+ def avm_field_get(avm_field)
46
+ field_get(translate_field(avm_field))
47
+ end
48
+
45
49
  def field_get(name)
46
50
  data[name.to_sym].if_present(&:to_s)
47
51
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/entries/uri_builder'
3
4
  require 'avm/instances/entry_keys'
4
5
 
5
6
  module Avm
@@ -13,19 +14,10 @@ module Avm
13
14
  read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_USERNAME)
14
15
  end
15
16
 
16
- def auto_install_hostname
17
- inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
18
- ::Avm::Instances::EntryKeys::INSTALL_HOSTNAME)
19
- end
20
-
21
- def auto_install_port
22
- inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
23
- ::Avm::Instances::EntryKeys::INSTALL_PORT) || 22
24
- end
25
-
26
- def auto_install_username
27
- inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
28
- ::Avm::Instances::EntryKeys::INSTALL_USERNAME)
17
+ ::Avm::Entries::UriBuilder::ENTRIES_FIELDS.each do |component|
18
+ define_method "auto_install_#{component}" do
19
+ uri_component_entry_value("install.#{component}")
20
+ end
29
21
  end
30
22
 
31
23
  def auto_install_url
@@ -53,7 +53,7 @@ module Avm
53
53
  def host_env_uncached
54
54
  install_uri = entry(::Avm::Instances::EntryKeys::INSTALL_URL).value.to_uri
55
55
  case install_uri.scheme
56
- when 'local' then ::EacRubyUtils::Envs.local
56
+ when 'file' then ::EacRubyUtils::Envs.local
57
57
  when 'ssh' then ::EacRubyUtils::Envs.ssh(install_uri)
58
58
  else raise("Unmapped access value: \"#{install_uri}\"")
59
59
  end
@@ -1,11 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/entries/uri_builder'
3
4
  require 'eac_ruby_utils/core_ext'
4
5
 
5
6
  module Avm
6
7
  module Instances
7
8
  module EntryKeys
8
- URI_FIELDS = %i[fragment hostname password path port query scheme url username].freeze
9
+ URI_FIELDS = ::Avm::Entries::UriBuilder::ENTRIES_FIELDS + %w[url]
9
10
 
10
11
  class << self
11
12
  def all
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/applications/base'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Sources
8
+ class Base
9
+ module Application
10
+ APPLICATION_NAME_KEY = 'application'
11
+
12
+ # @return [Avm::Applications::Base]
13
+ def application
14
+ @application ||= ::Avm::Applications::Base.new(application_id)
15
+ end
16
+
17
+ # @return [String]
18
+ def application_id
19
+ application_id_by_configuration || application_id_by_directory
20
+ end
21
+
22
+ # @return [String, nil]
23
+ def application_id_by_configuration
24
+ configuration.entry(APPLICATION_NAME_KEY).value
25
+ end
26
+
27
+ # @return [String]
28
+ def application_id_by_directory
29
+ path.basename.to_path
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -24,6 +24,8 @@ module Avm
24
24
 
25
25
  # @return [EacRubyUtils::Envs::Command, nil]
26
26
  def configuration_value_to_env_command(value)
27
+ return value if value.is_a?(::EacRubyUtils::Envs::Command)
28
+
27
29
  configuration_value_to_shell_words(value).if_present { |v| env.command(v).chdir(path) }
28
30
  end
29
31
 
@@ -57,7 +57,7 @@ module Avm
57
57
 
58
58
  def configured_enumerable_value_as_test_commands(value)
59
59
  configured_hash_value_as_test_commands(
60
- value.each_with_index.map { |v| ["test_#{v[1]}", v[0]] }.to_h
60
+ value.each_with_index.map { |v, i| ["test_#{i}", v] }.to_h
61
61
  )
62
62
  end
63
63
 
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.35.1'
4
+ VERSION = '0.38.0'
5
5
  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.35.1
4
+ version: 0.38.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-08-11 00:00:00.000000000 Z
11
+ date: 2022-08-16 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.10'
39
+ version: '0.11'
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.10'
46
+ version: '0.11'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: eac_docker
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -73,7 +73,7 @@ dependencies:
73
73
  version: '0.12'
74
74
  - - ">="
75
75
  - !ruby/object:Gem::Version
76
- version: 0.12.1
76
+ version: 0.12.2
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
@@ -83,21 +83,21 @@ dependencies:
83
83
  version: '0.12'
84
84
  - - ">="
85
85
  - !ruby/object:Gem::Version
86
- version: 0.12.1
86
+ version: 0.12.2
87
87
  - !ruby/object:Gem::Dependency
88
88
  name: eac_ruby_utils
89
89
  requirement: !ruby/object:Gem::Requirement
90
90
  requirements:
91
91
  - - "~>"
92
92
  - !ruby/object:Gem::Version
93
- version: '0.98'
93
+ version: '0.100'
94
94
  type: :runtime
95
95
  prerelease: false
96
96
  version_requirements: !ruby/object:Gem::Requirement
97
97
  requirements:
98
98
  - - "~>"
99
99
  - !ruby/object:Gem::Version
100
- version: '0.98'
100
+ version: '0.100'
101
101
  - !ruby/object:Gem::Dependency
102
102
  name: eac_templates
103
103
  requirement: !ruby/object:Gem::Requirement
@@ -230,6 +230,7 @@ files:
230
230
  - lib/avm/entries/auto_values/entry.rb
231
231
  - lib/avm/entries/auto_values/uri_entry.rb
232
232
  - lib/avm/entries/base.rb
233
+ - lib/avm/entries/base/uri_component_entry_value.rb
233
234
  - lib/avm/entries/entry.rb
234
235
  - lib/avm/entries/uri_builder.rb
235
236
  - lib/avm/executables.rb
@@ -290,6 +291,7 @@ files:
290
291
  - lib/avm/source_generators/runner.rb
291
292
  - lib/avm/sources.rb
292
293
  - lib/avm/sources/base.rb
294
+ - lib/avm/sources/base/application.rb
293
295
  - lib/avm/sources/base/configuration.rb
294
296
  - lib/avm/sources/base/instance.rb
295
297
  - lib/avm/sources/base/locale.rb