simplessh-rb 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/simplessh/session.rb +11 -4
- metadata +3 -2
data/lib/simplessh/session.rb
CHANGED
@@ -42,16 +42,23 @@ module SimpleSSH
|
|
42
42
|
either_count
|
43
43
|
end
|
44
44
|
|
45
|
-
def send_directory(source, target)
|
45
|
+
def send_directory(source, target, &block)
|
46
|
+
block ||= Proc.new { |_| true }
|
47
|
+
|
46
48
|
exec_command("mkdir -m #{file_mode(source).to_s(8)} #{target}").flat_map do |dir_creation_res|
|
47
49
|
if dir_creation_res.success?
|
48
50
|
Dir.open(source).reject { |p| p == '.' || p == '..' }.reduce(SimpleSSH::Either.return(nil)) do |prev, name|
|
49
51
|
local_path = File.join(source, name)
|
50
52
|
remote_path = "#{target}/#{name}"
|
51
|
-
|
52
|
-
|
53
|
+
|
54
|
+
if block.call local_path
|
55
|
+
if File.file? local_path
|
56
|
+
prev.flat_map { |s| send_file(file_mode(local_path), local_path, remote_path) }
|
57
|
+
else
|
58
|
+
prev.flat_map { |_| send_directory(local_path, remote_path) }
|
59
|
+
end
|
53
60
|
else
|
54
|
-
prev
|
61
|
+
prev
|
55
62
|
end
|
56
63
|
end
|
57
64
|
else
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplessh-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-12-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|
@@ -71,3 +71,4 @@ signing_key:
|
|
71
71
|
specification_version: 3
|
72
72
|
summary: Ruby version of SimpleSSH
|
73
73
|
test_files: []
|
74
|
+
has_rdoc:
|