File: open-scp.rb

package info (click to toggle)
ruby-net-scp 4.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 256 kB
  • sloc: ruby: 2,081; makefile: 4
file content (20 lines) | stat: -rw-r--r-- 422 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require 'open-uri'
require 'uri/scp'
require 'net/scp'

OpenURI::Options[:ssh] = nil

module URI

  class SCP
    def buffer_open(buf, proxy, open_options)
      options = open_options.merge(:port => port, :password => password)
      progress = options.delete(:progress_proc)
      buf << Net::SCP.download!(host, user, path, nil, options, &progress)
      buf.io.rewind
    end

    include OpenURI::OpenRead
  end

end