Commit 36f3de4f authored by Jacob Vosmaer's avatar Jacob Vosmaer

Remove duplication in Backup::Manager

parent a540ab42
module Backup module Backup
class Manager class Manager
BACKUP_CONTENTS = %w{repositories/ db/ uploads/ backup_information.yml}
def pack def pack
# saving additional informations # saving additional informations
s = {} s = {}
...@@ -16,7 +18,7 @@ module Backup ...@@ -16,7 +18,7 @@ module Backup
# create archive # create archive
print "Creating backup archive: #{s[:backup_created_at].to_i}_gitlab_backup.tar ... " print "Creating backup archive: #{s[:backup_created_at].to_i}_gitlab_backup.tar ... "
if Kernel.system(*%W(tar -cf #{s[:backup_created_at].to_i}_gitlab_backup.tar repositories/ db/ uploads/ backup_information.yml)) if Kernel.system('tar', '-cf', "#{s[:backup_created_at].to_i}_gitlab_backup.tar", *BACKUP_CONTENTS)
puts "done".green puts "done".green
else else
puts "failed".red puts "failed".red
...@@ -25,7 +27,7 @@ module Backup ...@@ -25,7 +27,7 @@ module Backup
def cleanup def cleanup
print "Deleting tmp directories ... " print "Deleting tmp directories ... "
if Kernel.system(*%W(rm -rf repositories/ db/ uploads/ backup_information.yml)) if Kernel.system('rm', '-rf', *BACKUP_CONTENTS)
puts "done".green puts "done".green
else else
puts "failed".red puts "failed".red
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment