Commit 36f3de4f59313c2f3582dd65f802b9ebf92e6bb9

Authored by Jacob Vosmaer
1 parent a540ab42

Remove duplication in Backup::Manager

Showing 1 changed file with 4 additions and 2 deletions   Show diff stats
lib/backup/manager.rb
1 1 module Backup
2 2 class Manager
  3 + BACKUP_CONTENTS = %w{repositories/ db/ uploads/ backup_information.yml}
  4 +
3 5 def pack
4 6 # saving additional informations
5 7 s = {}
... ... @@ -16,7 +18,7 @@ module Backup
16 18  
17 19 # create archive
18 20 print "Creating backup archive: #{s[:backup_created_at].to_i}_gitlab_backup.tar ... "
19   - if Kernel.system(*%W(tar -cf #{s[:backup_created_at].to_i}_gitlab_backup.tar repositories/ db/ uploads/ backup_information.yml))
  21 + if Kernel.system('tar', '-cf', "#{s[:backup_created_at].to_i}_gitlab_backup.tar", *BACKUP_CONTENTS)
20 22 puts "done".green
21 23 else
22 24 puts "failed".red
... ... @@ -25,7 +27,7 @@ module Backup
25 27  
26 28 def cleanup
27 29 print "Deleting tmp directories ... "
28   - if Kernel.system(*%W(rm -rf repositories/ db/ uploads/ backup_information.yml))
  30 + if Kernel.system('rm', '-rf', *BACKUP_CONTENTS)
29 31 puts "done".green
30 32 else
31 33 puts "failed".red
... ...