avm 0.72.0 → 0.73.1

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: 9ffe2b9afc29fb661c8ba611355b5404deaea76ff43aa31c59180035e8942acf
4
- data.tar.gz: f66cf38833ff6ab3a0b1be19f739ce0620b79d8614828396440d11aade4d4525
3
+ metadata.gz: 7982b293a654555c267bc2f3b8856a40e4e60a5ee2a9bcc08796d4814a811c15
4
+ data.tar.gz: 6a8ade3bc981708360d1cecdb7e9ee1461d0fad4ff3daa0ae7de1f6636e99e9d
5
5
  SHA512:
6
- metadata.gz: 52928731a9e75e5b7664b01b2ebe21121fa848b79220e80e6c216beecd03eb8593a3abf876086d69123fe1a15d11310395cd5edbfa2875cf3814978d4b8e36de
7
- data.tar.gz: 560b52184f5ec719930168746726ab02c8768bc514a1f10cec54d5e5b08a0649c1b61711a59796fff5cdebc689faf80c2a4cd6400db54965ba953c6bbcaf49d2
6
+ metadata.gz: 32e5a58c320316929d9d954b98a284f40e4231af15b848513cdfcfc91364ad20362b95c05af1fe6c3f4822fc786a981129c8d3878d55104189f2d7af91c442f9
7
+ data.tar.gz: de0f2e9f63d6bd9e3aac64f36ef505f028494462e6e734b42efc1c88be62bb77041e3c2a8ff31a92293884e4d3e73872a9c95e219fc7e3909d6308de124563cc
@@ -1,17 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/data/performer'
3
4
  require 'eac_ruby_utils/core_ext'
4
5
 
5
6
  module Avm
6
7
  module Data
7
- class Clearer
8
- enable_speaker
8
+ class Clearer < ::Avm::Data::Performer
9
+ def cannot_perform_reason
10
+ nil
11
+ end
9
12
 
10
- common_constructor :storage
13
+ protected
11
14
 
12
- # @return [self]
13
- def perform
14
- storage.clear
15
+ def internal_perform
16
+ data_owner.clear(*include_excludes_arguments)
15
17
  end
16
18
  end
17
19
  end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Data
7
+ class Package
8
+ class BasePerformer
9
+ acts_as_abstract :result
10
+ enable_speaker
11
+ enable_listable
12
+ lists.add_symbol :option, :excludes, :includes
13
+ common_constructor :package, :options, default: [{}] do
14
+ self.options = ::Avm::Data::Package::BasePerformer.lists.option
15
+ .hash_keys_validate!(options)
16
+ end
17
+
18
+ # @return [Set<Symbol>]
19
+ def excludes
20
+ ::Set.new((options[OPTION_EXCLUDES] || []).map(&:to_sym))
21
+ end
22
+
23
+ # @return [Set<Symbol>]
24
+ def includes
25
+ ::Set.new((options[OPTION_INCLUDES] || []).map(&:to_sym))
26
+ end
27
+
28
+ # @return [Hash<Symbol, Avm::Data::Unit]
29
+ def selected_units
30
+ r = package.units
31
+ r = r.slice(*includes.to_a) if includes.any?
32
+ r = r.except(*excludes.to_a) if excludes.any?
33
+ r
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,18 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/data/package/base_performer'
3
4
  require 'eac_ruby_utils/core_ext'
4
5
 
5
6
  module Avm
6
7
  module Data
7
8
  class Package
8
- class Clear
9
+ class Clear < ::Avm::Data::Package::BasePerformer
9
10
  enable_method_class
10
- enable_speaker
11
- common_constructor :package
12
11
 
13
12
  # @return [void]
14
13
  def result
15
- package.units.each do |identifier, unit|
14
+ selected_units.each do |identifier, unit|
16
15
  infov 'Clearing unit', identifier
17
16
  unit.clear
18
17
  end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/data/rotate'
4
+ require 'eac_ruby_utils/core_ext'
5
+ require 'eac_ruby_utils/fs/temp'
6
+
7
+ module Avm
8
+ module Data
9
+ class Performer
10
+ acts_as_abstract(:cannot_perform_reason, :internal_perform)
11
+ acts_as_immutable
12
+ common_constructor :data_owner
13
+ immutable_accessor :exclude, :include, type: :set
14
+
15
+ # @return [Enumerable]
16
+ def immutable_constructor_args
17
+ [data_owner]
18
+ end
19
+
20
+ # @return [self]
21
+ def perform
22
+ raise "Cannot run: #{cannot_run_reason}" unless performable?
23
+
24
+ internal_perform
25
+
26
+ self
27
+ end
28
+
29
+ # @return [Boolean]
30
+ def performable?
31
+ cannot_perform_reason.blank?
32
+ end
33
+
34
+ protected
35
+
36
+ def include_excludes_arguments
37
+ options = include_excludes_options
38
+ options.any? ? [options] : []
39
+ end
40
+
41
+ def include_excludes_options
42
+ r = {}
43
+ r[:includes] = includes if includes.any?
44
+ r[:excludes] = excludes if excludes.any?
45
+ r
46
+ end
47
+ end
48
+ end
49
+ end
@@ -7,15 +7,15 @@ module Avm
7
7
  module Instances
8
8
  class Base
9
9
  class SubcommandParent
10
+ include ::EacCli::Runner
10
11
  enable_simple_cache
11
- common_constructor :instance
12
+ common_constructor :instance do
13
+ self.runner_context = ::EacCli::Runner::Context.new(self, argv: runner_argv)
14
+ end
15
+ for_context :instance
12
16
 
13
17
  private
14
18
 
15
- def runner_context_uncached
16
- ::EacCli::Runner::Context.new(self, argv: runner_argv)
17
- end
18
-
19
19
  def runner_argv
20
20
  [instance.class.name.split('::')[-2].dasherize, instance.id]
21
21
  end
@@ -13,7 +13,7 @@ module Avm
13
13
  end
14
14
 
15
15
  delegate :class, to: :instance, prefix: true
16
- delegate :stereotype_module, :stereotype_name, to: :class
16
+ for_context :instance
17
17
 
18
18
  def extra_available_subcommands
19
19
  instance.if_present({}, &:extra_available_subcommands)
@@ -28,6 +28,11 @@ module Avm
28
28
 
29
29
  private
30
30
 
31
+ # @return [Boolean]
32
+ def changed?
33
+ scm.changed_files.any? { |cf| cf.path == scm_relative_path }
34
+ end
35
+
31
36
  def commit_info_uncached
32
37
  rules.lazy.map { |rule| rule.with_file(self).commit_info }.find(&:present?)
33
38
  .if_present { |v| v.path(path) }
@@ -42,8 +47,13 @@ module Avm
42
47
  return false if commit_info.blank?
43
48
 
44
49
  infov ' Commit info', commit_info
45
- scm.run_commit(commit_info)
46
- success ' Commited'
50
+ if changed?
51
+ scm.run_commit(commit_info)
52
+ success ' Commited'
53
+ else
54
+ warn " File \"#{path}\" unchanged"
55
+ end
56
+
47
57
  true
48
58
  end
49
59
 
@@ -11,6 +11,8 @@ module Avm
11
11
  subcommands
12
12
  end
13
13
 
14
+ for_context :optional_source, :source
15
+
14
16
  def extra_available_subcommands
15
17
  optional_source.if_present({}, &:extra_available_subcommands)
16
18
  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.72.0'
4
+ VERSION = '0.73.1'
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.72.0
4
+ version: 0.73.1
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-05-18 00:00:00.000000000 Z
11
+ date: 2023-05-21 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.33'
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: 0.33.1
33
+ version: '0.35'
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.33'
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 0.33.1
40
+ version: '0.35'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: eac_config
49
43
  requirement: !ruby/object:Gem::Requirement
@@ -112,14 +106,14 @@ dependencies:
112
106
  requirements:
113
107
  - - "~>"
114
108
  - !ruby/object:Gem::Version
115
- version: '0.116'
109
+ version: '0.117'
116
110
  type: :runtime
117
111
  prerelease: false
118
112
  version_requirements: !ruby/object:Gem::Requirement
119
113
  requirements:
120
114
  - - "~>"
121
115
  - !ruby/object:Gem::Version
122
- version: '0.116'
116
+ version: '0.117'
123
117
  - !ruby/object:Gem::Dependency
124
118
  name: eac_templates
125
119
  requirement: !ruby/object:Gem::Requirement
@@ -240,10 +234,12 @@ files:
240
234
  - lib/avm/data/callbacks.rb
241
235
  - lib/avm/data/clearer.rb
242
236
  - lib/avm/data/package.rb
237
+ - lib/avm/data/package/base_performer.rb
243
238
  - lib/avm/data/package/build_directory.rb
244
239
  - lib/avm/data/package/clear.rb
245
240
  - lib/avm/data/package/dump.rb
246
241
  - lib/avm/data/package/load.rb
242
+ - lib/avm/data/performer.rb
247
243
  - lib/avm/data/rotate.rb
248
244
  - lib/avm/data/unit.rb
249
245
  - lib/avm/data/unit_with_commands.rb