avm 0.42.0 → 0.44.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: 64ca72cb2ab91751e6ac2bf8e81404c0c5111ccbe4971ea349bd38ee490735e2
4
- data.tar.gz: 1b840a43b5511128fa3f1cbf54395a3fb435f2c5cd0bb59293aac6fdd970c4e4
3
+ metadata.gz: 75da0735d17a4472beabdba8b1a848bd1df14e0e8b630885bbf2b1503d198e14
4
+ data.tar.gz: 4d71ad19868decc5d8eebcd01b71a1a518702345a06521edb0c27f55bd25cca5
5
5
  SHA512:
6
- metadata.gz: 4a6b697d1114c887b4590f51afe76b0bde03b471b3eabfbcf904c5b31fcd686d15eb355cb43a9145e934de2cd60f3ecf045abefda892b4feb3835f7392e5d2cf
7
- data.tar.gz: a9331ce632924f1bc83a6ac93b12609abbeb92eec20c04d6c3340d19779ffd8876c63b238cf017ad351e4b7b219fe9ab4ae84bd95ac912f6d92c26a09304c17f
6
+ metadata.gz: 8e75c632a176c1f15431466cf0fe85c53fcbaccf5d914e643b7a5a51ef17bc8a41ea7c5b2d6253feb0587557d01d66a40b7073ac375115f7e07afe1ffa13d694
7
+ data.tar.gz: d3c82791118497839cea0c53d9e8d838dedf1db1a7f462c022ea24d82411774f86db27b9e0e8d40b844a09ad6c2f918f0b23802f58f489e03490bc52f10d526f
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Entries
7
+ module Base
8
+ class UriComponentsEntriesValues
9
+ class ComponentFactory
10
+ enable_method_class
11
+ common_constructor :owner, :component
12
+
13
+ def result
14
+ component_class.new(owner, component)
15
+ end
16
+
17
+ def component_class
18
+ specific_class || generic_class
19
+ end
20
+
21
+ def generic_class
22
+ parent_class.const_get('GenericComponent')
23
+ end
24
+
25
+ def parent_class
26
+ ::Avm::Entries::Base::UriComponentsEntriesValues
27
+ end
28
+
29
+ def specific_class
30
+ return nil unless parent_class.const_defined?(specific_class_basename)
31
+
32
+ parent_class.const_get(specific_class_basename)
33
+ end
34
+
35
+ def specific_class_basename
36
+ [component, 'component'].join('_').camelize
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/entries/uri_builder'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Entries
8
+ module Base
9
+ class UriComponentsEntriesValues
10
+ class GenericComponent
11
+ common_constructor :owner, :component
12
+ delegate :entries_provider_class, :prefix, to: :owner
13
+
14
+ def auto_method_name
15
+ ['auto', component_method_name].join('_')
16
+ end
17
+
18
+ def component_method_name
19
+ [prefix, component].join('_')
20
+ end
21
+
22
+ def define_auto_method(&block)
23
+ entries_provider_class.define_method(auto_method_name, &block)
24
+ end
25
+
26
+ def define_inherited_value_proc_method(&block)
27
+ entries_provider_class.define_method(inherited_value_proc_name, &block)
28
+ end
29
+
30
+ def entry_key_path
31
+ ::EacConfig::EntryPath.assert([prefix, component])
32
+ end
33
+
34
+ def id_component
35
+ @id_component ||= owner.component_factory('id')
36
+ end
37
+
38
+ def inherited_value_proc_name
39
+ [component_method_name, 'inherited_value_proc'].join('_')
40
+ end
41
+
42
+ def setup
43
+ outer_self = self
44
+ define_auto_method do
45
+ uri_component_entry_value(outer_self.entry_key_path.to_string)
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/entries/base/uri_components_entries_values/generic_component'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Entries
8
+ module Base
9
+ class UriComponentsEntriesValues
10
+ class PathComponent < ::Avm::Entries::Base::UriComponentsEntriesValues::GenericComponent
11
+ def setup
12
+ super
13
+ define_inherited_value_proc_method { |value| value + '/' + id }
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/entries/base/uri_components_entries_values/generic_component'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Entries
8
+ module Base
9
+ class UriComponentsEntriesValues
10
+ class UrlComponent < ::Avm::Entries::Base::UriComponentsEntriesValues::GenericComponent
11
+ def setup
12
+ outer_self = self
13
+ define_auto_method do
14
+ inherited_entry_value(outer_self.id_component.entry_key_path.to_string,
15
+ outer_self.entry_key_path.to_string) ||
16
+ outer_self.auto_install_url_by_parts(self)
17
+ end
18
+ end
19
+
20
+ def auto_install_url_by_parts(entries_provider)
21
+ require 'avm/entries/auto_values/uri_entry'
22
+ ::Avm::Entries::AutoValues::UriEntry.new(entries_provider, 'install').value
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/entries/uri_builder'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Entries
8
+ module Base
9
+ class UriComponentsEntriesValues
10
+ require_sub __FILE__
11
+ common_constructor :entries_provider_class, :prefix, :extra_fields
12
+
13
+ ENTRIES_FIELDS = ::Avm::Entries::UriBuilder::ENTRIES_FIELDS + %w[url]
14
+
15
+ def fields
16
+ ENTRIES_FIELDS + extra_fields
17
+ end
18
+
19
+ def result
20
+ fields.map { |field| component_factory(field).setup }
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -7,6 +7,13 @@ module Avm
7
7
  module Entries
8
8
  module Base
9
9
  require_sub __FILE__, require_dependency: true
10
+ common_concern
11
+
12
+ module ClassMethods
13
+ def uri_components_entries_values(prefix, extra_fields = [])
14
+ ::Avm::Entries::Base::UriComponentsEntriesValues.new(self, prefix, extra_fields).result
15
+ end
16
+ end
10
17
 
11
18
  def entries_provider_id
12
19
  id
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Entries
7
+ class KeysConstantsSet
8
+ common_constructor :entries_provider_class, :prefix, :suffixes
9
+
10
+ # @return [Array<String>]
11
+ def result
12
+ if suffixes.is_a?(::Hash)
13
+ keys_consts_set_from_hash
14
+ elsif suffixes.is_a?(::Enumerable)
15
+ keys_consts_set_from_enum
16
+ else
17
+ raise "Unmapped suffixes class: #{suffixes.class}"
18
+ end
19
+ end
20
+
21
+ private
22
+
23
+ # @return [String]
24
+ def key_const_set(prefix, suffix)
25
+ key = [prefix, suffix].reject(&:blank?).join('.')
26
+ entries_provider_class.const_set(key.gsub('.', '_').upcase, key)
27
+ key
28
+ end
29
+
30
+ # @return [Array<String>]
31
+ def keys_consts_set_from_enum
32
+ suffixes.map { |suffix| key_const_set(prefix, suffix) }
33
+ end
34
+
35
+ # @return [Array<String>]
36
+ def keys_consts_set_from_hash
37
+ suffixes.flat_map do |k, v|
38
+ self.class.new(entries_provider_class, prefix.to_s + (k.blank? ? '' : ".#{k}"), v).result
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/entries/uri_builder'
4
+ require 'avm/instances/entry_keys'
5
+
6
+ module Avm
7
+ module Instances
8
+ class Base
9
+ module Install
10
+ common_concern do
11
+ uri_components_entries_values 'install', %w[data_path email groupname]
12
+ end
13
+
14
+ def install_data_path_inherited_value_proc(value)
15
+ value + '/' + id
16
+ end
17
+
18
+ def install_groupname_default_value
19
+ read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_USERNAME)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'addressable'
4
+ require 'avm/instances/entry_keys'
5
+
6
+ module Avm
7
+ module Instances
8
+ class Base
9
+ module Web
10
+ common_concern do
11
+ uri_components_entries_values 'web'
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -12,8 +12,8 @@ module Avm
12
12
  enable_abstract_methods
13
13
  enable_listable
14
14
  enable_simple_cache
15
- require_sub __FILE__, include_modules: true
16
15
  include ::Avm::Entries::Base
16
+ require_sub __FILE__, include_modules: true
17
17
  include ::Avm::With::ExtraSubcommands
18
18
  include ::Avm::With::ApplicationStereotype
19
19
 
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/entries/keys_constants_set'
3
4
  require 'avm/entries/uri_builder'
4
5
  require 'eac_ruby_utils/core_ext'
5
6
 
@@ -14,19 +15,7 @@ module Avm
14
15
  end
15
16
 
16
17
  def keys_consts_set(prefix, suffixes)
17
- if suffixes.is_a?(::Hash)
18
- keys_consts_set_from_hash(prefix, suffixes)
19
- elsif suffixes.is_a?(::Enumerable)
20
- keys_consts_set_from_enum(prefix, suffixes)
21
- else
22
- raise "Unmapped suffixes class: #{suffixes.class}"
23
- end
24
- end
25
-
26
- def key_const_set(prefix, suffix)
27
- key = [prefix, suffix].reject(&:blank?).join('.')
28
- const_set(key.gsub('.', '_').upcase, key)
29
- all_keys << key
18
+ all_keys.merge(::Avm::Entries::KeysConstantsSet.new(self, prefix, suffixes).result)
30
19
  end
31
20
 
32
21
  private
@@ -34,14 +23,6 @@ module Avm
34
23
  def all_keys
35
24
  @all_keys ||= ::Set.new
36
25
  end
37
-
38
- def keys_consts_set_from_enum(prefix, suffixes)
39
- suffixes.each { |suffix| key_const_set(prefix, suffix) }
40
- end
41
-
42
- def keys_consts_set_from_hash(prefix, suffixes)
43
- suffixes.each { |k, v| keys_consts_set(prefix.to_s + (k.blank? ? '' : ".#{k}"), v) }
44
- end
45
26
  end
46
27
 
47
28
  {
@@ -49,7 +30,7 @@ module Avm
49
30
  admin: URI_FIELDS + %w[api_key],
50
31
  database: URI_FIELDS + %w[id limit name system timeout extra],
51
32
  docker: %w[registry],
52
- install: URI_FIELDS + %w[id data_path groupname],
33
+ install: URI_FIELDS + %w[id data_path email groupname],
53
34
  mailer: {
54
35
  '' => %w[id from reply_to],
55
36
  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.42.0'
4
+ VERSION = '0.44.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.42.0
4
+ version: 0.44.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-09-08 00:00:00.000000000 Z
11
+ date: 2022-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eac_cli
@@ -16,20 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.27'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 0.27.8
19
+ version: '0.28'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '0.27'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 0.27.8
26
+ version: '0.28'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: eac_config
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -96,20 +90,14 @@ dependencies:
96
90
  requirements:
97
91
  - - "~>"
98
92
  - !ruby/object:Gem::Version
99
- version: '0.102'
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- version: 0.102.1
93
+ version: '0.104'
103
94
  type: :runtime
104
95
  prerelease: false
105
96
  version_requirements: !ruby/object:Gem::Requirement
106
97
  requirements:
107
98
  - - "~>"
108
99
  - !ruby/object:Gem::Version
109
- version: '0.102'
110
- - - ">="
111
- - !ruby/object:Gem::Version
112
- version: 0.102.1
100
+ version: '0.104'
113
101
  - !ruby/object:Gem::Dependency
114
102
  name: eac_templates
115
103
  requirement: !ruby/object:Gem::Requirement
@@ -119,7 +107,7 @@ dependencies:
119
107
  version: '0.3'
120
108
  - - ">="
121
109
  - !ruby/object:Gem::Version
122
- version: 0.3.1
110
+ version: 0.3.2
123
111
  type: :runtime
124
112
  prerelease: false
125
113
  version_requirements: !ruby/object:Gem::Requirement
@@ -129,7 +117,7 @@ dependencies:
129
117
  version: '0.3'
130
118
  - - ">="
131
119
  - !ruby/object:Gem::Version
132
- version: 0.3.1
120
+ version: 0.3.2
133
121
  - !ruby/object:Gem::Dependency
134
122
  name: filesize
135
123
  requirement: !ruby/object:Gem::Requirement
@@ -247,22 +235,27 @@ files:
247
235
  - lib/avm/entries/base/uri_component_entry_value/default_value.rb
248
236
  - lib/avm/entries/base/uri_component_entry_value/inherited_value.rb
249
237
  - lib/avm/entries/base/uri_component_entry_value/url_entry_value.rb
238
+ - lib/avm/entries/base/uri_components_entries_values.rb
239
+ - lib/avm/entries/base/uri_components_entries_values/component_factory.rb
240
+ - lib/avm/entries/base/uri_components_entries_values/generic_component.rb
241
+ - lib/avm/entries/base/uri_components_entries_values/path_component.rb
242
+ - lib/avm/entries/base/uri_components_entries_values/url_component.rb
250
243
  - lib/avm/entries/entry.rb
244
+ - lib/avm/entries/keys_constants_set.rb
251
245
  - lib/avm/entries/uri_builder.rb
252
246
  - lib/avm/executables.rb
253
247
  - lib/avm/instances.rb
254
248
  - lib/avm/instances/base.rb
255
249
  - lib/avm/instances/base/auto_values.rb
256
- - lib/avm/instances/base/auto_values/admin.rb
257
250
  - lib/avm/instances/base/auto_values/data.rb
258
251
  - lib/avm/instances/base/auto_values/database.rb
259
- - lib/avm/instances/base/auto_values/install.rb
260
252
  - lib/avm/instances/base/auto_values/mailer.rb
261
253
  - lib/avm/instances/base/auto_values/ruby.rb
262
254
  - lib/avm/instances/base/auto_values/source.rb
263
- - lib/avm/instances/base/auto_values/web.rb
264
255
  - lib/avm/instances/base/dockerizable.rb
265
256
  - lib/avm/instances/base/entry_keys.rb
257
+ - lib/avm/instances/base/install.rb
258
+ - lib/avm/instances/base/web.rb
266
259
  - lib/avm/instances/docker_image.rb
267
260
  - lib/avm/instances/entry_keys.rb
268
261
  - lib/avm/instances/runner.rb
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Avm
4
- module Instances
5
- class Base
6
- module AutoValues
7
- module Admin
8
- def auto_admin_email
9
- inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID, 'admin.email')
10
- end
11
-
12
- def auto_admin_name
13
- inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID, 'admin.name')
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/entries/uri_builder'
4
- require 'avm/instances/entry_keys'
5
-
6
- module Avm
7
- module Instances
8
- class Base
9
- module AutoValues
10
- module Install
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
- )
17
- end
18
- end
19
-
20
- def auto_install_url
21
- inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
22
- ::Avm::Instances::EntryKeys::INSTALL_URL) ||
23
- auto_install_url_by_parts
24
- end
25
-
26
- def auto_install_url_by_parts
27
- require 'avm/entries/auto_values/uri_entry'
28
- ::Avm::Entries::AutoValues::UriEntry.new(self, 'install').value
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
42
- end
43
- end
44
- end
45
- end
46
- end
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'addressable'
4
- require 'avm/instances/entry_keys'
5
-
6
- module Avm
7
- module Instances
8
- class Base
9
- module AutoValues
10
- module Web
11
- def auto_web_authority
12
- web_url_as_uri(&:authority)
13
- end
14
-
15
- def auto_web_hostname
16
- web_url_as_uri(&:host)
17
- end
18
-
19
- def auto_web_path
20
- web_url_as_uri(&:path)
21
- end
22
-
23
- def auto_web_port
24
- web_url_as_uri(&:port)
25
- end
26
-
27
- def auto_web_scheme
28
- web_url_as_uri(&:scheme)
29
- end
30
-
31
- def auto_web_userinfo
32
- web_url_as_uri(&:userinfo)
33
- end
34
-
35
- private
36
-
37
- def web_url_as_uri
38
- read_entry_optional(::Avm::Instances::EntryKeys::WEB_URL).if_present do |v|
39
- yield(::Addressable::URI.parse(v))
40
- end
41
- end
42
- end
43
- end
44
- end
45
- end
46
- end