avm 0.79.0 → 0.81.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: 4e75e2e4044fb0c1e42d0d5cdc2f6abb2e1997084f3d5678988bf1dc8088aa23
4
- data.tar.gz: 914822d073360376f74d24d38fe8deaf8632f8d881d5b3218142dc9607488f36
3
+ metadata.gz: c5aaacb2872fccfe58ccdafad10e0a1c431b2c86e020cdda80a9d352d6771451
4
+ data.tar.gz: cf56541de76d828f5fdfa7fb1bd192fee610614ca7b51c02941f6e5293c801c0
5
5
  SHA512:
6
- metadata.gz: 8bd934e7f40740bedc0815ac12bdfb9ebdc6430c232f1f31181818b7ec4160f5afad568e256a61772eef3efb9e9d57757028918341a7558247360bef496b0d51
7
- data.tar.gz: 040d13c6f269e1050053e750bc66af9c7d5ff4a8809450ece0d604a1a85223c9ababaca624db0d63b3368948ed726bd7603ebb242b6da428ea7161cff384827c
6
+ metadata.gz: dd31baa92bd54625915361d83eec55ecd425f241ecb216c3c01c13fa0f320dbc86e59d5e19509eeab0746911e48845881f880bd7e13382426fed44aab4b6ede0
7
+ data.tar.gz: c96a21e64aed4dd953128bee69bfb72107dc5abc6f7977154dd8e8495ad1ddc7daa93dbbdf829a4e8435547ff9da5d3153e8080c9d1e7a6c9497500bd8b347e5
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module ApplicationScms
7
+ class Base
8
+ class << self
9
+ # @return [String]
10
+ def type_name
11
+ name.gsub(/#{Regexp.quote('::ApplicationScms::Base')}$/, '').demodulize
12
+ end
13
+ end
14
+
15
+ # !method initialize(url)
16
+ # @param url [Addressable::URI]
17
+ common_constructor :url do
18
+ self.url = url.to_uri
19
+ end
20
+ delegate :type_name, to: :class
21
+
22
+ # @return [String]
23
+ def to_s
24
+ "#{type_name}[#{url}]"
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module ApplicationScms
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/ids'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Applications
8
+ class Base
9
+ module LocalInstance
10
+ LOCAL_INSTANCE_SUFFIX = 'dev'
11
+
12
+ # @return [String]
13
+ def local_instance_id
14
+ ::Avm::Instances::Ids.build(id, local_instance_suffix)
15
+ end
16
+
17
+ # @return [String]
18
+ def local_instance_suffix
19
+ LOCAL_INSTANCE_SUFFIX
20
+ end
21
+
22
+ private
23
+
24
+ # @return [Avm::Instances::Base]
25
+ def local_instance_uncached
26
+ instance(local_instance_suffix)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/registry'
4
+ require 'eac_config/node'
5
+ require 'eac_ruby_utils/core_ext'
6
+
7
+ module Avm
8
+ module Applications
9
+ class Base
10
+ module LocalSource
11
+ # @return [Pathname]
12
+ def local_source_path
13
+ local_source_path_entry.value!.to_pathname
14
+ end
15
+
16
+ # @return [EacConfig::Entry]
17
+ def local_source_path_entry
18
+ ::EacConfig::Node.context.current.entry([local_instance_id, 'install', 'path'])
19
+ end
20
+
21
+ private
22
+
23
+ # @return [Avm::Sources::Base]
24
+ def local_source_uncached
25
+ ::Avm::Registry.sources.detect(local_source_path)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Applications
7
+ class Base
8
+ module Naming
9
+ DEFAULT_NAME = '_Undefined_'
10
+
11
+ # @return [String]
12
+ def default_name
13
+ DEFAULT_NAME
14
+ end
15
+
16
+ # @return [String]
17
+ def name
18
+ name_from_configuration || default_name
19
+ end
20
+
21
+ # @return [String]
22
+ def name_from_configuration
23
+ entry(::Avm::Instances::EntryKeys::NAME).optional_value
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/registry'
4
+
5
+ module Avm
6
+ module Applications
7
+ class Base
8
+ module Organization
9
+ DEFAULT_ORGANIZATION = '_undefined_'
10
+ ORGANIZATION_CONFIG_KEY = 'organization'
11
+
12
+ # @return [String]
13
+ def default_organization
14
+ DEFAULT_ORGANIZATION
15
+ end
16
+
17
+ # @return [String, nil]
18
+ def organization_by_configuration
19
+ entry(ORGANIZATION_CONFIG_KEY).optional_value
20
+ end
21
+
22
+ # @return [String]
23
+ def organization
24
+ organization_by_configuration || default_organization
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/registry'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Applications
8
+ class Base
9
+ module Scm
10
+ common_concern do
11
+ uri_components_entries_values 'scm', %w[repos_path type]
12
+ end
13
+
14
+ # @return [Avm::ApplicationScms::Base]
15
+ def scm
16
+ @scm ||= ::Avm::Registry.application_scms.detect(scm_type, scm_url)
17
+ end
18
+
19
+ # @param value [String]
20
+ # @return [String]
21
+ def scm_repos_path_inherited_value_proc(value)
22
+ value.to_pathname.join(id).to_path
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -1,19 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/entries/base'
4
- require 'avm/instances/ids'
5
- require 'avm/registry'
6
4
  require 'eac_ruby_utils/core_ext'
7
5
 
8
6
  module Avm
9
7
  module Applications
10
8
  class Base
11
9
  enable_simple_cache
12
- require_sub __FILE__, include_modules: true
13
10
  include ::Avm::Entries::Base
14
11
 
15
12
  AVM_TYPE = 'Application'
16
- LOCAL_INSTANCE_SUFFIX = 'dev'
13
+
14
+ class << self
15
+ # @param id [String]
16
+ # @return [Avm::Applications::Base]
17
+ def by_id(id)
18
+ new(id)
19
+ end
20
+ end
17
21
 
18
22
  common_constructor :id do
19
23
  self.id = id.to_s
@@ -27,41 +31,7 @@ module Avm
27
31
  stereotype.instance_class.new(self, suffix)
28
32
  end
29
33
 
30
- def name
31
- entry(::Avm::Instances::EntryKeys::NAME).read
32
- end
33
-
34
- # @return [String]
35
- def local_instance_id
36
- ::Avm::Instances::Ids.build(id, local_instance_suffix)
37
- end
38
-
39
- # @return [Pathname]
40
- def local_source_path
41
- local_source_path_entry.value!.to_pathname
42
- end
43
-
44
- # @return [EacConfig::Entry]
45
- def local_source_path_entry
46
- ::EacConfig::Node.context.current.entry([local_instance_id, 'install', 'path'])
47
- end
48
-
49
- # @return [String]
50
- def local_instance_suffix
51
- LOCAL_INSTANCE_SUFFIX
52
- end
53
-
54
- private
55
-
56
- # @return [Avm::Instances::Base]
57
- def local_instance_uncached
58
- instance(local_instance_suffix)
59
- end
60
-
61
- # @return [Avm::Sources::Base]
62
- def local_source_uncached
63
- ::Avm::Registry.sources.detect(local_source_path)
64
- end
34
+ require_sub __FILE__, include_modules: true
65
35
  end
66
36
  end
67
37
  end
@@ -18,8 +18,23 @@ module Avm
18
18
  end
19
19
  end
20
20
 
21
+ # @param provider_id [String]
22
+ # @return [Avm::Entries::Base]
23
+ def other_entries_provider(provider_id)
24
+ other_entries_provider_class.by_id(provider_id)
25
+ end
26
+
27
+ # @return [Class]
28
+ def other_entries_provider_class
29
+ [::Avm::Instances::Base, ::Avm::Applications::Base].each do |klass|
30
+ return klass if entries_provider.is_a?(klass)
31
+ end
32
+
33
+ raise "No provider class found for \"#{entries_provider}\""
34
+ end
35
+
21
36
  def other_entry_value(instance_id)
22
- ::Avm::Instances::Base.by_id(instance_id).read_entry_optional(target_entry_suffix)
37
+ other_entries_provider(instance_id).read_entry_optional(target_entry_suffix)
23
38
  end
24
39
 
25
40
  def self_entry_value
@@ -13,8 +13,9 @@ module Avm
13
13
  common_constructor :uri_component_entry_value
14
14
  delegate :component_entry_path, :entries_provider, to: :uri_component_entry_value
15
15
 
16
+ # @return [Symbol]
16
17
  def default_value_method_name
17
- "#{component_entry_path.parts.join('_').variableize}_default_value"
18
+ component_entry_path.default_method_name
18
19
  end
19
20
 
20
21
  def result
@@ -28,8 +28,9 @@ module Avm
28
28
  ->(value) { entries_provider.send(inherited_value_block_method_name, value) }
29
29
  end
30
30
 
31
+ # @return [Symbol]
31
32
  def inherited_value_block_method_name
32
- "#{component_entry_path.parts.join('_').variableize}_inherited_value_proc".to_sym
33
+ component_entry_path.inherited_block_method_name
33
34
  end
34
35
  end
35
36
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/entries/uri_builder'
4
+ require 'avm/patches/eac_config/entry_path'
4
5
  require 'eac_ruby_utils/core_ext'
5
6
 
6
7
  module Avm
@@ -10,14 +11,8 @@ module Avm
10
11
  class GenericComponent
11
12
  common_constructor :owner, :component
12
13
  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
14
+ delegate :auto_method_name, :get_method_name, :get_optional_method_name,
15
+ to: :entry_key_path
21
16
 
22
17
  def define_auto_method
23
18
  outer_self = self
@@ -48,22 +43,12 @@ module Avm
48
43
  ::EacConfig::EntryPath.assert([prefix, component])
49
44
  end
50
45
 
51
- # @return [String]
52
- def get_method_name # rubocop:disable Naming/AccessorMethodName
53
- component_method_name
54
- end
55
-
56
- # @return [String]
57
- def get_optional_method_name # rubocop:disable Naming/AccessorMethodName
58
- get_method_name + '_optional'
59
- end
60
-
61
46
  def id_component
62
47
  @id_component ||= owner.component_factory('id')
63
48
  end
64
49
 
65
50
  def inherited_value_proc_name
66
- [component_method_name, 'inherited_value_proc'].join('_')
51
+ entry_key_path.inherited_block_method_name
67
52
  end
68
53
 
69
54
  def setup
@@ -8,6 +8,7 @@ module Avm
8
8
  module AutoValues
9
9
  module Database
10
10
  LOCAL_ADDRESS = '127.0.0.1'
11
+ LOCAL_ADDRESSES = [LOCAL_ADDRESS, '::1', 'localhost'].freeze
11
12
  DEFAULT_EXTRA = ''
12
13
  DEFAULT_HOSTNAME = LOCAL_ADDRESS
13
14
  DEFAULT_LIMIT = 5
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_config/entry_path'
4
+
5
+ module EacConfig
6
+ class EntryPath
7
+ # @return [Symbol]
8
+ def auto_method_name
9
+ method_name('auto_', '')
10
+ end
11
+
12
+ # @return [Symbol]
13
+ def default_method_name
14
+ method_name('', '_default_value')
15
+ end
16
+
17
+ # @return [Symbol]
18
+ def get_method_name # rubocop:disable Naming/AccessorMethodName
19
+ method_name('', '')
20
+ end
21
+
22
+ # @return [Symbol]
23
+ def get_optional_method_name # rubocop:disable Naming/AccessorMethodName
24
+ method_name('', '_optional')
25
+ end
26
+
27
+ # @return [Symbol]
28
+ def inherited_block_method_name
29
+ method_name('', '_inherited_value_proc')
30
+ end
31
+
32
+ # @return [String]
33
+ def variableize
34
+ parts.join('_')
35
+ end
36
+
37
+ private
38
+
39
+ # @param before [String]
40
+ # @param after [String]
41
+ # @return [Symbol]
42
+ def method_name(before, after)
43
+ "#{before}#{variableize}#{after}".to_sym
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/registry/from_gems'
4
+
5
+ module Avm
6
+ module Registry
7
+ class ApplicationScms < ::Avm::Registry::FromGems
8
+ def class_detect(klass, detect_args)
9
+ return nil unless klass.type_name == detect_args[0]
10
+
11
+ klass.new(*detect_args[1..-1])
12
+ end
13
+ end
14
+ end
15
+ end
data/lib/avm/registry.rb CHANGED
@@ -7,9 +7,9 @@ module Avm
7
7
  module Registry
8
8
  require_sub __FILE__
9
9
  enable_listable
10
- lists.add_symbol :category, :applications, :application_stereotypes, :config_objects,
11
- :file_formats, :instances, :launcher_stereotypes, :runners, :scms,
12
- :source_generators, :sources
10
+ lists.add_symbol :category, :applications, :application_scms, :application_stereotypes,
11
+ :config_objects, :file_formats, :instances, :launcher_stereotypes, :runners,
12
+ :scms, :source_generators, :sources
13
13
 
14
14
  class << self
15
15
  enable_simple_cache
@@ -13,8 +13,8 @@ require 'eac_ruby_utils/core_ext'
13
13
  context "when a auto value is requested for \"#{instance_id}.#{input}\"" do
14
14
  let(:instance) { described_class.by_id(instance_id) }
15
15
 
16
- it ".read_entry should return \"#{expected}\"" do
17
- expect(instance.read_entry(input)).to eq(expected)
16
+ it ".entry('#{input}').value should return \"#{expected}\"" do
17
+ expect(instance.entry(input).value).to eq(expected)
18
18
  end
19
19
  end
20
20
  end
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.79.0'
4
+ VERSION = '0.81.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.79.0
4
+ version: 0.81.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: 2023-06-27 00:00:00.000000000 Z
11
+ date: 2023-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -30,20 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.35'
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: 0.35.1
33
+ version: '0.38'
37
34
  type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
38
  - - "~>"
42
39
  - !ruby/object:Gem::Version
43
- version: '0.35'
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 0.35.1
40
+ version: '0.38'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: eac_config
49
43
  requirement: !ruby/object:Gem::Requirement
@@ -51,6 +45,9 @@ dependencies:
51
45
  - - "~>"
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0.14'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 0.14.1
54
51
  type: :runtime
55
52
  prerelease: false
56
53
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,6 +55,9 @@ dependencies:
58
55
  - - "~>"
59
56
  - !ruby/object:Gem::Version
60
57
  version: '0.14'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 0.14.1
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: eac_docker
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -113,6 +113,9 @@ dependencies:
113
113
  - - "~>"
114
114
  - !ruby/object:Gem::Version
115
115
  version: '0.119'
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: 0.119.2
116
119
  type: :runtime
117
120
  prerelease: false
118
121
  version_requirements: !ruby/object:Gem::Requirement
@@ -120,6 +123,9 @@ dependencies:
120
123
  - - "~>"
121
124
  - !ruby/object:Gem::Version
122
125
  version: '0.119'
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: 0.119.2
123
129
  - !ruby/object:Gem::Dependency
124
130
  name: eac_templates
125
131
  requirement: !ruby/object:Gem::Requirement
@@ -231,11 +237,18 @@ extensions: []
231
237
  extra_rdoc_files: []
232
238
  files:
233
239
  - lib/avm.rb
240
+ - lib/avm/application_scms.rb
241
+ - lib/avm/application_scms/base.rb
234
242
  - lib/avm/application_stereotypes.rb
235
243
  - lib/avm/application_stereotypes/base.rb
236
244
  - lib/avm/applications.rb
237
245
  - lib/avm/applications/base.rb
246
+ - lib/avm/applications/base/local_instance.rb
247
+ - lib/avm/applications/base/local_source.rb
248
+ - lib/avm/applications/base/naming.rb
249
+ - lib/avm/applications/base/organization.rb
238
250
  - lib/avm/applications/base/publishing.rb
251
+ - lib/avm/applications/base/scm.rb
239
252
  - lib/avm/applications/base/stereotype.rb
240
253
  - lib/avm/data/callbacks.rb
241
254
  - lib/avm/data/clearer.rb
@@ -334,8 +347,10 @@ files:
334
347
  - lib/avm/launcher/publish/check_result.rb
335
348
  - lib/avm/launcher/stereotype.rb
336
349
  - lib/avm/launcher_stereotypes.rb
350
+ - lib/avm/patches/eac_config/entry_path.rb
337
351
  - lib/avm/path_string.rb
338
352
  - lib/avm/registry.rb
353
+ - lib/avm/registry/application_scms.rb
339
354
  - lib/avm/registry/application_stereotypes.rb
340
355
  - lib/avm/registry/application_stereotypes/build_available.rb
341
356
  - lib/avm/registry/application_stereotypes/stereotype_builder.rb