avm 0.36.0 → 0.39.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/entries/base/inherited_entry_value.rb +31 -0
- data/lib/avm/entries/base/uri_component_entry_value.rb +71 -0
- data/lib/avm/entries/base.rb +2 -10
- data/lib/avm/entries/entry.rb +10 -1
- data/lib/avm/entries/uri_builder.rb +4 -0
- data/lib/avm/instances/base/auto_values/filesystem.rb +0 -5
- data/lib/avm/instances/base/auto_values/install.rb +20 -15
- data/lib/avm/instances/entry_keys.rb +4 -3
- data/lib/avm/sources/base/application.rb +34 -0
- data/lib/avm/sources/base/configuration.rb +2 -0
- data/lib/avm/sources/base/testing.rb +1 -1
- data/lib/avm/version.rb +1 -1
- metadata +11 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '04283409a229d111fd5dd3959c88cf29639d209a14632cbb770c1f151f12da7f'
|
4
|
+
data.tar.gz: b38fdf654a75b21da9bbd8f479fc323e4f157f51a04eca7f4a0c581a789dba5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe0ca2eb191f577ed18619c06af5367d6f8885de4ab9c9a7f89790c0722d5f03f1575bed0e61e33865ee12b9ea35d44c0653566428946a8f62c8f6dd4cbff29f
|
7
|
+
data.tar.gz: 131dfd01487f969a5bcc2f8f63a2e34a254312055c4b154640783f50e43d58f20c1054a09ea1d99d5a76f1dcfd6b4f66825dba03be3cde028c74b3320b721d28
|
@@ -0,0 +1,31 @@
|
|
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 InheritedEntryValue
|
11
|
+
enable_method_class
|
12
|
+
common_constructor :entries_provider, :source_entry_suffix, :target_entry_suffix, :block,
|
13
|
+
block_arg: true
|
14
|
+
|
15
|
+
def result
|
16
|
+
self_entry_value.if_present do |instance_id|
|
17
|
+
other_entry_value(instance_id).if_present(&block)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def other_entry_value(instance_id)
|
22
|
+
::Avm::Instances::Base.by_id(instance_id).read_entry_optional(target_entry_suffix)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self_entry_value
|
26
|
+
entries_provider.read_entry_optional(source_entry_suffix)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,71 @@
|
|
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
|
+
|
13
|
+
enable_listable
|
14
|
+
lists.add_symbol :option, :default_value, :inherited_value_block
|
15
|
+
|
16
|
+
common_constructor :entries_provider, :component_entry_path, :options, default: [{}] do
|
17
|
+
self.component_entry_path = ::EacConfig::EntryPath.assert(component_entry_path)
|
18
|
+
self.options = self.class.lists.option.hash_keys_validate!(options)
|
19
|
+
end
|
20
|
+
|
21
|
+
def default_value
|
22
|
+
options[OPTION_DEFAULT_VALUE].call_if_proc
|
23
|
+
end
|
24
|
+
|
25
|
+
def inherited_result
|
26
|
+
entries_provider.inherited_entry_value(
|
27
|
+
id_entry_path.to_string,
|
28
|
+
component_entry_path.to_string,
|
29
|
+
&inherited_value_block
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
def inherited_value_block
|
34
|
+
options[OPTION_INHERITED_VALUE_BLOCK]
|
35
|
+
end
|
36
|
+
|
37
|
+
# @return [EacConfig::EntryPath]
|
38
|
+
def id_entry_path
|
39
|
+
root_entry_path + %w[id]
|
40
|
+
end
|
41
|
+
|
42
|
+
# @return [String, nil]
|
43
|
+
def result
|
44
|
+
url_entry_value || inherited_result || default_value
|
45
|
+
end
|
46
|
+
|
47
|
+
# @return [EacConfig::EntryPath]
|
48
|
+
def root_entry_path
|
49
|
+
component_entry_path[0..-2]
|
50
|
+
end
|
51
|
+
|
52
|
+
# @return [Avm::Entries::Entry]
|
53
|
+
def url_entry
|
54
|
+
entries_provider.entry((root_entry_path + %w[url]).to_string)
|
55
|
+
end
|
56
|
+
|
57
|
+
def url_entry_value
|
58
|
+
return unless url_entry.context_found?
|
59
|
+
|
60
|
+
::Avm::Entries::UriBuilder.from_source(url_entry.value.to_uri)
|
61
|
+
.avm_field_get(component)
|
62
|
+
end
|
63
|
+
|
64
|
+
# @return [String]
|
65
|
+
def component
|
66
|
+
component_entry_path.last
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/lib/avm/entries/base.rb
CHANGED
@@ -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
|
@@ -32,16 +34,6 @@ module Avm
|
|
32
34
|
end
|
33
35
|
(path_prefix + entry_suffix).join('.')
|
34
36
|
end
|
35
|
-
|
36
|
-
def inherited_entry_value(source_entry_suffix, target_entry_suffix, &block)
|
37
|
-
read_entry_optional(source_entry_suffix).if_present do |instance_id|
|
38
|
-
other_entry_value(instance_id, target_entry_suffix).if_present(&block)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def other_entry_value(instance_id, entry_suffix)
|
43
|
-
::Avm::Instances::Base.by_id(instance_id).read_entry_optional(entry_suffix)
|
44
|
-
end
|
45
37
|
end
|
46
38
|
end
|
47
39
|
end
|
data/lib/avm/entries/entry.rb
CHANGED
@@ -10,7 +10,16 @@ module Avm
|
|
10
10
|
common_constructor :parent, :suffix, :options
|
11
11
|
|
12
12
|
def auto_value
|
13
|
-
|
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
|
@@ -12,11 +12,6 @@ module Avm
|
|
12
12
|
::Avm::Instances::EntryKeys::FS_PATH) { |v| v + '/' + id }
|
13
13
|
end
|
14
14
|
|
15
|
-
def auto_data_fs_path
|
16
|
-
inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
|
17
|
-
::Avm::Instances::EntryKeys::DATA_FS_PATH) { |v| v + '/' + id }
|
18
|
-
end
|
19
|
-
|
20
15
|
def auto_fs_url
|
21
16
|
auto_fs_url_with_install || auto_fs_url_without_install
|
22
17
|
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
|
@@ -7,25 +8,29 @@ module Avm
|
|
7
8
|
class Base
|
8
9
|
module AutoValues
|
9
10
|
module Install
|
10
|
-
def
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
def auto_install_hostname
|
17
|
-
inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
|
18
|
-
::Avm::Instances::EntryKeys::INSTALL_HOSTNAME)
|
11
|
+
def auto_install_data_path
|
12
|
+
uri_component_entry_value(
|
13
|
+
::Avm::Instances::EntryKeys::INSTALL_DATA_PATH,
|
14
|
+
inherited_value_block: ->(v) { v + '/' + id }
|
15
|
+
)
|
19
16
|
end
|
20
17
|
|
21
|
-
def
|
22
|
-
|
23
|
-
|
18
|
+
def auto_install_groupname
|
19
|
+
uri_component_entry_value(
|
20
|
+
::Avm::Instances::EntryKeys::INSTALL_GROUPNAME,
|
21
|
+
default_value: lambda do
|
22
|
+
read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_USERNAME)
|
23
|
+
end
|
24
|
+
)
|
24
25
|
end
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
27
|
+
::Avm::Entries::UriBuilder::ENTRIES_FIELDS.each do |component|
|
28
|
+
method_suffix = "install_#{component}"
|
29
|
+
define_method "auto_#{method_suffix}" do
|
30
|
+
uri_component_entry_value(
|
31
|
+
::Avm::Instances::EntryKeys.const_get(method_suffix.underscore.upcase)
|
32
|
+
)
|
33
|
+
end
|
29
34
|
end
|
30
35
|
|
31
36
|
def auto_install_url
|
@@ -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 = %
|
9
|
+
URI_FIELDS = ::Avm::Entries::UriBuilder::ENTRIES_FIELDS + %w[url]
|
9
10
|
|
10
11
|
class << self
|
11
12
|
def all
|
@@ -44,12 +45,12 @@ module Avm
|
|
44
45
|
end
|
45
46
|
|
46
47
|
{
|
47
|
-
'' => %w[
|
48
|
+
'' => %w[fs_path name source_instance_id],
|
48
49
|
admin: URI_FIELDS + %w[api_key],
|
49
50
|
database: URI_FIELDS + %w[id limit name system timeout extra],
|
50
51
|
docker: %w[registry],
|
51
52
|
fs: %w[url],
|
52
|
-
install: URI_FIELDS + %w[id groupname],
|
53
|
+
install: URI_FIELDS + %w[id data_path groupname],
|
53
54
|
mailer: {
|
54
55
|
'' => %w[id from reply_to],
|
55
56
|
smtp: URI_FIELDS + %w[address domain authentication openssl_verify_mode starttls_auto tls]
|
@@ -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
|
|
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.39.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
|
+
date: 2022-08-17 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.
|
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.
|
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.
|
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.
|
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.
|
93
|
+
version: '0.101'
|
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.
|
100
|
+
version: '0.101'
|
101
101
|
- !ruby/object:Gem::Dependency
|
102
102
|
name: eac_templates
|
103
103
|
requirement: !ruby/object:Gem::Requirement
|
@@ -230,6 +230,8 @@ 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/inherited_entry_value.rb
|
234
|
+
- lib/avm/entries/base/uri_component_entry_value.rb
|
233
235
|
- lib/avm/entries/entry.rb
|
234
236
|
- lib/avm/entries/uri_builder.rb
|
235
237
|
- lib/avm/executables.rb
|
@@ -290,6 +292,7 @@ files:
|
|
290
292
|
- lib/avm/source_generators/runner.rb
|
291
293
|
- lib/avm/sources.rb
|
292
294
|
- lib/avm/sources/base.rb
|
295
|
+
- lib/avm/sources/base/application.rb
|
293
296
|
- lib/avm/sources/base/configuration.rb
|
294
297
|
- lib/avm/sources/base/instance.rb
|
295
298
|
- lib/avm/sources/base/locale.rb
|