avm 0.71.0 → 0.73.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/data/clearer.rb +20 -0
- data/lib/avm/data/package/base_performer.rb +38 -0
- data/lib/avm/data/package/clear.rb +22 -0
- data/lib/avm/data/package/dump.rb +0 -10
- data/lib/avm/data/package.rb +8 -1
- data/lib/avm/data/performer.rb +49 -0
- data/lib/avm/docker/runner.rb +0 -4
- data/lib/avm/instances/base/auto_values/data.rb +1 -2
- data/lib/avm/instances/base.rb +10 -0
- data/lib/avm/instances/runner.rb +1 -1
- data/lib/avm/sources/runner.rb +2 -0
- data/lib/avm/version.rb +1 -1
- metadata +12 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71ef09e6c2b4ae1021bfffe9d0f1b93535a18cb61b63fa8a3b37ab7ea12569ce
|
4
|
+
data.tar.gz: 262ce59510fdd4f3f37eed3d4f77ee8b4d6656f921156bf983994b615d37e392
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0579bf135a47e10d25b0d122a0362619fc2e6082efe3f26ebc8f8a41241d9ffbe08ee2baca96fdf0ecae2ebe7fb7687a874d37356d9b193cfeea28891396d2ca'
|
7
|
+
data.tar.gz: cc9e822de6c7c652bcc8d028b064f5b1e0f5ca59e420a8255c837eb7a4ddfca60099d5e83d1e2ccf732eaed009673d44e29a7622236cf797274af19365b97978
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/data/performer'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Data
|
8
|
+
class Clearer < ::Avm::Data::Performer
|
9
|
+
def cannot_perform_reason
|
10
|
+
nil
|
11
|
+
end
|
12
|
+
|
13
|
+
protected
|
14
|
+
|
15
|
+
def internal_perform
|
16
|
+
data_owner.clear(*include_excludes_arguments)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
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
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/data/package/base_performer'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Data
|
8
|
+
class Package
|
9
|
+
class Clear < ::Avm::Data::Package::BasePerformer
|
10
|
+
enable_method_class
|
11
|
+
|
12
|
+
# @return [void]
|
13
|
+
def result
|
14
|
+
selected_units.each do |identifier, unit|
|
15
|
+
infov 'Clearing unit', identifier
|
16
|
+
unit.clear
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -14,7 +14,6 @@ module Avm
|
|
14
14
|
include ::Avm::Data::Package::BuildDirectory
|
15
15
|
|
16
16
|
DEFAULT_EXPIRE_TIME = 1.day
|
17
|
-
DEFAULT_FILE_EXTENSION = '.tar'
|
18
17
|
|
19
18
|
attr_reader :package, :data_file_path, :existing
|
20
19
|
|
@@ -73,15 +72,6 @@ module Avm
|
|
73
72
|
|
74
73
|
private
|
75
74
|
|
76
|
-
def download
|
77
|
-
infom 'Downloading dump...'
|
78
|
-
download_path = find_download_path
|
79
|
-
dump_command.system!(output_file: download_path)
|
80
|
-
fatal_error "File \"#{download_path}\" not saved" unless ::File.exist?(download_path)
|
81
|
-
fatal_error "File \"#{download_path}\" is empty" if ::File.zero?(download_path)
|
82
|
-
download_path
|
83
|
-
end
|
84
|
-
|
85
75
|
def move_download_to_final_dest(download_path)
|
86
76
|
::FileUtils.mkdir_p(::File.dirname(data_file_path))
|
87
77
|
::FileUtils.mv(download_path, data_file_path)
|
data/lib/avm/data/package.rb
CHANGED
@@ -6,9 +6,11 @@ require 'eac_ruby_utils/core_ext'
|
|
6
6
|
module Avm
|
7
7
|
module Data
|
8
8
|
class Package
|
9
|
-
require_sub __FILE__
|
9
|
+
require_sub __FILE__, require_mode: :kernel
|
10
10
|
include ::Avm::Data::Callbacks
|
11
11
|
|
12
|
+
DATA_FILE_EXTENSION = '.tar'
|
13
|
+
|
12
14
|
def initialize(options)
|
13
15
|
options = options.to_options_consumer
|
14
16
|
units = options.consume(:units)
|
@@ -25,6 +27,11 @@ module Avm
|
|
25
27
|
self
|
26
28
|
end
|
27
29
|
|
30
|
+
# @return [String]
|
31
|
+
def data_file_extension
|
32
|
+
DATA_FILE_EXTENSION
|
33
|
+
end
|
34
|
+
|
28
35
|
def dump(data_path, options = {})
|
29
36
|
::Avm::Data::Package::Dump.new(self, data_path, options)
|
30
37
|
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
|
data/lib/avm/docker/runner.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/data/package/dump'
|
4
3
|
require 'avm/self/instance'
|
5
4
|
|
6
5
|
module Avm
|
@@ -15,7 +14,7 @@ module Avm
|
|
15
14
|
.if_present do |v|
|
16
15
|
::File.join(
|
17
16
|
v,
|
18
|
-
"#{id}#{
|
17
|
+
"#{id}#{data_package.data_file_extension}"
|
19
18
|
)
|
20
19
|
end
|
21
20
|
end
|
data/lib/avm/instances/base.rb
CHANGED
@@ -34,6 +34,16 @@ module Avm
|
|
34
34
|
self.suffix = suffix.to_s
|
35
35
|
end
|
36
36
|
|
37
|
+
# @return [Avm::Instances::Data::Package]
|
38
|
+
def data_package
|
39
|
+
@data_package ||= data_package_create
|
40
|
+
end
|
41
|
+
|
42
|
+
# @return [Avm::Instances::Data::Package]
|
43
|
+
def data_package_create
|
44
|
+
::Avm::Instances::Data::Package.new(self)
|
45
|
+
end
|
46
|
+
|
37
47
|
# @return [String]
|
38
48
|
def id
|
39
49
|
::Avm::Instances::Ids.build(application.id, suffix)
|
data/lib/avm/instances/runner.rb
CHANGED
data/lib/avm/sources/runner.rb
CHANGED
data/lib/avm/version.rb
CHANGED
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.
|
4
|
+
version: 0.73.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-05-
|
11
|
+
date: 2023-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aranha-parsers
|
@@ -16,34 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
20
|
-
- - ">="
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 0.17.1
|
19
|
+
version: '0.18'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0.
|
30
|
-
- - ">="
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 0.17.1
|
26
|
+
version: '0.18'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: eac_cli
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
31
|
- - "~>"
|
38
32
|
- !ruby/object:Gem::Version
|
39
|
-
version: '0.
|
33
|
+
version: '0.35'
|
40
34
|
type: :runtime
|
41
35
|
prerelease: false
|
42
36
|
version_requirements: !ruby/object:Gem::Requirement
|
43
37
|
requirements:
|
44
38
|
- - "~>"
|
45
39
|
- !ruby/object:Gem::Version
|
46
|
-
version: '0.
|
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.
|
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
|
+
version: '0.117'
|
123
117
|
- !ruby/object:Gem::Dependency
|
124
118
|
name: eac_templates
|
125
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -238,10 +232,14 @@ files:
|
|
238
232
|
- lib/avm/applications/base/publishing.rb
|
239
233
|
- lib/avm/applications/base/stereotype.rb
|
240
234
|
- lib/avm/data/callbacks.rb
|
235
|
+
- lib/avm/data/clearer.rb
|
241
236
|
- lib/avm/data/package.rb
|
237
|
+
- lib/avm/data/package/base_performer.rb
|
242
238
|
- lib/avm/data/package/build_directory.rb
|
239
|
+
- lib/avm/data/package/clear.rb
|
243
240
|
- lib/avm/data/package/dump.rb
|
244
241
|
- lib/avm/data/package/load.rb
|
242
|
+
- lib/avm/data/performer.rb
|
245
243
|
- lib/avm/data/rotate.rb
|
246
244
|
- lib/avm/data/unit.rb
|
247
245
|
- lib/avm/data/unit_with_commands.rb
|