backup_restore 0.0.3 → 0.0.4
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 +4 -4
- data/lib/backup_restore.rb +15 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e7a464428ceef64077b7ca512c2db305cb656b875e9845eacffbb22b648f63a
|
4
|
+
data.tar.gz: 6b02d201beb07c60606d9e17803d88e25021b3bdc72d24c7a55911c579fc5184
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3853115422a90a10a13821a082ba6a0e71044ae6533d869c01dc7fabd487e341e66cea0658b34bd2d9811e86702ed1f686d9a1889b94e4f014b41c13c1876e07
|
7
|
+
data.tar.gz: 52c75509732950bab87afd86e061cb1a13782505fd1cad17c6b3125943ffec229535cdee4caa135558973ee401d4198ead727cd060f665e7fedaa607d194c941
|
data/lib/backup_restore.rb
CHANGED
@@ -48,10 +48,9 @@ class BackupRestore
|
|
48
48
|
output = `#{command}`
|
49
49
|
if $?.success? || unstandard_error_free_exit_codes.include?($?.exitstatus)
|
50
50
|
debug('all done', :low)
|
51
|
-
|
52
|
-
raise "<#{command}> command had problem (<#{$?}> with output <#{output}>). Working directory path was <#{Dir.getwd}>"
|
51
|
+
return output
|
53
52
|
end
|
54
|
-
|
53
|
+
raise "<#{command}> command had problem (<#{$?}> with output <#{output}>). Working directory path was <#{Dir.getwd}>"
|
55
54
|
end
|
56
55
|
|
57
56
|
def self.extract_tar_file(file, target_folder = nil)
|
@@ -133,10 +132,18 @@ class BackupRestore
|
|
133
132
|
end
|
134
133
|
|
135
134
|
def self.validate_folder_parameters(archive_storage_root, unpack_root)
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
135
|
+
unless File.exist?(archive_storage_root)
|
136
|
+
raise PreconditionFailed.new("archive_storage_root (<#{archive_storage_root}>) does not exists")
|
137
|
+
end
|
138
|
+
unless File.exist?(unpack_root)
|
139
|
+
raise PreconditionFailed.new("unpack_root (<#{unpack_root}>) does not exists")
|
140
|
+
end
|
141
|
+
unless Dir.exist?(archive_storage_root)
|
142
|
+
raise PreconditionFailed.new("archive_storage_root (<#{archive_storage_root}>) is a file, not directory")
|
143
|
+
end
|
144
|
+
unless Dir.exist?(unpack_root)
|
145
|
+
raise PreconditionFailed.new("unpack_root (<#{unpack_root}>) is a file, not directory")
|
146
|
+
end
|
140
147
|
end
|
141
148
|
|
142
149
|
def self.process_given_archive(archive_storage_root, archive_name, unpack_root, password)
|
@@ -159,6 +166,7 @@ class BackupRestore
|
|
159
166
|
# it is deleted at this step to reduce peak memory consumption on disk
|
160
167
|
# for unpacking large archives
|
161
168
|
if is_unsplitting_necessary(archive_storage_root, archive_name)
|
169
|
+
storage = get_storage_folder(archive_storage_root, archive_name)
|
162
170
|
FileUtils.rm_rf(storage + archive_name + ".tar.enc")
|
163
171
|
end
|
164
172
|
|