avm-tools 0.149.0 → 0.151.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/tools/runner/instance/data/dump.rb +2 -48
- data/lib/avm/tools/runner/instance/data/load.rb +2 -40
- data/lib/avm/tools/runner/instance/data/unit/dump.rb +1 -22
- data/lib/avm/tools/runner/instance/data/unit/load.rb +1 -12
- data/lib/avm/tools/runner_with/instance_data_clear.rb +5 -12
- data/lib/avm/tools/runner_with/instance_data_dump.rb +59 -0
- data/lib/avm/tools/runner_with/instance_data_load.rb +69 -0
- data/lib/avm/tools/runner_with/instance_data_performer.rb +40 -0
- data/lib/avm/tools/version.rb +1 -1
- metadata +13 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c60d219cf0cd61916b844199ecf17b1e097a24831776d6b4269affecfc3a482d
|
4
|
+
data.tar.gz: c92fc021d025e424f14c0a39cde75e8441bead7ec59a9eb89fe1165b557cc8d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 382924d03ba66a9b11f54caed5fc5ec47944b279b6b87a95efa97e77aeb89586fd8c737b34185920e18c6c5019bfd3b82d7203f275add9a5e92240e9daab1504
|
7
|
+
data.tar.gz: f237e441c5abd9ac5e5a41e77074391d7df475c2f85029725f34d433dac02a35968bdeab5846426bb537eb499a49c449768e7dba846a71b4fcfaf172d2cd3737
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/data/package/dump'
|
4
3
|
require 'avm/instances/runner'
|
5
4
|
require 'eac_cli/core_ext'
|
6
5
|
|
@@ -10,53 +9,8 @@ module Avm
|
|
10
9
|
class Instance < ::Avm::Instances::Runner
|
11
10
|
class Data
|
12
11
|
class Dump
|
13
|
-
|
14
|
-
|
15
|
-
'dump was expired.'
|
16
|
-
|
17
|
-
runner_with :help do
|
18
|
-
desc 'Dump utility for EacRailsBase instance.'
|
19
|
-
bool_opt '-w', '--rewrite', 'Forces dump overwrite.'
|
20
|
-
pos_arg :dump_path, optional: true
|
21
|
-
end
|
22
|
-
|
23
|
-
# @return [String]
|
24
|
-
def help_extra_text
|
25
|
-
"Default dump path: \"#{default_dump_path}\""
|
26
|
-
end
|
27
|
-
|
28
|
-
def run
|
29
|
-
infov 'Instance to dump', "#{instance} (#{instance.class})"
|
30
|
-
if package_dump.runnable?
|
31
|
-
package_dump.run
|
32
|
-
else
|
33
|
-
warn(package_dump.cannot_run_reason)
|
34
|
-
end
|
35
|
-
success("Dump path: \"#{dump_path}\"")
|
36
|
-
dump_path
|
37
|
-
end
|
38
|
-
|
39
|
-
private
|
40
|
-
|
41
|
-
def package_dump_uncached
|
42
|
-
instance
|
43
|
-
.data_package.dump(dump_path, existing: package_dump_existing)
|
44
|
-
end
|
45
|
-
|
46
|
-
def dump_path
|
47
|
-
parsed.dump_path || default_dump_path
|
48
|
-
end
|
49
|
-
|
50
|
-
def default_dump_path
|
51
|
-
instance.data_default_dump_path
|
52
|
-
end
|
53
|
-
|
54
|
-
def package_dump_existing
|
55
|
-
if parsed.rewrite?
|
56
|
-
::Avm::Data::Package::Dump::EXISTING_ROTATE
|
57
|
-
else
|
58
|
-
::Avm::Data::Package::Dump::EXISTING_ROTATE_EXPIRED
|
59
|
-
end
|
12
|
+
runner_with :help, :include_exclude, :instance_data_dump do
|
13
|
+
desc 'Dump utility for instance.'
|
60
14
|
end
|
61
15
|
end
|
62
16
|
end
|
@@ -9,46 +9,8 @@ module Avm
|
|
9
9
|
class Instance < ::Avm::Instances::Runner
|
10
10
|
class Data
|
11
11
|
class Load
|
12
|
-
runner_with :help do
|
13
|
-
desc 'Load utility for
|
14
|
-
arg_opt '-S', '--source-instance', 'Informa a instância a ser extraída o dump.'
|
15
|
-
pos_arg :dump_path, optional: true
|
16
|
-
end
|
17
|
-
|
18
|
-
def run
|
19
|
-
return fatal_error("Dump \"#{dump_path}\" does not exist") unless
|
20
|
-
::File.exist?(dump_path)
|
21
|
-
|
22
|
-
load_dump
|
23
|
-
success("Dump loaded from \"#{dump_path}\"")
|
24
|
-
end
|
25
|
-
|
26
|
-
def dump_path_uncached
|
27
|
-
return parsed.dump_path.to_s if parsed.dump_path.present?
|
28
|
-
return source_instance_dump_path if parsed.source_instance.present?
|
29
|
-
|
30
|
-
raise "Dump path unknown (Options: #{parsed})"
|
31
|
-
end
|
32
|
-
|
33
|
-
def source_instance_dump_path
|
34
|
-
runner_context.call(:instance).class.by_id(parsed.source_instance).run_subcommand(
|
35
|
-
::Avm::Tools::Runner::Instance::Data::Dump, []
|
36
|
-
)
|
37
|
-
end
|
38
|
-
|
39
|
-
def load_dump
|
40
|
-
info "Loading dump \"#{dump_path}\"..."
|
41
|
-
package_load.run
|
42
|
-
end
|
43
|
-
|
44
|
-
def dump_instance_method
|
45
|
-
:dump_database
|
46
|
-
end
|
47
|
-
|
48
|
-
private
|
49
|
-
|
50
|
-
def package_load_uncached
|
51
|
-
runner_context.call(:instance).data_package.load(dump_path)
|
12
|
+
runner_with :help, :include_exclude, :instance_data_load do
|
13
|
+
desc 'Load utility for instance.'
|
52
14
|
end
|
53
15
|
end
|
54
16
|
end
|
@@ -10,28 +10,7 @@ module Avm
|
|
10
10
|
class Data
|
11
11
|
class Unit
|
12
12
|
class Dump
|
13
|
-
runner_with :help
|
14
|
-
pos_arg :dump_path, optional: true
|
15
|
-
end
|
16
|
-
|
17
|
-
def run
|
18
|
-
data_owner.dump(dump_path)
|
19
|
-
end
|
20
|
-
|
21
|
-
# @return [String]
|
22
|
-
def help_extra_text
|
23
|
-
"Default dump path: \"#{default_dump_path}\""
|
24
|
-
end
|
25
|
-
|
26
|
-
# @return [Pathname]
|
27
|
-
def dump_path
|
28
|
-
(parsed.dump_path || default_dump_path).to_pathname
|
29
|
-
end
|
30
|
-
|
31
|
-
# @return [String]
|
32
|
-
def default_dump_path
|
33
|
-
data_owner.data_default_dump_path
|
34
|
-
end
|
13
|
+
runner_with :help, :instance_data_dump
|
35
14
|
end
|
36
15
|
end
|
37
16
|
end
|
@@ -10,18 +10,7 @@ module Avm
|
|
10
10
|
class Data
|
11
11
|
class Unit
|
12
12
|
class Load
|
13
|
-
runner_with :help
|
14
|
-
pos_arg :dump_path
|
15
|
-
end
|
16
|
-
|
17
|
-
def run
|
18
|
-
data_owner.load(dump_path)
|
19
|
-
end
|
20
|
-
|
21
|
-
# @return [Pathname]
|
22
|
-
def dump_path
|
23
|
-
parsed.dump_path.to_pathname
|
24
|
-
end
|
13
|
+
runner_with :help, :instance_data_load
|
25
14
|
end
|
26
15
|
end
|
27
16
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'avm/data/clearer'
|
4
4
|
require 'eac_cli/core_ext'
|
5
|
-
require '
|
5
|
+
require 'avm/tools/runner_with/instance_data_performer'
|
6
6
|
|
7
7
|
module Avm
|
8
8
|
module Tools
|
@@ -10,19 +10,12 @@ module Avm
|
|
10
10
|
module InstanceDataClear
|
11
11
|
common_concern do
|
12
12
|
enable_simple_cache
|
13
|
-
include ::
|
13
|
+
include ::Avm::Tools::RunnerWith::InstanceDataPerformer
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def performer_uncached
|
23
|
-
%i[include exclude].inject(::Avm::Data::Clearer.new(data_owner)) do |a1, e1|
|
24
|
-
if_respond(e1, []).inject(a1) { |a2, e2| a2.send(e1, e2) }
|
25
|
-
end
|
16
|
+
# @return [Class]
|
17
|
+
def data_performer_class
|
18
|
+
::Avm::Data::Clearer
|
26
19
|
end
|
27
20
|
end
|
28
21
|
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/data/dumper'
|
4
|
+
require 'eac_cli/core_ext'
|
5
|
+
require 'avm/tools/runner_with/instance_data_performer'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Tools
|
9
|
+
module RunnerWith
|
10
|
+
module InstanceDataDump
|
11
|
+
common_concern do
|
12
|
+
enable_simple_cache
|
13
|
+
runner_definition do
|
14
|
+
bool_opt '-w', '--rewrite', 'Forces dump overwrite.'
|
15
|
+
pos_arg :dump_path, optional: true
|
16
|
+
end
|
17
|
+
|
18
|
+
set_callback :run, :after do
|
19
|
+
success("Dump path: \"#{dump_path}\"")
|
20
|
+
dump_path
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
include ::Avm::Tools::RunnerWith::InstanceDataPerformer
|
25
|
+
|
26
|
+
DUMP_EXPIRE_TIME = 1.day
|
27
|
+
NO_DUMP_MESSAGE = 'Dump "%s" already exist and rewrite options was no setted nor ' \
|
28
|
+
'dump was expired.'
|
29
|
+
|
30
|
+
# @return [Class]
|
31
|
+
def data_performer_class
|
32
|
+
::Avm::Data::Dumper
|
33
|
+
end
|
34
|
+
|
35
|
+
# @return [String]
|
36
|
+
def help_extra_text
|
37
|
+
"Default dump path: \"#{default_dump_path}\""
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
# @return [Avm::Data::Dumper]
|
43
|
+
def data_performer_uncached
|
44
|
+
r = super.overwrite(parsed.rewrite?)
|
45
|
+
parsed.dump_path.if_present(r) { |v| r.target_path(v.to_pathname) }
|
46
|
+
end
|
47
|
+
|
48
|
+
# @return [Pathname]
|
49
|
+
def dump_path
|
50
|
+
data_performer.target_path
|
51
|
+
end
|
52
|
+
|
53
|
+
def default_dump_path
|
54
|
+
data_performer.default_dump_path
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/data/dumper'
|
4
|
+
require 'avm/data/loader'
|
5
|
+
require 'eac_cli/core_ext'
|
6
|
+
require 'avm/tools/runner_with/instance_data_performer'
|
7
|
+
|
8
|
+
module Avm
|
9
|
+
module Tools
|
10
|
+
module RunnerWith
|
11
|
+
module InstanceDataLoad
|
12
|
+
common_concern do
|
13
|
+
enable_simple_cache
|
14
|
+
|
15
|
+
runner_definition do
|
16
|
+
arg_opt '-S', '--source-instance', 'Informa a instância a ser extraída o dump.'
|
17
|
+
bool_opt '-w', '--rewrite'
|
18
|
+
pos_arg :dump_path, optional: true
|
19
|
+
end
|
20
|
+
|
21
|
+
set_callback :run, :after do
|
22
|
+
success("Dump loaded from \"#{dump_path}\"")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
include ::Avm::Tools::RunnerWith::InstanceDataPerformer
|
27
|
+
|
28
|
+
# @return [Class]
|
29
|
+
def data_performer_class
|
30
|
+
::Avm::Data::Loader
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
# @return [Avm::Data::Loader]
|
36
|
+
def data_performer_uncached
|
37
|
+
super.source_path(dump_path)
|
38
|
+
end
|
39
|
+
|
40
|
+
# @return [Pathname]
|
41
|
+
def dump_path_uncached
|
42
|
+
return parsed.dump_path.to_pathname if parsed.dump_path.present?
|
43
|
+
return source_instance_dump_path if parsed.source_instance.present?
|
44
|
+
|
45
|
+
fatal_error "Dump path not set (Options: #{parsed})"
|
46
|
+
end
|
47
|
+
|
48
|
+
# @return [Avm::Instances::Base]
|
49
|
+
def source_instance
|
50
|
+
runner_context.call(:instance).class.by_id(parsed.source_instance)
|
51
|
+
end
|
52
|
+
|
53
|
+
# @return [Avm::Data::Dumper]
|
54
|
+
def source_instance_dumper
|
55
|
+
data_performer_set_includes_excludes(
|
56
|
+
::Avm::Data::Dumper.new(source_instance.data_package).overwrite(parsed.rewrite?)
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
# @return [Pathname]
|
61
|
+
def source_instance_dump_path
|
62
|
+
r = source_instance_dumper
|
63
|
+
r.perform
|
64
|
+
r.target_path
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/core_ext'
|
4
|
+
require 'eac_cli/runner'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Tools
|
8
|
+
module RunnerWith
|
9
|
+
module InstanceDataPerformer
|
10
|
+
acts_as_abstract :data_performer_class
|
11
|
+
common_concern do
|
12
|
+
enable_simple_cache
|
13
|
+
include ::EacCli::Runner
|
14
|
+
end
|
15
|
+
|
16
|
+
def run
|
17
|
+
if data_performer.performable?
|
18
|
+
data_performer.perform
|
19
|
+
else
|
20
|
+
fatal_error("Cannot perform: #{data_performer.cannot_perform_reason}")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
# @return [Avm::Data::Performer]
|
27
|
+
def data_performer_uncached
|
28
|
+
data_performer_set_includes_excludes(data_performer_class.new(data_owner))
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [Avm::Data::Performer]
|
32
|
+
def data_performer_set_includes_excludes(data_performer)
|
33
|
+
%i[include exclude].inject(data_performer) do |a1, e1|
|
34
|
+
if_respond(e1, []).inject(a1) { |a2, e2| a2.send(e1, e2) }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/avm/tools/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avm-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.151.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aranha-parsers
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.19'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.19'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: avm
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.75'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
40
|
+
version: '0.75'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: avm-eac_ruby_base1
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
version: '0.4'
|
68
68
|
- - ">="
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: 0.4.
|
70
|
+
version: 0.4.3
|
71
71
|
type: :runtime
|
72
72
|
prerelease: false
|
73
73
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -77,7 +77,7 @@ dependencies:
|
|
77
77
|
version: '0.4'
|
78
78
|
- - ">="
|
79
79
|
- !ruby/object:Gem::Version
|
80
|
-
version: 0.4.
|
80
|
+
version: 0.4.3
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: avm-files
|
83
83
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,7 +107,7 @@ dependencies:
|
|
107
107
|
version: '0.13'
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.13.
|
110
|
+
version: 0.13.3
|
111
111
|
type: :runtime
|
112
112
|
prerelease: false
|
113
113
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -117,7 +117,7 @@ dependencies:
|
|
117
117
|
version: '0.13'
|
118
118
|
- - ">="
|
119
119
|
- !ruby/object:Gem::Version
|
120
|
-
version: 0.13.
|
120
|
+
version: 0.13.3
|
121
121
|
- !ruby/object:Gem::Dependency
|
122
122
|
name: clipboard
|
123
123
|
requirement: !ruby/object:Gem::Requirement
|
@@ -311,6 +311,9 @@ files:
|
|
311
311
|
- lib/avm/tools/runner_with.rb
|
312
312
|
- lib/avm/tools/runner_with/include_exclude.rb
|
313
313
|
- lib/avm/tools/runner_with/instance_data_clear.rb
|
314
|
+
- lib/avm/tools/runner_with/instance_data_dump.rb
|
315
|
+
- lib/avm/tools/runner_with/instance_data_load.rb
|
316
|
+
- lib/avm/tools/runner_with/instance_data_performer.rb
|
314
317
|
- lib/avm/tools/self.rb
|
315
318
|
- lib/avm/tools/version.rb
|
316
319
|
- template/avm/self/docker_image/Dockerfile
|