Method: Account#cp

Defined in:
lib/cosmo/account.rb

#cp(options = {:files => [], :to => []}) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/cosmo/account.rb', line 62

def cp options = {:files => [], :to => []} 
  puts "please supply a list of servers" if options[:to].empty?
  puts "please supply a list of files" if options[:files].empty?
  unless options[:files].empty? and options[:to].empty?
    options[:files].each do |file|
      options[:to].each do |server|
        unless server.machine == 'localhost'
          server.run "mkdir -p #{File.dirname(file)}"
          self.run "scp '#{self.user}@#{self.machine}:#{file}' #{server.user}@#{server.machine}:#{pwd}"
        end
      end
    end
  end
end