Module: BackupPlugins::Tar

Included in:
Keepitsafe
Defined in:
lib/plugins/tar.rb

Instance Method Summary collapse

Instance Method Details

#tar(options = {:keep_files => false}) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/plugins/tar.rb', line 12

def tar options = {:keep_files => false}
  puts "\n\tTaring files"
  puts run_cmd "cd #{backup_dir_path}; tar -cf #{tar_path} #{backup_dir_name}"
  unless options[:keep_files]
    puts "\n\tRemoving backup dir" 
    puts run_cmd "rm -rf #{backup_target_dir}" 
  end
end

#tar_gz(options = {:keep_files => false}) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/plugins/tar.rb', line 21

def tar_gz options = {:keep_files => false}
  puts "\n\tTaring and gziping files\n\n"
  puts run_cmd "cd #{backup_dir_path}; tar -czf #{tar_gz_path} #{backup_dir_name}"
  
  unless options[:keep_files]
    puts "\n\tRemoving backup dir" 
    puts run_cmd "rm -rf #{backup_target_dir}" 
  end
  
  set_backup_size(tar_gz_path)
end

#tar_gz_pathObject



8
9
10
# File 'lib/plugins/tar.rb', line 8

def tar_gz_path
  "#{backup_target_dir[0..-2]}.tar.gz"
end

#tar_pathObject



4
5
6
# File 'lib/plugins/tar.rb', line 4

def tar_path
  "#{backup_target_dir[0..-2]}.tar"
end