Sha256: 245faeba65f9cbd99ca88623ac302efc5cf158114053c38dfb49f07d2dd16d35

Contents?: true

Size: 787 Bytes

Versions: 12

Compression:

Stored size: 787 Bytes

Contents

module BackupPlugins
  module Rsync
   
   
   
   def rsync target_domain
   
     rsync_options = " --recursive "
     
     path = if !run_cmd("ls #{tar_path}").match(/No such file or directory/)
       tar_path
     elsif !run_cmd("ls #{tar_gz_path}").match(/No such file or directory/)
       tar_gz_path
     elsif !run_cmd("ls #{backup_target_dir}").match(/No such file or directory/)
       backup_target_dir
     else  
       raise "This code sucks as we cant find a file to transfer =(, target_domain: #{target_domain}"
     end
     
     puts "\n\t backup.rsync(\"#{target_domain}\")\n\n"
     puts run_cmd("ssh #{target_domain} \"mkdir -p #{File.dirname(path)}\"")
     puts run_cmd("rsync #{rsync_options} #{path} \"#{target_domain}:#{path}\"")
     
   end
    
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
keepitsafe-0.2.6 lib/plugins/rsync.rb
keepitsafe-0.2.5 lib/plugins/rsync.rb
keepitsafe-0.2.4 lib/plugins/rsync.rb
keepitsafe-0.2.3 lib/plugins/rsync.rb
keepitsafe-0.2.2 lib/plugins/rsync.rb
keepitsafe-0.2.1 lib/plugins/rsync.rb
keepitsafe-0.2.0 lib/plugins/rsync.rb
keepitsafe-0.1.10 lib/plugins/rsync.rb
keepitsafe-0.1.7 lib/plugins/rsync.rb
keepitsafe-0.1.5 lib/plugins/rsync.rb
keepitsafe-0.1.4 lib/plugins/rsync.rb
keepitsafe-0.1.3 lib/plugins/rsync.rb