avm 0.80.0 → 0.82.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: '07288db64613db9f7542a592edf18a5ef9c23319b0e89dd14fa475c90c76429d'
4
- data.tar.gz: 20510a4b8aea2c182c067ec62be6faba8e45f268e3a7830a8af0358543881151
3
+ metadata.gz: ba7de7fb51ef4cb64b226e0f9797ceee1253fd91aec2db6dc97d51fa9ea1d9a0
4
+ data.tar.gz: f6d75846fd246eba14ebb2b20dd0075c3c83d4177b4d017f806763bf1f9bf5df
5
5
  SHA512:
6
- metadata.gz: a2cf4806ecc92f0e7aff8793e9e9157f06564396770df043cbafbc7ee164dd0f86d1bf547b3b5ddd42d7f113fd9d73884725506bf7369394964d66fdd1450c75
7
- data.tar.gz: 26611244b005c70d57d1625de6a55b1332a397769906fd0958aac6a931a61b7ddc18041471b14b5f2365e09b872311bfcf5455d254754956d6f4568488705208
6
+ metadata.gz: 79c47096a1c10051bfa2c1371f8417a65375c386c81be0dc85998e95a3f11e4fba147760571a3f1e8506ab6e16dcfebcbb45307ab64bef6695c00c283cf2802f
7
+ data.tar.gz: 9e92f65585c980504fc39eb098728c8be153a9cf70d7e0ba9656e0572cf6a9db593d20e829ba94bbbbc71480b6afeca16a6d0cb01069f6f7e378e9dd96f6ed74
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module ApplicationScms
7
+ class Base
8
+ acts_as_abstract
9
+
10
+ class << self
11
+ # @return [String]
12
+ def type_name
13
+ name.gsub(/#{Regexp.quote('::ApplicationScms::Base')}$/, '').demodulize
14
+ end
15
+ end
16
+
17
+ # !method initialize(application)
18
+ # @param application [Avm::Application::Base]
19
+ common_constructor :application
20
+ delegate :type_name, to: :class
21
+
22
+ # @param path [Pathname]
23
+ # @return [Pathname]
24
+ def assert_main_at(path) # rubocop:disable Lint/UnusedMethodArgument
25
+ raise_abstract_method __method__
26
+ end
27
+
28
+ # @return [String]
29
+ def to_s
30
+ "#{type_name}[#{to_s_type_specific}]"
31
+ end
32
+
33
+ # @return [String]
34
+ def to_s_type_specific
35
+ ''
36
+ end
37
+ end
38
+ end
39
+ 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,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_fs/core_ext'
4
+
5
+ module Avm
6
+ module Applications
7
+ class Base
8
+ class AutoLocalSourcePath
9
+ acts_as_instance_method
10
+ common_constructor :application
11
+
12
+ # @return [Pathname]
13
+ def result
14
+ application.scm.assert_main_at(fs_cache.path.to_pathname)
15
+ end
16
+
17
+ # @return [String]
18
+ def fs_object_id
19
+ application.id.to_s.parameterize
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -10,7 +10,7 @@ module Avm
10
10
  module LocalSource
11
11
  # @return [Pathname]
12
12
  def local_source_path
13
- local_source_path_entry.value!.to_pathname
13
+ (local_source_path_entry.value || auto_local_source_path).to_pathname
14
14
  end
15
15
 
16
16
  # @return [EacConfig::Entry]
@@ -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 ssh_username type]
12
+ end
13
+
14
+ # @return [Avm::ApplicationScms::Base]
15
+ def scm
16
+ @scm ||= ::Avm::Registry.application_scms.detect(self)
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.fetch(0).scm_type
10
+
11
+ klass.new(*detect_args)
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.82.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.82.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-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -237,15 +237,19 @@ 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
243
245
  - lib/avm/applications/base.rb
246
+ - lib/avm/applications/base/auto_local_source_path.rb
244
247
  - lib/avm/applications/base/local_instance.rb
245
248
  - lib/avm/applications/base/local_source.rb
246
249
  - lib/avm/applications/base/naming.rb
247
250
  - lib/avm/applications/base/organization.rb
248
251
  - lib/avm/applications/base/publishing.rb
252
+ - lib/avm/applications/base/scm.rb
249
253
  - lib/avm/applications/base/stereotype.rb
250
254
  - lib/avm/data/callbacks.rb
251
255
  - lib/avm/data/clearer.rb
@@ -344,8 +348,10 @@ files:
344
348
  - lib/avm/launcher/publish/check_result.rb
345
349
  - lib/avm/launcher/stereotype.rb
346
350
  - lib/avm/launcher_stereotypes.rb
351
+ - lib/avm/patches/eac_config/entry_path.rb
347
352
  - lib/avm/path_string.rb
348
353
  - lib/avm/registry.rb
354
+ - lib/avm/registry/application_scms.rb
349
355
  - lib/avm/registry/application_stereotypes.rb
350
356
  - lib/avm/registry/application_stereotypes/build_available.rb
351
357
  - lib/avm/registry/application_stereotypes/stereotype_builder.rb