avm 0.43.0 → 0.44.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: da90158349f77578925f4185dcf817f3d086ba8939cf6fe2a0057d5acebce8d6
4
- data.tar.gz: 68bdb121438447bb34a59526adb61af042922a59f0d31226cae3ad10c9b66bf4
3
+ metadata.gz: 75da0735d17a4472beabdba8b1a848bd1df14e0e8b630885bbf2b1503d198e14
4
+ data.tar.gz: 4d71ad19868decc5d8eebcd01b71a1a518702345a06521edb0c27f55bd25cca5
5
5
  SHA512:
6
- metadata.gz: 6842223c4c7006bad23a1b1bd283b389ca20fdb63acb2a6264a84cf737fefc43406167cedfab09843aaddb7620295b1b1fb70b445ce517bd7752ebd0e66982fe
7
- data.tar.gz: c4d9bd5b0994d480ae7ff9b8a48edfdfb1fd20b849c5cd99adee4fb3e6ff645b7dbeba8092771b475e6284254f13109340f0c7d58eb8ccdf0a97d9f2d1ba0b86
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
  {
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.43.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.43.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-14 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,14 +90,14 @@ dependencies:
96
90
  requirements:
97
91
  - - "~>"
98
92
  - !ruby/object:Gem::Version
99
- version: '0.103'
93
+ version: '0.104'
100
94
  type: :runtime
101
95
  prerelease: false
102
96
  version_requirements: !ruby/object:Gem::Requirement
103
97
  requirements:
104
98
  - - "~>"
105
99
  - !ruby/object:Gem::Version
106
- version: '0.103'
100
+ version: '0.104'
107
101
  - !ruby/object:Gem::Dependency
108
102
  name: eac_templates
109
103
  requirement: !ruby/object:Gem::Requirement
@@ -113,7 +107,7 @@ dependencies:
113
107
  version: '0.3'
114
108
  - - ">="
115
109
  - !ruby/object:Gem::Version
116
- version: 0.3.1
110
+ version: 0.3.2
117
111
  type: :runtime
118
112
  prerelease: false
119
113
  version_requirements: !ruby/object:Gem::Requirement
@@ -123,7 +117,7 @@ dependencies:
123
117
  version: '0.3'
124
118
  - - ">="
125
119
  - !ruby/object:Gem::Version
126
- version: 0.3.1
120
+ version: 0.3.2
127
121
  - !ruby/object:Gem::Dependency
128
122
  name: filesize
129
123
  requirement: !ruby/object:Gem::Requirement
@@ -241,7 +235,13 @@ files:
241
235
  - lib/avm/entries/base/uri_component_entry_value/default_value.rb
242
236
  - lib/avm/entries/base/uri_component_entry_value/inherited_value.rb
243
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
244
243
  - lib/avm/entries/entry.rb
244
+ - lib/avm/entries/keys_constants_set.rb
245
245
  - lib/avm/entries/uri_builder.rb
246
246
  - lib/avm/executables.rb
247
247
  - lib/avm/instances.rb
@@ -249,13 +249,13 @@ files:
249
249
  - lib/avm/instances/base/auto_values.rb
250
250
  - lib/avm/instances/base/auto_values/data.rb
251
251
  - lib/avm/instances/base/auto_values/database.rb
252
- - lib/avm/instances/base/auto_values/install.rb
253
252
  - lib/avm/instances/base/auto_values/mailer.rb
254
253
  - lib/avm/instances/base/auto_values/ruby.rb
255
254
  - lib/avm/instances/base/auto_values/source.rb
256
- - lib/avm/instances/base/auto_values/web.rb
257
255
  - lib/avm/instances/base/dockerizable.rb
258
256
  - lib/avm/instances/base/entry_keys.rb
257
+ - lib/avm/instances/base/install.rb
258
+ - lib/avm/instances/base/web.rb
259
259
  - lib/avm/instances/docker_image.rb
260
260
  - lib/avm/instances/entry_keys.rb
261
261
  - lib/avm/instances/runner.rb
@@ -1,47 +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 email groupname])
12
- .each do |component|
13
- method_suffix = "install_#{component}"
14
- define_method "auto_#{method_suffix}" do
15
- uri_component_entry_value(
16
- ::Avm::Instances::EntryKeys.const_get(method_suffix.underscore.upcase)
17
- )
18
- end
19
- end
20
-
21
- def auto_install_url
22
- inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
23
- ::Avm::Instances::EntryKeys::INSTALL_URL) ||
24
- auto_install_url_by_parts
25
- end
26
-
27
- def auto_install_url_by_parts
28
- require 'avm/entries/auto_values/uri_entry'
29
- ::Avm::Entries::AutoValues::UriEntry.new(self, 'install').value
30
- end
31
-
32
- def install_data_path_inherited_value_proc(value)
33
- value + '/' + id
34
- end
35
-
36
- def install_groupname_default_value
37
- read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_USERNAME)
38
- end
39
-
40
- def install_path_inherited_value_proc(value)
41
- install_data_path_inherited_value_proc(value)
42
- end
43
- end
44
- end
45
- end
46
- end
47
- 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