avm 0.80.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: '07288db64613db9f7542a592edf18a5ef9c23319b0e89dd14fa475c90c76429d'
4
- data.tar.gz: 20510a4b8aea2c182c067ec62be6faba8e45f268e3a7830a8af0358543881151
3
+ metadata.gz: c5aaacb2872fccfe58ccdafad10e0a1c431b2c86e020cdda80a9d352d6771451
4
+ data.tar.gz: cf56541de76d828f5fdfa7fb1bd192fee610614ca7b51c02941f6e5293c801c0
5
5
  SHA512:
6
- metadata.gz: a2cf4806ecc92f0e7aff8793e9e9157f06564396770df043cbafbc7ee164dd0f86d1bf547b3b5ddd42d7f113fd9d73884725506bf7369394964d66fdd1450c75
7
- data.tar.gz: 26611244b005c70d57d1625de6a55b1332a397769906fd0958aac6a931a61b7ddc18041471b14b5f2365e09b872311bfcf5455d254754956d6f4568488705208
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,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
@@ -7,11 +7,18 @@ module Avm
7
7
  module Applications
8
8
  class Base
9
9
  enable_simple_cache
10
- require_sub __FILE__, include_modules: true
11
10
  include ::Avm::Entries::Base
12
11
 
13
12
  AVM_TYPE = 'Application'
14
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
21
+
15
22
  common_constructor :id do
16
23
  self.id = id.to_s
17
24
  end
@@ -23,6 +30,8 @@ module Avm
23
30
  def instance(suffix)
24
31
  stereotype.instance_class.new(self, suffix)
25
32
  end
33
+
34
+ require_sub __FILE__, include_modules: true
26
35
  end
27
36
  end
28
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
@@ -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.80.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.80.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-10-24 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
@@ -237,6 +237,8 @@ extensions: []
237
237
  extra_rdoc_files: []
238
238
  files:
239
239
  - lib/avm.rb
240
+ - lib/avm/application_scms.rb
241
+ - lib/avm/application_scms/base.rb
240
242
  - lib/avm/application_stereotypes.rb
241
243
  - lib/avm/application_stereotypes/base.rb
242
244
  - lib/avm/applications.rb
@@ -246,6 +248,7 @@ files:
246
248
  - lib/avm/applications/base/naming.rb
247
249
  - lib/avm/applications/base/organization.rb
248
250
  - lib/avm/applications/base/publishing.rb
251
+ - lib/avm/applications/base/scm.rb
249
252
  - lib/avm/applications/base/stereotype.rb
250
253
  - lib/avm/data/callbacks.rb
251
254
  - lib/avm/data/clearer.rb
@@ -344,8 +347,10 @@ files:
344
347
  - lib/avm/launcher/publish/check_result.rb
345
348
  - lib/avm/launcher/stereotype.rb
346
349
  - lib/avm/launcher_stereotypes.rb
350
+ - lib/avm/patches/eac_config/entry_path.rb
347
351
  - lib/avm/path_string.rb
348
352
  - lib/avm/registry.rb
353
+ - lib/avm/registry/application_scms.rb
349
354
  - lib/avm/registry/application_stereotypes.rb
350
355
  - lib/avm/registry/application_stereotypes/build_available.rb
351
356
  - lib/avm/registry/application_stereotypes/stereotype_builder.rb