We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0dedaa6 commit 3cb9766Copy full SHA for 3cb9766
lib/sshkit/backends/local.rb
@@ -1,4 +1,5 @@
1
require 'open3'
2
+require 'fileutils'
3
module SSHKit
4
5
module Backend
@@ -31,6 +32,26 @@ def capture(*args)
31
32
_execute(*[*args, options]).full_stdout
33
end
34
35
+ def upload!(local, remote, options = {})
36
+ if local.is_a?(String)
37
+ FileUtils.cp(local, remote)
38
+ else
39
+ File.open(remote, "wb") do |f|
40
+ IO.copy_stream(local, f)
41
+ end
42
43
44
+
45
+ def download!(remote, local=nil, options = {})
46
+ if local.nil?
47
+ FileUtils.cp(remote, File.basename(remote))
48
49
+ File.open(remote, "rb") do |f|
50
+ IO.copy_stream(f, local)
51
52
53
54
55
private
56
57
def _execute(*args)
0 commit comments