Class: GrowlDown::GDScp

Inherits:
Object
  • Object
show all
Defined in:
lib/growl-down/gd_scp.rb

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ GDScp

Returns a new instance of GDScp.



3
4
5
# File 'lib/growl-down/gd_scp.rb', line 3

def initialize(output)
  @output = output
end

Instance Method Details

#download(remote, local_path) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/growl-down/gd_scp.rb', line 7

def download(remote, local_path)
  @output.puts "Downloading #{remote}"            
  params = remote.split(":")
  file = params.last.split("/").last
  Net::SCP.start(params[0], "clint") do |scp|
    scp.download!(params[1], local_path, {:recursive => true, :verbose => true}) do |ch, name, sent, total|
      # => progress?
    end
  end
  @output.puts "Finished!"
  g = Growl.new "localhost", "GrowlDown",
                ["GrowlDown Notification"]
  g.notify "GrowlDown Notification", "#{file}",
           "Download complete"
end