avm 0.39.1 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77d9c5ea0df6745cf1b9e1ee3d47ef031b2bc6caf956de84804dc32490d21776
4
- data.tar.gz: f564b3b00470ab6643083ac1ec6fbd63c56dd5b65539049520f2aaac0f59a47b
3
+ metadata.gz: 29538404e81ca5b9e3c7043a5b665b9a73f4bb662b7e5d6d1de891154c3bdddf
4
+ data.tar.gz: a2e2216c1cbdaf94044f3b59ee1c0aec69e193720d3f6312c25a6aad59865ea0
5
5
  SHA512:
6
- metadata.gz: c31937f1858e5de2462d76a6880358fe8bdfb35faac91ead3d7e52eb881c53f6f2db2dcca071435b0a9aa4034a43fb7468258e52fb25025ce7fbff5131c0d480
7
- data.tar.gz: 16eb08fcbef7cc5a905b3118af0f690bad53283f63623b7f0662009bb92c70d86098669da89f00124d46f94cd679cd6dcb98a6506ffca93dba23211a507b2790
6
+ metadata.gz: c4e2ac1e34e6d64bc030183c414507b5ca15e82039ff16728727786357b5922c8a193cd58ffd2b51d40b0055531ce94b111135e1ff0589e198099b40b3421f3d
7
+ data.tar.gz: f430f917bd972158fdfbef76de2f72ecfa4a514df8d333dc360cdaaf6adcc6bbc4dabce9f37371c07b00fde76bc8eda1162787c20ab2a2e1edc80c736a70a98f
@@ -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,31 +9,16 @@ module Avm
9
9
  module Base
10
10
  class UriComponentEntryValue
11
11
  enable_method_class
12
+ require_sub __FILE__, require_dependency: true
12
13
 
13
14
  enable_listable
14
- lists.add_symbol :option, :default_value, :inherited_value_block
15
+ lists.add_symbol :option
15
16
 
16
17
  common_constructor :entries_provider, :component_entry_path, :options, default: [{}] do
17
18
  self.component_entry_path = ::EacConfig::EntryPath.assert(component_entry_path)
18
19
  self.options = self.class.lists.option.hash_keys_validate!(options)
19
20
  end
20
21
 
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
22
  # @return [EacConfig::EntryPath]
38
23
  def id_entry_path
39
24
  root_entry_path + %w[id]
@@ -41,7 +26,7 @@ module Avm
41
26
 
42
27
  # @return [String, nil]
43
28
  def result
44
- url_entry_value || inherited_result || default_value
29
+ url_entry_value || inherited_value || default_value
45
30
  end
46
31
 
47
32
  # @return [EacConfig::EntryPath]
@@ -49,18 +34,6 @@ module Avm
49
34
  component_entry_path[0..-2]
50
35
  end
51
36
 
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
37
  # @return [String]
65
38
  def component
66
39
  component_entry_path.last
@@ -11,27 +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_fs_url
16
- auto_fs_url_with_install || auto_fs_url_without_install
17
- end
18
-
19
- def auto_fs_url_with_install
20
- read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_URL)
21
- .if_present do |install_url|
22
- read_entry_optional('fs_path').if_present do |fs_path|
23
- "#{install_url}#{fs_path}"
24
- end
25
- end
26
- end
27
-
28
- def auto_fs_url_without_install
29
- return nil if read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_URL).present?
30
-
31
- read_entry_optional('fs_path').if_present do |fs_path|
32
- "file://#{fs_path}"
33
- end
34
- end
35
14
  end
36
15
  end
37
16
  end
@@ -8,23 +8,7 @@ module Avm
8
8
  class Base
9
9
  module AutoValues
10
10
  module Install
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
- )
16
- end
17
-
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
- )
25
- end
26
-
27
- ::Avm::Entries::UriBuilder::ENTRIES_FIELDS.each do |component|
11
+ (::Avm::Entries::UriBuilder::ENTRIES_FIELDS + %w[data_path groupname]).each do |component|
28
12
  method_suffix = "install_#{component}"
29
13
  define_method "auto_#{method_suffix}" do
30
14
  uri_component_entry_value(
@@ -43,6 +27,14 @@ module Avm
43
27
  require 'avm/entries/auto_values/uri_entry'
44
28
  ::Avm::Entries::AutoValues::UriEntry.new(self, 'install').value
45
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
46
38
  end
47
39
  end
48
40
  end
@@ -49,7 +49,6 @@ module Avm
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
52
  install: URI_FIELDS + %w[id data_path groupname],
54
53
  mailer: {
55
54
  '' => %w[id from reply_to],
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.39.1'
4
+ VERSION = '0.40.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.39.1
4
+ version: 0.40.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo H. Bogoni
@@ -238,6 +238,9 @@ files:
238
238
  - lib/avm/entries/base.rb
239
239
  - lib/avm/entries/base/inherited_entry_value.rb
240
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
241
244
  - lib/avm/entries/entry.rb
242
245
  - lib/avm/entries/uri_builder.rb
243
246
  - lib/avm/executables.rb