avm 0.39.1 → 0.41.1

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: 77d9c5ea0df6745cf1b9e1ee3d47ef031b2bc6caf956de84804dc32490d21776
4
- data.tar.gz: f564b3b00470ab6643083ac1ec6fbd63c56dd5b65539049520f2aaac0f59a47b
3
+ metadata.gz: 01cc4fb71195c68ac7537f915a8a42233b781ed6c07d7ecf5eeafae0e213159a
4
+ data.tar.gz: a7de999e81365e9f8f05bfa6af80d5a4a73411db1fe4b0c839b571617a3cb14e
5
5
  SHA512:
6
- metadata.gz: c31937f1858e5de2462d76a6880358fe8bdfb35faac91ead3d7e52eb881c53f6f2db2dcca071435b0a9aa4034a43fb7468258e52fb25025ce7fbff5131c0d480
7
- data.tar.gz: 16eb08fcbef7cc5a905b3118af0f690bad53283f63623b7f0662009bb92c70d86098669da89f00124d46f94cd679cd6dcb98a6506ffca93dba23211a507b2790
6
+ metadata.gz: 6ae39e05f3e21ed0784f6c137c9ce41788e3431c6df80b5e03b61f5a6e0a19873aaf845a7d7d1b8a190c154bce8d6d9098d9dcec95022bbee808c48e1bc5dcd5
7
+ data.tar.gz: 50effabbbe2de5927f7d6d6e931f0593fa92b7f200445aee17f2e6c3bfba4709dfc461fc9acc3b172407d877b576417d9c67ffd450bad610edf2fc0a5ffdeea3
@@ -38,7 +38,7 @@ module Avm
38
38
 
39
39
  # @return [Avm::Sources::Base]
40
40
  def local_source_uncached
41
- ::Avm::Registry.sources.detect(local_instance.fs_path)
41
+ ::Avm::Registry.sources.detect(local_instance.install_path)
42
42
  end
43
43
  end
44
44
  end
@@ -18,7 +18,8 @@ module Avm
18
18
  before_load :clear_files
19
19
 
20
20
  def files_path
21
- ::File.join(instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH), fs_path_subpath)
21
+ ::File.join(instance.read_entry(::Avm::Instances::EntryKeys::INSTALL_PATH),
22
+ fs_path_subpath)
22
23
  end
23
24
 
24
25
  def dump_command
@@ -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_entry_path, :entries_provider, to: :uri_component_entry_value
15
+
16
+ def default_value_method_name
17
+ "#{component_entry_path.parts.join('_').variableize}_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 :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_entry_path.parts.join('_').variableize}_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
@@ -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,18 @@ 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 install_data_path_inherited_value_proc(value)
32
+ value + '/' + id
33
+ end
34
+
35
+ def install_groupname_default_value
36
+ read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_USERNAME)
37
+ end
38
+
39
+ def install_path_inherited_value_proc(value)
40
+ install_data_path_inherited_value_proc(value)
41
+ end
46
42
  end
47
43
  end
48
44
  end
@@ -45,11 +45,10 @@ module Avm
45
45
  end
46
46
 
47
47
  {
48
- '' => %w[fs_path name source_instance_id],
48
+ '' => %w[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
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.41.1'
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.39.1
4
+ version: 0.41.1
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-18 00:00:00.000000000 Z
11
+ date: 2022-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eac_cli
@@ -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
@@ -247,7 +250,6 @@ files:
247
250
  - lib/avm/instances/base/auto_values/admin.rb
248
251
  - lib/avm/instances/base/auto_values/data.rb
249
252
  - lib/avm/instances/base/auto_values/database.rb
250
- - lib/avm/instances/base/auto_values/filesystem.rb
251
253
  - lib/avm/instances/base/auto_values/install.rb
252
254
  - lib/avm/instances/base/auto_values/mailer.rb
253
255
  - lib/avm/instances/base/auto_values/ruby.rb
@@ -1,39 +0,0 @@
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 Filesystem
10
- def auto_fs_path
11
- inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
12
- ::Avm::Instances::EntryKeys::FS_PATH) { |v| v + '/' + id }
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
- end
36
- end
37
- end
38
- end
39
- end