backup_restore 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/backup_restore.rb +15 -7
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52a3d02544e7d87169f6e59d87fb310df702b686595ad1710fdca391ef2a6f0e
4
- data.tar.gz: 8e479224dd354eed4e1a0ad0c86e6b2aba9a4de1eedaec4d2c2eb168fe130415
3
+ metadata.gz: 3e7a464428ceef64077b7ca512c2db305cb656b875e9845eacffbb22b648f63a
4
+ data.tar.gz: 6b02d201beb07c60606d9e17803d88e25021b3bdc72d24c7a55911c579fc5184
5
5
  SHA512:
6
- metadata.gz: 0b2e650319d9938e0c636463a4cf4df33bacd744a9ac9777d31341598f03f923837f15e9ebae74244bfeb56bb4a2f9283a20b2515b43b0538f47e580d18d62ef
7
- data.tar.gz: 50d801d332ebd95cb9f24fe8db8e81871a4a559d1cda4e9be7f943055b6a2cc8095ef6b4cd3203c709c52c8544fa653dfbb3ced06fd624e306f30512dcbde422
6
+ metadata.gz: 3853115422a90a10a13821a082ba6a0e71044ae6533d869c01dc7fabd487e341e66cea0658b34bd2d9811e86702ed1f686d9a1889b94e4f014b41c13c1876e07
7
+ data.tar.gz: 52c75509732950bab87afd86e061cb1a13782505fd1cad17c6b3125943ffec229535cdee4caa135558973ee401d4198ead727cd060f665e7fedaa607d194c941
@@ -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
- else
52
- raise "<#{command}> command had problem (<#{$?}> with output <#{output}>). Working directory path was <#{Dir.getwd}>"
51
+ return output
53
52
  end
54
- return output
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
- raise PreconditionFailed.new("archive_storage_root (<#{archive_storage_root}>) does not exists") if !File.exist?(archive_storage_root)
137
- raise PreconditionFailed.new("unpack_root (<#{unpack_root}>) does not exists") if !File.exist?(unpack_root)
138
- raise PreconditionFailed.new("archive_storage_root (<#{archive_storage_root}>) is a file, not directory") if !Dir.exist?(archive_storage_root)
139
- raise PreconditionFailed.new("unpack_root (<#{unpack_root}>) is a file, not directory") if !Dir.exist?(unpack_root)
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backup_restore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mateusz Konieczny