avm 0.43.0 → 0.45.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/entries/auto_values/entry.rb +11 -4
- data/lib/avm/entries/base/uri_components_entries_values/component_factory.rb +42 -0
- data/lib/avm/entries/base/uri_components_entries_values/generic_component.rb +52 -0
- data/lib/avm/entries/base/uri_components_entries_values/path_component.rb +19 -0
- data/lib/avm/entries/base/uri_components_entries_values/url_component.rb +28 -0
- data/lib/avm/entries/base/uri_components_entries_values.rb +25 -0
- data/lib/avm/entries/base.rb +7 -0
- data/lib/avm/entries/jobs/base.rb +62 -0
- data/lib/avm/entries/jobs/variables_source/read_entry.rb +50 -0
- data/lib/avm/entries/jobs/variables_source.rb +15 -0
- data/lib/avm/entries/jobs/with_variables_source.rb +15 -0
- data/lib/avm/{jobs.rb → entries/jobs.rb} +4 -2
- data/lib/avm/entries/keys_constants_set.rb +43 -0
- data/lib/avm/instances/base/entry_keys.rb +1 -1
- data/lib/avm/instances/base/install.rb +24 -0
- data/lib/avm/instances/base/web.rb +16 -0
- data/lib/avm/instances/base.rb +1 -1
- data/lib/avm/instances/entry_keys.rb +3 -22
- data/lib/avm/rspec/setup.rb +7 -8
- data/lib/avm/rspec/shared_examples/entries_values.rb +23 -0
- data/lib/avm/version.rb +1 -1
- metadata +24 -21
- data/lib/avm/instances/base/auto_values/install.rb +0 -47
- data/lib/avm/instances/base/auto_values/web.rb +0 -46
- data/lib/avm/jobs/base.rb +0 -63
- data/lib/avm/jobs/variables_source.rb +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edce5f54d8e35b2991eca7c296980c8102a3f9de6079df2c3841660d91a5a09a
|
4
|
+
data.tar.gz: 1f3bb4e92e4a1d342490b54843f505c641479eec2af609dfb5c70ee81de4101f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f827370664e3b78a4808a57227b5791da8a9185522a11081a6d50f05493648135e0734a680f2abbc1fc902775249f4011cad1f669bef8f6127258edd7b357f9
|
7
|
+
data.tar.gz: c95a5acd8db7c9c8ceb104cd203c9a30bdd1438de79309869cac1c3ed1ab1d8178b91f42b436a63ec312a54fe6ef9166c9f7395d26b35b826633856f7d43af03
|
@@ -8,15 +8,22 @@ module Avm
|
|
8
8
|
module AutoValues
|
9
9
|
class Entry
|
10
10
|
class << self
|
11
|
-
|
12
|
-
|
11
|
+
# @param path [EacConfig::EntryPath]
|
12
|
+
# @return String
|
13
|
+
def auto_value_method_name(path)
|
14
|
+
"auto_#{::EacConfig::EntryPath.assert(path).to_string.gsub('.', '_')}"
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
16
|
-
|
18
|
+
# @!method initialize(entries_provider, path)
|
19
|
+
# @param entries_provider
|
20
|
+
# @param path [EacConfig::EntryPath]
|
21
|
+
common_constructor :entries_provider, :path do
|
22
|
+
self.path = ::EacConfig::EntryPath.assert(path)
|
23
|
+
end
|
17
24
|
|
18
25
|
def auto_value_method
|
19
|
-
self.class.auto_value_method_name(
|
26
|
+
self.class.auto_value_method_name(path)
|
20
27
|
end
|
21
28
|
|
22
29
|
def found?
|
@@ -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
|
data/lib/avm/entries/base.rb
CHANGED
@@ -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,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/entries/jobs/with_variables_source'
|
4
|
+
require 'avm/result'
|
5
|
+
require 'eac_cli/core_ext'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Entries
|
9
|
+
module Jobs
|
10
|
+
module Base
|
11
|
+
common_concern do
|
12
|
+
include ::ActiveSupport::Callbacks
|
13
|
+
include ::Avm::Entries::Jobs::WithVariablesSource
|
14
|
+
|
15
|
+
enable_speaker
|
16
|
+
enable_simple_cache
|
17
|
+
enable_listable
|
18
|
+
common_constructor :instance, :options, default: [{}] do
|
19
|
+
if option_list.present?
|
20
|
+
self.options = option_list.hash_keys_validate!(options.symbolize_keys)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
define_callbacks(*jobs)
|
24
|
+
end
|
25
|
+
|
26
|
+
module ClassMethods
|
27
|
+
def jobs
|
28
|
+
const_get('JOBS').dup
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
module InstanceMethods
|
33
|
+
def option_list
|
34
|
+
nil
|
35
|
+
end
|
36
|
+
|
37
|
+
def run
|
38
|
+
start_banner if respond_to?(:start_banner)
|
39
|
+
run_jobs
|
40
|
+
::Avm::Result.success('Done!')
|
41
|
+
rescue ::Avm::Result::Error => e
|
42
|
+
e.to_result
|
43
|
+
end
|
44
|
+
|
45
|
+
protected
|
46
|
+
|
47
|
+
def run_jobs
|
48
|
+
jobs.each do |job|
|
49
|
+
run_callbacks job do
|
50
|
+
send(job)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def jobs
|
56
|
+
self.class.jobs
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Entries
|
7
|
+
module Jobs
|
8
|
+
class VariablesSource
|
9
|
+
class ReadEntry
|
10
|
+
enable_method_class
|
11
|
+
common_constructor :variables_source, :path, :options, default: [{}]
|
12
|
+
delegate :instance, :job, to: :variables_source
|
13
|
+
|
14
|
+
def result
|
15
|
+
return result_from_job if result_from_job?
|
16
|
+
return result_from_instance_method if result_from_instance_method?
|
17
|
+
|
18
|
+
result_from_instance_entry
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def path_method_name
|
24
|
+
path.gsub('.', '_').underscore
|
25
|
+
end
|
26
|
+
|
27
|
+
def result_from_instance_entry
|
28
|
+
instance.read_entry(path, options)
|
29
|
+
end
|
30
|
+
|
31
|
+
def result_from_instance_method
|
32
|
+
instance.send(path_method_name)
|
33
|
+
end
|
34
|
+
|
35
|
+
def result_from_instance_method?
|
36
|
+
instance.respond_to?(path_method_name, true)
|
37
|
+
end
|
38
|
+
|
39
|
+
def result_from_job
|
40
|
+
job.send(path_method_name)
|
41
|
+
end
|
42
|
+
|
43
|
+
def result_from_job?
|
44
|
+
job.respond_to?(path_method_name, true)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Entries
|
7
|
+
module Jobs
|
8
|
+
class VariablesSource
|
9
|
+
require_sub __FILE__, require_dependency: true
|
10
|
+
common_constructor :job
|
11
|
+
delegate :instance, to: :job
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/entries/jobs/variables_source'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Entries
|
7
|
+
module Jobs
|
8
|
+
module WithVariablesSource
|
9
|
+
def variables_source
|
10
|
+
::Avm::Entries::Jobs::VariablesSource.new(self)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -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
|
data/lib/avm/instances/base.rb
CHANGED
@@ -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
|
-
|
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
|
{
|
@@ -54,7 +35,7 @@ module Avm
|
|
54
35
|
'' => %w[id from reply_to],
|
55
36
|
smtp: URI_FIELDS + %w[address domain authentication openssl_verify_mode starttls_auto tls]
|
56
37
|
},
|
57
|
-
web: URI_FIELDS
|
38
|
+
web: URI_FIELDS
|
58
39
|
}.each { |prefix, suffixes| keys_consts_set(prefix, suffixes) }
|
59
40
|
end
|
60
41
|
end
|
data/lib/avm/rspec/setup.rb
CHANGED
@@ -5,17 +5,16 @@ require 'eac_ruby_utils/core_ext'
|
|
5
5
|
module Avm
|
6
6
|
module Rspec
|
7
7
|
module Setup
|
8
|
-
|
9
|
-
obj.setup_in_avm_registry_example
|
10
|
-
obj.setup_not_in_avm_registry_example
|
11
|
-
end
|
8
|
+
EXAMPLES = %w[entries_values in_avm_registry not_in_avm_registry].freeze
|
12
9
|
|
13
|
-
def
|
14
|
-
|
10
|
+
def self.extended(obj)
|
11
|
+
obj.setup_examples
|
15
12
|
end
|
16
13
|
|
17
|
-
def
|
18
|
-
|
14
|
+
def setup_examples
|
15
|
+
EXAMPLES.each do |example|
|
16
|
+
require "avm/rspec/shared_examples/#{example}"
|
17
|
+
end
|
19
18
|
end
|
20
19
|
end
|
21
20
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
::RSpec.shared_examples 'entries_values' do |spec_file, expected_values|
|
6
|
+
describe '#read_entry' do
|
7
|
+
config_path = spec_file.to_pathname
|
8
|
+
config_path = config_path.dirname.join("#{config_path.basename_noext}_files", 'config.yml')
|
9
|
+
::EacRubyUtils::Rspec.default_setup.stub_eac_config_node(self, config_path)
|
10
|
+
|
11
|
+
expected_values.each do |instance_id, values|
|
12
|
+
values.each do |input, expected|
|
13
|
+
context "when a auto value is requested for \"#{instance_id}.#{input}\"" do
|
14
|
+
let(:instance) { described_class.by_id(instance_id) }
|
15
|
+
|
16
|
+
it ".read_entry should return \"#{expected}\"" do
|
17
|
+
expect(instance.read_entry(input)).to eq(expected)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/avm/version.rb
CHANGED
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.
|
4
|
+
version: 0.45.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-
|
11
|
+
date: 2022-09-25 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.
|
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.
|
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
|
@@ -79,7 +73,7 @@ dependencies:
|
|
79
73
|
version: '0.12'
|
80
74
|
- - ">="
|
81
75
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.12.
|
76
|
+
version: 0.12.3
|
83
77
|
type: :runtime
|
84
78
|
prerelease: false
|
85
79
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -89,21 +83,21 @@ dependencies:
|
|
89
83
|
version: '0.12'
|
90
84
|
- - ">="
|
91
85
|
- !ruby/object:Gem::Version
|
92
|
-
version: 0.12.
|
86
|
+
version: 0.12.3
|
93
87
|
- !ruby/object:Gem::Dependency
|
94
88
|
name: eac_ruby_utils
|
95
89
|
requirement: !ruby/object:Gem::Requirement
|
96
90
|
requirements:
|
97
91
|
- - "~>"
|
98
92
|
- !ruby/object:Gem::Version
|
99
|
-
version: '0.
|
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.
|
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.
|
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.
|
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,18 @@ 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/jobs.rb
|
245
|
+
- lib/avm/entries/jobs/base.rb
|
246
|
+
- lib/avm/entries/jobs/variables_source.rb
|
247
|
+
- lib/avm/entries/jobs/variables_source/read_entry.rb
|
248
|
+
- lib/avm/entries/jobs/with_variables_source.rb
|
249
|
+
- lib/avm/entries/keys_constants_set.rb
|
245
250
|
- lib/avm/entries/uri_builder.rb
|
246
251
|
- lib/avm/executables.rb
|
247
252
|
- lib/avm/instances.rb
|
@@ -249,19 +254,16 @@ files:
|
|
249
254
|
- lib/avm/instances/base/auto_values.rb
|
250
255
|
- lib/avm/instances/base/auto_values/data.rb
|
251
256
|
- lib/avm/instances/base/auto_values/database.rb
|
252
|
-
- lib/avm/instances/base/auto_values/install.rb
|
253
257
|
- lib/avm/instances/base/auto_values/mailer.rb
|
254
258
|
- lib/avm/instances/base/auto_values/ruby.rb
|
255
259
|
- lib/avm/instances/base/auto_values/source.rb
|
256
|
-
- lib/avm/instances/base/auto_values/web.rb
|
257
260
|
- lib/avm/instances/base/dockerizable.rb
|
258
261
|
- lib/avm/instances/base/entry_keys.rb
|
262
|
+
- lib/avm/instances/base/install.rb
|
263
|
+
- lib/avm/instances/base/web.rb
|
259
264
|
- lib/avm/instances/docker_image.rb
|
260
265
|
- lib/avm/instances/entry_keys.rb
|
261
266
|
- lib/avm/instances/runner.rb
|
262
|
-
- lib/avm/jobs.rb
|
263
|
-
- lib/avm/jobs/base.rb
|
264
|
-
- lib/avm/jobs/variables_source.rb
|
265
267
|
- lib/avm/launcher/errors/base.rb
|
266
268
|
- lib/avm/launcher/errors/non_project.rb
|
267
269
|
- lib/avm/launcher/paths/real.rb
|
@@ -282,6 +284,7 @@ files:
|
|
282
284
|
- lib/avm/result.rb
|
283
285
|
- lib/avm/rspec.rb
|
284
286
|
- lib/avm/rspec/setup.rb
|
287
|
+
- lib/avm/rspec/shared_examples/entries_values.rb
|
285
288
|
- lib/avm/rspec/shared_examples/in_avm_registry.rb
|
286
289
|
- lib/avm/rspec/shared_examples/not_in_avm_registry.rb
|
287
290
|
- lib/avm/runners/base.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
|
data/lib/avm/jobs/base.rb
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/jobs/variables_source'
|
4
|
-
require 'avm/result'
|
5
|
-
require 'eac_cli/core_ext'
|
6
|
-
|
7
|
-
module Avm
|
8
|
-
module Jobs
|
9
|
-
module Base
|
10
|
-
common_concern do
|
11
|
-
include ::ActiveSupport::Callbacks
|
12
|
-
|
13
|
-
enable_speaker
|
14
|
-
enable_simple_cache
|
15
|
-
enable_listable
|
16
|
-
common_constructor :instance, :options, default: [{}] do
|
17
|
-
if option_list.present?
|
18
|
-
self.options = option_list.hash_keys_validate!(options.symbolize_keys)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
define_callbacks(*jobs)
|
22
|
-
end
|
23
|
-
|
24
|
-
module ClassMethods
|
25
|
-
def jobs
|
26
|
-
const_get('JOBS').dup
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
module InstanceMethods
|
31
|
-
def option_list
|
32
|
-
nil
|
33
|
-
end
|
34
|
-
|
35
|
-
def run
|
36
|
-
start_banner if respond_to?(:start_banner)
|
37
|
-
run_jobs
|
38
|
-
::Avm::Result.success('Done!')
|
39
|
-
rescue ::Avm::Result::Error => e
|
40
|
-
e.to_result
|
41
|
-
end
|
42
|
-
|
43
|
-
def variables_source
|
44
|
-
::Avm::Jobs::VariablesSource.new(self, instance)
|
45
|
-
end
|
46
|
-
|
47
|
-
protected
|
48
|
-
|
49
|
-
def run_jobs
|
50
|
-
jobs.each do |job|
|
51
|
-
run_callbacks job do
|
52
|
-
send(job)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def jobs
|
58
|
-
self.class.jobs
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module Jobs
|
7
|
-
class VariablesSource
|
8
|
-
common_constructor :job, :instance
|
9
|
-
|
10
|
-
def read_entry(path, options = {})
|
11
|
-
entry_from_job(path) || instance.read_entry(path, options)
|
12
|
-
end
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
def entry_from_job(path)
|
17
|
-
method = path.gsub('.', '_').underscore
|
18
|
-
return job.send(method) if job.respond_to?(method, true)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|