Class: GrowlTransfer::GTScp
- Inherits:
-
Object
- Object
- GrowlTransfer::GTScp
- Defined in:
- lib/growl-transfer/gt_scp.rb
Instance Method Summary collapse
- #download(remote, local_path) ⇒ Object
-
#initialize(output) ⇒ GTScp
constructor
A new instance of GTScp.
Constructor Details
#initialize(output) ⇒ GTScp
Returns a new instance of GTScp.
3 4 5 |
# File 'lib/growl-transfer/gt_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 22 23 24 25 26 27 28 29 30 |
# File 'lib/growl-transfer/gt_scp.rb', line 7 def download(remote, local_path) @output.puts "Downloading #{remote}" params = remote.split(":") file = params.last.split("/").last if params[0].include? '@' server = params[0].split('@').last user = params[0].split('@').first else server = params[0] user = ENV['USER'] end Net::SCP.start(server, user) 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", "GrowlTransfer", ["GrowlTransfer Notification"] g.notify "GrowlTransfer Notification", "#{file}", "Download complete" end |