avm 0.38.0 → 0.40.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: dc4f65ada3e6c902df6d77b491ac3a043e6ebb7fc93812873fb6d2d7b0d50624
4
- data.tar.gz: 5dfb61ddeed3edb2c55f98133e281a18aa28f7024e69f2e1942b3fccc03453a1
3
+ metadata.gz: 29538404e81ca5b9e3c7043a5b665b9a73f4bb662b7e5d6d1de891154c3bdddf
4
+ data.tar.gz: a2e2216c1cbdaf94044f3b59ee1c0aec69e193720d3f6312c25a6aad59865ea0
5
5
  SHA512:
6
- metadata.gz: 142224b13cfcf3129c0fb24650724af9e66d892247668fb249e526fb9b050df749f0da51c1d0de95106ef85bceae03f563ca93adcf41f2464327cae6153341a0
7
- data.tar.gz: 8968321777cca2c10902856df6bb9654f98d7e4b84a9c5781c741ef2483e9b1ca5283d281288c9351f34de83bb7e22992894c611059985d8359fcf42b1fd92a7
6
+ metadata.gz: c4e2ac1e34e6d64bc030183c414507b5ca15e82039ff16728727786357b5922c8a193cd58ffd2b51d40b0055531ce94b111135e1ff0589e198099b40b3421f3d
7
+ data.tar.gz: f430f917bd972158fdfbef76de2f72ecfa4a514df8d333dc360cdaaf6adcc6bbc4dabce9f37371c07b00fde76bc8eda1162787c20ab2a2e1edc80c736a70a98f
@@ -15,7 +15,7 @@ module Avm
15
15
 
16
16
  def value
17
17
  ::Avm::Entries::UriBuilder.from_all_fields do |field_name|
18
- entries_provider.entry([suffix, field_name]).value
18
+ entries_provider.entry([suffix, field_name]).optional_value
19
19
  end.to_uri.to_s
20
20
  end
21
21
  end
@@ -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,27 @@
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
+ class DefaultValue
12
+ enable_method_class
13
+ common_constructor :uri_component_entry_value
14
+ delegate :component, :entries_provider, to: :uri_component_entry_value
15
+
16
+ def default_value_method_name
17
+ "#{component}_default_value"
18
+ end
19
+
20
+ def result
21
+ entries_provider.if_respond(default_value_method_name)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,38 @@
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
+ class InheritedValue
12
+ enable_method_class
13
+ common_constructor :uri_component_entry_value
14
+ delegate :component, :entries_provider, :id_entry_path, :component_entry_path,
15
+ to: :uri_component_entry_value
16
+
17
+ def result
18
+ entries_provider.inherited_entry_value(
19
+ id_entry_path.to_string,
20
+ component_entry_path.to_string,
21
+ &inherited_value_block
22
+ )
23
+ end
24
+
25
+ def inherited_value_block
26
+ return nil unless entries_provider.respond_to?(inherited_value_block_method_name)
27
+
28
+ ->(value) { entries_provider.send(inherited_value_block_method_name, value) }
29
+ end
30
+
31
+ def inherited_value_block_method_name
32
+ "#{component}_inherited_value_proc".to_sym
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -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 UriComponentEntryValue
11
+ class UrlEntryValue
12
+ enable_method_class
13
+ common_constructor :uri_component_entry_value
14
+ delegate :component, :entries_provider, :root_entry_path, to: :uri_component_entry_value
15
+
16
+ def result
17
+ return unless url_entry.context_found?
18
+
19
+ ::Avm::Entries::UriBuilder.from_source(url_entry.value.to_uri)
20
+ .avm_field_get(component)
21
+ end
22
+
23
+ # @return [Avm::Entries::Entry]
24
+ def url_entry
25
+ entries_provider.entry((root_entry_path + %w[url]).to_string)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -9,15 +9,14 @@ module Avm
9
9
  module Base
10
10
  class UriComponentEntryValue
11
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
12
+ require_sub __FILE__, require_dependency: true
15
13
 
16
- def inherited_result
17
- entries_provider.inherited_entry_value(
18
- id_entry_path.to_string,
19
- component_entry_path.to_string
20
- )
14
+ enable_listable
15
+ lists.add_symbol :option
16
+
17
+ common_constructor :entries_provider, :component_entry_path, :options, default: [{}] do
18
+ self.component_entry_path = ::EacConfig::EntryPath.assert(component_entry_path)
19
+ self.options = self.class.lists.option.hash_keys_validate!(options)
21
20
  end
22
21
 
23
22
  # @return [EacConfig::EntryPath]
@@ -27,12 +26,7 @@ module Avm
27
26
 
28
27
  # @return [String, nil]
29
28
  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
29
+ url_entry_value || inherited_value || default_value
36
30
  end
37
31
 
38
32
  # @return [EacConfig::EntryPath]
@@ -40,11 +34,6 @@ module Avm
40
34
  component_entry_path[0..-2]
41
35
  end
42
36
 
43
- # @return [Avm::Entries::Entry]
44
- def url_entry
45
- entries_provider.entry((root_entry_path + %w[url]).to_string)
46
- end
47
-
48
37
  # @return [String]
49
38
  def component
50
39
  component_entry_path.last
@@ -34,16 +34,6 @@ module Avm
34
34
  end
35
35
  (path_prefix + entry_suffix).join('.')
36
36
  end
37
-
38
- def inherited_entry_value(source_entry_suffix, target_entry_suffix, &block)
39
- read_entry_optional(source_entry_suffix).if_present do |instance_id|
40
- other_entry_value(instance_id, target_entry_suffix).if_present(&block)
41
- end
42
- end
43
-
44
- def other_entry_value(instance_id, entry_suffix)
45
- ::Avm::Instances::Base.by_id(instance_id).read_entry_optional(entry_suffix)
46
- end
47
37
  end
48
38
  end
49
39
  end
@@ -11,32 +11,6 @@ module Avm
11
11
  inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
12
12
  ::Avm::Instances::EntryKeys::FS_PATH) { |v| v + '/' + id }
13
13
  end
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
- def auto_fs_url
21
- auto_fs_url_with_install || auto_fs_url_without_install
22
- end
23
-
24
- def auto_fs_url_with_install
25
- read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_URL)
26
- .if_present do |install_url|
27
- read_entry_optional('fs_path').if_present do |fs_path|
28
- "#{install_url}#{fs_path}"
29
- end
30
- end
31
- end
32
-
33
- def auto_fs_url_without_install
34
- return nil if read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_URL).present?
35
-
36
- read_entry_optional('fs_path').if_present do |fs_path|
37
- "file://#{fs_path}"
38
- end
39
- end
40
14
  end
41
15
  end
42
16
  end
@@ -8,15 +8,12 @@ module Avm
8
8
  class Base
9
9
  module AutoValues
10
10
  module Install
11
- def auto_install_groupname
12
- inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
13
- ::Avm::Instances::EntryKeys::INSTALL_GROUPNAME) ||
14
- read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_USERNAME)
15
- end
16
-
17
- ::Avm::Entries::UriBuilder::ENTRIES_FIELDS.each do |component|
18
- define_method "auto_install_#{component}" do
19
- uri_component_entry_value("install.#{component}")
11
+ (::Avm::Entries::UriBuilder::ENTRIES_FIELDS + %w[data_path groupname]).each do |component|
12
+ method_suffix = "install_#{component}"
13
+ define_method "auto_#{method_suffix}" do
14
+ uri_component_entry_value(
15
+ ::Avm::Instances::EntryKeys.const_get(method_suffix.underscore.upcase)
16
+ )
20
17
  end
21
18
  end
22
19
 
@@ -30,6 +27,14 @@ module Avm
30
27
  require 'avm/entries/auto_values/uri_entry'
31
28
  ::Avm::Entries::AutoValues::UriEntry.new(self, 'install').value
32
29
  end
30
+
31
+ def data_path_inherited_value_proc(value)
32
+ value + '/' + id
33
+ end
34
+
35
+ def groupname_default_value
36
+ read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_USERNAME)
37
+ end
33
38
  end
34
39
  end
35
40
  end
@@ -45,12 +45,11 @@ module Avm
45
45
  end
46
46
 
47
47
  {
48
- '' => %w[data_fs_path fs_path name source_instance_id],
48
+ '' => %w[fs_path name source_instance_id],
49
49
  admin: URI_FIELDS + %w[api_key],
50
50
  database: URI_FIELDS + %w[id limit name system timeout extra],
51
51
  docker: %w[registry],
52
- fs: %w[url],
53
- install: URI_FIELDS + %w[id groupname],
52
+ install: URI_FIELDS + %w[id data_path groupname],
54
53
  mailer: {
55
54
  '' => %w[id from reply_to],
56
55
  smtp: URI_FIELDS + %w[address domain authentication openssl_verify_mode starttls_auto tls]
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.38.0'
4
+ VERSION = '0.40.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.38.0
4
+ version: 0.40.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-16 00:00:00.000000000 Z
11
+ date: 2022-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eac_cli
@@ -37,6 +37,9 @@ dependencies:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0.11'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 0.11.1
40
43
  type: :runtime
41
44
  prerelease: false
42
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -44,6 +47,9 @@ dependencies:
44
47
  - - "~>"
45
48
  - !ruby/object:Gem::Version
46
49
  version: '0.11'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 0.11.1
47
53
  - !ruby/object:Gem::Dependency
48
54
  name: eac_docker
49
55
  requirement: !ruby/object:Gem::Requirement
@@ -90,14 +96,14 @@ dependencies:
90
96
  requirements:
91
97
  - - "~>"
92
98
  - !ruby/object:Gem::Version
93
- version: '0.100'
99
+ version: '0.102'
94
100
  type: :runtime
95
101
  prerelease: false
96
102
  version_requirements: !ruby/object:Gem::Requirement
97
103
  requirements:
98
104
  - - "~>"
99
105
  - !ruby/object:Gem::Version
100
- version: '0.100'
106
+ version: '0.102'
101
107
  - !ruby/object:Gem::Dependency
102
108
  name: eac_templates
103
109
  requirement: !ruby/object:Gem::Requirement
@@ -230,7 +236,11 @@ files:
230
236
  - lib/avm/entries/auto_values/entry.rb
231
237
  - lib/avm/entries/auto_values/uri_entry.rb
232
238
  - lib/avm/entries/base.rb
239
+ - lib/avm/entries/base/inherited_entry_value.rb
233
240
  - lib/avm/entries/base/uri_component_entry_value.rb
241
+ - lib/avm/entries/base/uri_component_entry_value/default_value.rb
242
+ - lib/avm/entries/base/uri_component_entry_value/inherited_value.rb
243
+ - lib/avm/entries/base/uri_component_entry_value/url_entry_value.rb
234
244
  - lib/avm/entries/entry.rb
235
245
  - lib/avm/entries/uri_builder.rb
236
246
  - lib/avm/executables.rb