avm 0.66.1 → 0.67.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/package/build_directory.rb +28 -0
- data/lib/avm/data/package/dump.rb +10 -8
- data/lib/avm/data/package/load.rb +8 -11
- data/lib/avm/data/package.rb +3 -0
- data/lib/avm/data/unit.rb +5 -0
- data/lib/avm/instances/data/files_unit.rb +8 -1
- data/lib/avm/version.rb +1 -1
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03e18c1b8d8e141cb67d37f8eee123d44aa444003a48c4489176199861dcd326
|
4
|
+
data.tar.gz: 04b402c83045cb9749d82f67e5ca4be1cbbca3ff18eaa0560c1dc70fba24df72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86ba3db9f576a68044b0cdba24b58fca43c6251cbfea221cd6528af798e7e069e3eb8d0b5eac9c1af8d5e58a0cd274cea6e486d0a9326122a8f993417b46accc
|
7
|
+
data.tar.gz: f5358b5238bd19bf35d14d2c0252fe0e7b005041ec2fed97cb0ba5a99c56538f2c31e93eed851ee86392fbba70eec62de6c536956901f7056f19fa5c9e225643
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/fs/temp'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Data
|
8
|
+
class Package
|
9
|
+
module BuildDirectory
|
10
|
+
private
|
11
|
+
|
12
|
+
attr_writer :build_directory
|
13
|
+
|
14
|
+
# @return [EacRubyUtils::Fs::Temp::Directory]
|
15
|
+
def build_directory
|
16
|
+
@build_directory || raise('@build_directory is blank')
|
17
|
+
end
|
18
|
+
|
19
|
+
def on_build_directory
|
20
|
+
::EacRubyUtils::Fs::Temp.on_directory do |directory|
|
21
|
+
self.build_directory = directory
|
22
|
+
yield
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'avm/data/package/build_directory'
|
3
4
|
require 'avm/data/rotate'
|
4
5
|
require 'eac_ruby_utils/core_ext'
|
5
6
|
require 'minitar'
|
@@ -10,6 +11,7 @@ module Avm
|
|
10
11
|
class Dump
|
11
12
|
enable_speaker
|
12
13
|
enable_listable
|
14
|
+
include ::Avm::Data::Package::BuildDirectory
|
13
15
|
|
14
16
|
DEFAULT_EXPIRE_TIME = 1.day
|
15
17
|
DEFAULT_FILE_EXTENSION = '.tar'
|
@@ -45,8 +47,10 @@ module Avm
|
|
45
47
|
def run
|
46
48
|
raise "Cannot run: #{cannot_run_reason}" unless runnable?
|
47
49
|
|
48
|
-
|
49
|
-
|
50
|
+
package_file = on_build_directory do
|
51
|
+
dump_units_to_build_directory
|
52
|
+
create_package_file
|
53
|
+
end
|
50
54
|
rotate
|
51
55
|
move_download_to_final_dest(package_file)
|
52
56
|
end
|
@@ -100,15 +104,13 @@ module Avm
|
|
100
104
|
end
|
101
105
|
|
102
106
|
def dump_units_to_build_directory
|
103
|
-
|
104
|
-
package.dump_units_to_directory(dir)
|
105
|
-
dir
|
107
|
+
package.dump_units_to_directory(build_directory)
|
106
108
|
end
|
107
109
|
|
108
|
-
def create_package_file
|
110
|
+
def create_package_file
|
109
111
|
package_path = new_build_path
|
110
|
-
infom "Creating package \"#{package_path}\" from \"#{
|
111
|
-
Dir.chdir(
|
112
|
+
infom "Creating package \"#{package_path}\" from \"#{build_directory}\"..."
|
113
|
+
::Dir.chdir(build_directory.to_path) do
|
112
114
|
::Minitar.pack('.', File.open(::File.expand_path(package_path), 'wb'))
|
113
115
|
end
|
114
116
|
package_path
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'avm/data/package/build_directory'
|
3
4
|
require 'eac_ruby_utils/core_ext'
|
4
5
|
require 'minitar'
|
5
6
|
|
@@ -8,13 +9,9 @@ module Avm
|
|
8
9
|
class Package
|
9
10
|
class Load
|
10
11
|
enable_speaker
|
12
|
+
include ::Avm::Data::Package::BuildDirectory
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
-
def initialize(package, data_file_path)
|
15
|
-
@package = package
|
16
|
-
@data_file_path = data_file_path
|
17
|
-
end
|
14
|
+
common_constructor :package, :data_file_path
|
18
15
|
|
19
16
|
def runnable?
|
20
17
|
cannot_run_reason.blank?
|
@@ -29,8 +26,10 @@ module Avm
|
|
29
26
|
def run
|
30
27
|
raise "Cannot run: #{cannot_run_reason}" unless runnable?
|
31
28
|
|
32
|
-
|
33
|
-
|
29
|
+
on_build_directory do
|
30
|
+
extract_packages_to_build_directory
|
31
|
+
package.load_units_from_directory(build_directory)
|
32
|
+
end
|
34
33
|
end
|
35
34
|
|
36
35
|
def data_file_exist?
|
@@ -38,9 +37,7 @@ module Avm
|
|
38
37
|
end
|
39
38
|
|
40
39
|
def extract_packages_to_build_directory
|
41
|
-
|
42
|
-
::Minitar.unpack(data_file_path, dir)
|
43
|
-
dir
|
40
|
+
::Minitar.unpack(data_file_path, build_directory.to_path)
|
44
41
|
end
|
45
42
|
end
|
46
43
|
end
|
data/lib/avm/data/package.rb
CHANGED
data/lib/avm/data/unit.rb
CHANGED
@@ -39,10 +39,17 @@ module Avm
|
|
39
39
|
instance_command('find', files_path, '-mindepth', 1, '-delete').execute!
|
40
40
|
end
|
41
41
|
|
42
|
+
# @return [Struct(:key, :subpath), nil]
|
43
|
+
def installation_files_data
|
44
|
+
return nil unless fs_path_subpath.relative?
|
45
|
+
|
46
|
+
::Struct.new(:key, :subpath).new(fs_path_subpath.basename.to_path, fs_path_subpath)
|
47
|
+
end
|
48
|
+
|
42
49
|
# @return [EacRubyUtils::Envs::Command]
|
43
50
|
def instance_command(*args)
|
44
51
|
args = ['sudo', '-Hu', sudo_user] + args if sudo_user.present?
|
45
|
-
instance.host_env.command(*args)
|
52
|
+
instance.host_env.command(*args).chdir('/')
|
46
53
|
end
|
47
54
|
|
48
55
|
# @return [String, nil]
|
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.67.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-04-
|
11
|
+
date: 2023-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aranha-parsers
|
@@ -17,6 +17,9 @@ dependencies:
|
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.17'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.17.1
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -24,6 +27,9 @@ dependencies:
|
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '0.17'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.17.1
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: eac_cli
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -245,6 +251,7 @@ files:
|
|
245
251
|
- lib/avm/applications/base/stereotype.rb
|
246
252
|
- lib/avm/data/callbacks.rb
|
247
253
|
- lib/avm/data/package.rb
|
254
|
+
- lib/avm/data/package/build_directory.rb
|
248
255
|
- lib/avm/data/package/dump.rb
|
249
256
|
- lib/avm/data/package/load.rb
|
250
257
|
- lib/avm/data/rotate.rb
|