Sha256: 38a3deeff9beeaefaaae5419b58041f6ddd7f06b68c43ced533b3958fc5355f4

Contents?: true

Size: 758 Bytes

Versions: 12

Compression:

Stored size: 758 Bytes

Contents

module BackupPlugins
  module Scp
   
   
   
   def scp target_domain
   
     options = " -r "
     
     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.scp(\"#{target_domain})\"\n\n"
     puts run_cmd("ssh #{target_domain} \"mkdir -p #{File.dirname(path)}\"")
     puts run_cmd("scp #{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/scp.rb
keepitsafe-0.2.5 lib/plugins/scp.rb
keepitsafe-0.2.4 lib/plugins/scp.rb
keepitsafe-0.2.3 lib/plugins/scp.rb
keepitsafe-0.2.2 lib/plugins/scp.rb
keepitsafe-0.2.1 lib/plugins/scp.rb
keepitsafe-0.2.0 lib/plugins/scp.rb
keepitsafe-0.1.10 lib/plugins/scp.rb
keepitsafe-0.1.7 lib/plugins/scp.rb
keepitsafe-0.1.5 lib/plugins/scp.rb
keepitsafe-0.1.4 lib/plugins/scp.rb
keepitsafe-0.1.3 lib/plugins/scp.rb