avm 0.55.0 → 0.56.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: 4a1e14183c236b827b6b39bc79d7fb1a1ab6ace3284d897e634d692581db10f8
4
- data.tar.gz: 2c03c7564a37f2df94acd5b22b0288eaff35179b3f41c41ae7924db4cd54afa5
3
+ metadata.gz: 2fe83959f89ed9d43c44578111aa230b740036e6d9231b5c80a6a59ba777d7cc
4
+ data.tar.gz: 48911ce71466c63dbe3e8dd4ab84f0ecfa061a1c7c55103150ce325bcf745462
5
5
  SHA512:
6
- metadata.gz: 933eceb86eea9a697e57cfd6219449cc2f07fdaabde00facdf67a69d7eb26f1f46b843fd19686a096fb4d2bb6a2396203c98b7d831780df68ae8db2dd4c0f728
7
- data.tar.gz: 8030a0bff5ea657b2a4c196b68cb0d3b27984a276bce196609b090564206dc130966d0e880242226931fa79f4d1f9ba2ffec3a0c7151c466cc38686ba6142ef6
6
+ metadata.gz: 210f097d0c4f57a0fa0a1bbf64e83e9d4a116250ba552f477401fbc5064eaa7f781c7ff1a3115b5a42844299728578cc13508c663031c2e287994d0507f7b488
7
+ data.tar.gz: 7b65907b3c3201914d97d1e3efa2a740b26dcb87cd820e689a81fdcfbb6e0e1d21619807a6a0f02759af964cae5f0278020eea4dce16672e8aad391bc6d8ee8d
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/registry'
4
+ require 'eac_ruby_utils/blank_not_blank'
5
+ require 'eac_ruby_utils/core_ext'
6
+
7
+ module Avm
8
+ module Applications
9
+ class Base
10
+ module Publishing
11
+ PUBLISHABLE_KEY = 'publishable'
12
+
13
+ def publishable?
14
+ publishable_value ? true : false
15
+ end
16
+
17
+ def stereotype_publishable?(stereotype)
18
+ return publishable? unless publishable_value.is_a?(::Hash)
19
+
20
+ parse_publishable_value(publishable_value[stereotype.stereotype_name], true)
21
+ end
22
+
23
+ private
24
+
25
+ def publishable_value
26
+ parse_publishable_value(entry(PUBLISHABLE_KEY).optional_value, false)
27
+ end
28
+
29
+ def parse_publishable_value(value, hash_to_true) # rubocop:disable Metrics/CyclomaticComplexity
30
+ return value.with_indifferent_access if parse_publishable_value_hash?(value, hash_to_true)
31
+ return true if value.nil? || value == true
32
+ return false if value == false || value.is_a?(::EacRubyUtils::BlankNotBlank)
33
+
34
+ value ? true : false
35
+ end
36
+
37
+ def parse_publishable_value_hash?(value, hash_to_true)
38
+ !hash_to_true && value.is_a?(::Hash)
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -54,6 +54,7 @@ module Avm
54
54
  end
55
55
 
56
56
  def write_cache_file(data)
57
+ cache_file_path.to_pathname.parent.mkpath
57
58
  ::File.write(cache_file_path, data.to_yaml)
58
59
  end
59
60
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  require 'active_support/core_ext/hash/indifferent_access'
4
4
  require 'avm/launcher/context/instance_manager'
5
+ require 'eac_fs/contexts'
6
+ require 'eac_fs/core_ext'
5
7
  require 'eac_ruby_utils/simple_cache'
6
8
  require 'eac_cli/speaker'
7
9
  require 'avm/launcher/context/instance_discovery'
@@ -76,8 +78,9 @@ module Avm
76
78
  send("default_#{key}".underscore)
77
79
  end
78
80
 
81
+ # @return [String]
79
82
  def default_projects_root
80
- '.'
83
+ '.'.to_pathname.expand_path.to_path
81
84
  end
82
85
 
83
86
  def default_settings_file
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module Launcher
5
+ module Instances
6
+ module Base
7
+ module Publishing
8
+ def publish?(stereotype)
9
+ publish_by_stereotype?(stereotype) && publish_by_application?(stereotype) &&
10
+ publish_by_context?(stereotype)
11
+ end
12
+
13
+ # @return [Boolean]
14
+ def publish_by_application?(stereotype)
15
+ application.stereotype_publishable?(stereotype)
16
+ end
17
+
18
+ # @return [Boolean]
19
+ def publish_by_context?(stereotype)
20
+ filter = ::Avm::Launcher::Context.current.publish_options[:stereotype]
21
+ filter.blank? ? true : filter == stereotype.name.demodulize
22
+ end
23
+
24
+ # @return [Boolean]
25
+ def publish_by_stereotype?(stereotype)
26
+ stereotype.publish_class.present?
27
+ end
28
+
29
+ # @return [Boolean]
30
+ delegate :publishable?, to: :application
31
+
32
+ def publish_check
33
+ stereotypes.each do |s|
34
+ next unless publish?(s)
35
+
36
+ puts "#{name.to_s.cyan}|#{s.label}|" \
37
+ "#{s.publish_class.new(self).check}"
38
+ end
39
+ end
40
+
41
+ def publish_run
42
+ stereotypes.each do |s|
43
+ next unless publish?(s)
44
+
45
+ infov(name, "publishing #{s.label}")
46
+ s.publish_class.new(self).run
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'base/cache'
4
3
  require 'avm/launcher/errors/non_project'
4
+ require 'avm/registry'
5
5
  require 'eac_ruby_utils/speaker/sender'
6
6
 
7
7
  module Avm
@@ -13,6 +13,7 @@ module Avm
13
13
  object.extend ::EacRubyUtils::SimpleCache
14
14
  object.extend ::EacRubyUtils::Speaker::Sender
15
15
  object.extend ::Avm::Launcher::Instances::Base::Cache
16
+ object.extend ::Avm::Launcher::Instances::Base::Publishing
16
17
  super
17
18
  end
18
19
 
@@ -27,8 +28,15 @@ module Avm
27
28
  end
28
29
  end
29
30
 
31
+ require_sub __FILE__
32
+
30
33
  attr_accessor :parent
31
34
 
35
+ # @return [Avm::Applications::Base]
36
+ def application
37
+ @application ||= ::Avm::Registry.applications.detect(project_name)
38
+ end
39
+
32
40
  def name
33
41
  logical
34
42
  end
@@ -47,24 +55,6 @@ module Avm
47
55
  stereotypes.any?
48
56
  end
49
57
 
50
- def publish_run
51
- stereotypes.each do |s|
52
- next unless publish?(s)
53
-
54
- infov(name, "publishing #{s.label}")
55
- s.publish_class.new(self).run
56
- end
57
- end
58
-
59
- def publish_check
60
- stereotypes.each do |s|
61
- next unless publish?(s)
62
-
63
- puts "#{name.to_s.cyan}|#{s.label}|" \
64
- "#{s.publish_class.new(self).check}"
65
- end
66
- end
67
-
68
58
  def project_name
69
59
  ::File.basename(logical)
70
60
  end
@@ -79,14 +69,6 @@ module Avm
79
69
 
80
70
  private
81
71
 
82
- def publish?(stereotype)
83
- return false unless stereotype.publish_class
84
- return false unless options.stereotype_publishable?(stereotype)
85
-
86
- filter = ::Avm::Launcher::Context.current.publish_options[:stereotype]
87
- filter.blank? ? true : filter == stereotype.name.demodulize
88
- end
89
-
90
72
  def options_uncached
91
73
  ::Avm::Launcher::Context.current.settings.instance_settings(self)
92
74
  end
@@ -8,7 +8,6 @@ module Avm
8
8
  class Settings
9
9
  DEFAULT_CURRENT_REVISION = 'origin/master'
10
10
  DEFAULT_PUBLISH_REMOTE = 'publish'
11
- PUBLISHABLE_KEY = :publishable
12
11
 
13
12
  common_constructor :data do
14
13
  self.data = (data.is_a?(Hash) ? data : {}).with_indifferent_access
@@ -21,34 +20,6 @@ module Avm
21
20
  def git_publish_remote
22
21
  data[__method__] || DEFAULT_PUBLISH_REMOTE
23
22
  end
24
-
25
- def publishable?
26
- publishable_value ? true : false
27
- end
28
-
29
- def stereotype_publishable?(stereotype)
30
- return publishable? unless publishable_value.is_a?(::Hash)
31
-
32
- parse_publishable_value(publishable_value[stereotype.stereotype_name], true)
33
- end
34
-
35
- private
36
-
37
- def publishable_value
38
- parse_publishable_value(data[PUBLISHABLE_KEY], false)
39
- end
40
-
41
- def parse_publishable_value(value, hash_to_true)
42
- return value.with_indifferent_access if parse_publishable_value_hash?(value, hash_to_true)
43
- return true if value.nil? || value == true
44
- return false if value == false
45
-
46
- value ? true : false
47
- end
48
-
49
- def parse_publishable_value_hash?(value, hash_to_true)
50
- !hash_to_true && value.is_a?(::Hash)
51
- end
52
23
  end
53
24
  end
54
25
  end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/applications/base'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Registry
8
+ class Applications
9
+ def initialize(*args); end
10
+
11
+ # @return [Array<Avm::Applications::Base>]
12
+ def available
13
+ detected.values
14
+ end
15
+
16
+ # @return [Avm::Applications::Base]
17
+ def detect(id)
18
+ id = id.to_s
19
+ detected[id] = ::Avm::Applications::Base.new(id) unless detected.key?(id)
20
+ detected[id]
21
+ end
22
+
23
+ private
24
+
25
+ # @return [Hash<String, Avm::Applications::Base>]
26
+ def detected
27
+ @detected ||= {}
28
+ end
29
+ end
30
+ end
31
+ end
data/lib/avm/registry.rb CHANGED
@@ -7,7 +7,7 @@ module Avm
7
7
  module Registry
8
8
  require_sub __FILE__
9
9
  enable_listable
10
- lists.add_symbol :category, :application_stereotypes, :file_formats, :instances,
10
+ lists.add_symbol :category, :applications, :application_stereotypes, :file_formats, :instances,
11
11
  :launcher_stereotypes, :runners, :scms, :source_generators, :sources
12
12
 
13
13
  class << self
@@ -25,6 +25,7 @@ module Avm
25
25
  # @return [self]
26
26
  def stub_avm_contexts
27
27
  stub_eac_config_node
28
+ stub_eac_fs_contexts
28
29
  stub_eac_speaker
29
30
 
30
31
  self
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.55.0'
4
+ VERSION = '0.56.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.55.0
4
+ version: 0.56.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-11-02 00:00:00.000000000 Z
11
+ date: 2022-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -78,14 +78,14 @@ dependencies:
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '0.14'
81
+ version: '0.15'
82
82
  type: :runtime
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: '0.14'
88
+ version: '0.15'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: eac_git
91
91
  requirement: !ruby/object:Gem::Requirement
@@ -107,6 +107,9 @@ dependencies:
107
107
  - - "~>"
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0.107'
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 0.107.1
110
113
  type: :runtime
111
114
  prerelease: false
112
115
  version_requirements: !ruby/object:Gem::Requirement
@@ -114,6 +117,9 @@ dependencies:
114
117
  - - "~>"
115
118
  - !ruby/object:Gem::Version
116
119
  version: '0.107'
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: 0.107.1
117
123
  - !ruby/object:Gem::Dependency
118
124
  name: eac_templates
119
125
  requirement: !ruby/object:Gem::Requirement
@@ -255,6 +261,7 @@ files:
255
261
  - lib/avm/application_stereotypes/base.rb
256
262
  - lib/avm/applications.rb
257
263
  - lib/avm/applications/base.rb
264
+ - lib/avm/applications/base/publishing.rb
258
265
  - lib/avm/applications/base/stereotype.rb
259
266
  - lib/avm/data/instance.rb
260
267
  - lib/avm/data/instance/files_unit.rb
@@ -327,6 +334,7 @@ files:
327
334
  - lib/avm/launcher/instances.rb
328
335
  - lib/avm/launcher/instances/base.rb
329
336
  - lib/avm/launcher/instances/base/cache.rb
337
+ - lib/avm/launcher/instances/base/publishing.rb
330
338
  - lib/avm/launcher/instances/error.rb
331
339
  - lib/avm/launcher/instances/runner_helper.rb
332
340
  - lib/avm/launcher/instances/settings.rb
@@ -344,6 +352,7 @@ files:
344
352
  - lib/avm/registry/application_stereotypes.rb
345
353
  - lib/avm/registry/application_stereotypes/build_available.rb
346
354
  - lib/avm/registry/application_stereotypes/stereotype_builder.rb
355
+ - lib/avm/registry/applications.rb
347
356
  - lib/avm/registry/file_formats.rb
348
357
  - lib/avm/registry/from_gems.rb
349
358
  - lib/avm/registry/instances.rb