net-sftp 2.1.3.rc3 → 3.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.travis.yml +7 -7
- data/README.rdoc +1 -1
- data/lib/net/sftp/operations/dir.rb +3 -3
- data/lib/net/sftp/operations/download.rb +6 -6
- data/lib/net/sftp/operations/file.rb +30 -7
- data/lib/net/sftp/version.rb +4 -4
- data/net-sftp.gemspec +3 -3
- metadata +4 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfaa82448aebfb3c2a205a2ee3a4a00cb79880de
|
4
|
+
data.tar.gz: 80dd6481dd160bf3a25ba724c13cd1d86f2faa96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b420fd11f558578edd054c8413c3de74515791d05d982bad5d07ac0c5e0a540bc8af13cf23e347091431e43611b3f3116de6917754bf87a9b37e0f692ad42d8
|
7
|
+
data.tar.gz: df1d630648a90a715148837346d3be01d9462a70c3831822d4a4d803fa320b1544fda4b2faab3f7f45256ad79a160e0f1d00b347f18750cbb66081fa3b6ae4fd
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.travis.yml
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
language: ruby
|
2
2
|
sudo: false
|
3
3
|
rvm:
|
4
|
-
- 2.
|
5
|
-
- 2.
|
6
|
-
- 2.
|
7
|
-
- 2.3
|
8
|
-
- 2.
|
4
|
+
- 2.2.10
|
5
|
+
- 2.3.7
|
6
|
+
- 2.4.5
|
7
|
+
- 2.5.3
|
8
|
+
- 2.6.0-rc2
|
9
9
|
- ruby-head
|
10
10
|
- jruby-head
|
11
|
-
- rbx-
|
11
|
+
- rbx-3.107
|
12
12
|
|
13
13
|
install: gem install net-ssh test-unit mocha
|
14
14
|
|
@@ -17,4 +17,4 @@ script: rake test
|
|
17
17
|
matrix:
|
18
18
|
allow_failures:
|
19
19
|
- rvm: jruby-head
|
20
|
-
- rvm: rbx-
|
20
|
+
- rvm: rbx-3.107
|
data/README.rdoc
CHANGED
@@ -26,7 +26,7 @@ Net::SFTP is a pure-Ruby implementation of the SFTP protocol (specifically, vers
|
|
26
26
|
|
27
27
|
In a nutshell:
|
28
28
|
|
29
|
-
require 'net
|
29
|
+
require 'net-sftp'
|
30
30
|
|
31
31
|
Net::SFTP.start('host', 'username', :password => 'password') do |sftp|
|
32
32
|
# upload a file or directory to the remote host
|
@@ -57,10 +57,10 @@ module Net; module SFTP; module Operations
|
|
57
57
|
# it should be able to handle modest numbers of files in each directory.
|
58
58
|
def glob(path, pattern, flags=0)
|
59
59
|
flags |= ::File::FNM_PATHNAME
|
60
|
-
path = path.chop if path
|
60
|
+
path = path.chop if path.end_with?('/') && path != '/'
|
61
61
|
|
62
62
|
results = [] unless block_given?
|
63
|
-
queue = entries(path).reject { |e|
|
63
|
+
queue = entries(path).reject { |e| %w(. ..).include?(e.name) }
|
64
64
|
while queue.any?
|
65
65
|
entry = queue.shift
|
66
66
|
|
@@ -90,4 +90,4 @@ module Net; module SFTP; module Operations
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
-
end; end; end
|
93
|
+
end; end; end
|
@@ -256,7 +256,7 @@ module Net; module SFTP; module Operations
|
|
256
256
|
# operation was successful.
|
257
257
|
def on_opendir(response)
|
258
258
|
entry = response.request[:entry]
|
259
|
-
raise "opendir #{entry.remote}
|
259
|
+
raise StatusException.new(response, "opendir #{entry.remote}") unless response.ok?
|
260
260
|
entry.handle = response[:handle]
|
261
261
|
request = sftp.readdir(response[:handle], &method(:on_readdir))
|
262
262
|
request[:parent] = entry
|
@@ -271,7 +271,7 @@ module Net; module SFTP; module Operations
|
|
271
271
|
request = sftp.close(entry.handle, &method(:on_closedir))
|
272
272
|
request[:parent] = entry
|
273
273
|
elsif !response.ok?
|
274
|
-
raise "readdir #{entry.remote}
|
274
|
+
raise StatusException.new(response, "readdir #{entry.remote}")
|
275
275
|
else
|
276
276
|
response[:names].each do |item|
|
277
277
|
next if item.name == "." || item.name == ".."
|
@@ -297,7 +297,7 @@ module Net; module SFTP; module Operations
|
|
297
297
|
def on_closedir(response)
|
298
298
|
@active -= 1
|
299
299
|
entry = response.request[:parent]
|
300
|
-
raise "close #{entry.remote}
|
300
|
+
raise StatusException.new(response, "close #{entry.remote}") unless response.ok?
|
301
301
|
process_next_entry
|
302
302
|
end
|
303
303
|
|
@@ -305,7 +305,7 @@ module Net; module SFTP; module Operations
|
|
305
305
|
# to initiate the data transfer.
|
306
306
|
def on_open(response)
|
307
307
|
entry = response.request[:entry]
|
308
|
-
raise "open #{entry.remote}
|
308
|
+
raise StatusException.new(response, "open #{entry.remote}") unless response.ok?
|
309
309
|
|
310
310
|
entry.handle = response[:handle]
|
311
311
|
entry.sink = entry.local.respond_to?(:write) ? entry.local : ::File.open(entry.local, "wb")
|
@@ -333,7 +333,7 @@ module Net; module SFTP; module Operations
|
|
333
333
|
request = sftp.close(entry.handle, &method(:on_close))
|
334
334
|
request[:entry] = entry
|
335
335
|
elsif !response.ok?
|
336
|
-
raise "read #{entry.remote}
|
336
|
+
raise StatusException.new(response, "read #{entry.remote}")
|
337
337
|
else
|
338
338
|
entry.offset += response[:data].bytesize
|
339
339
|
update_progress(:get, entry, response.request[:offset], response[:data])
|
@@ -346,7 +346,7 @@ module Net; module SFTP; module Operations
|
|
346
346
|
def on_close(response)
|
347
347
|
@active -= 1
|
348
348
|
entry = response.request[:entry]
|
349
|
-
raise "close #{entry.remote}
|
349
|
+
raise StatusException.new(response, "close #{entry.remote}") unless response.ok?
|
350
350
|
process_next_entry
|
351
351
|
end
|
352
352
|
|
@@ -81,21 +81,35 @@ module Net; module SFTP; module Operations
|
|
81
81
|
# Reads up to the next instance of +sep_string+ in the stream, and
|
82
82
|
# returns the bytes read (including +sep_string+). If +sep_string+ is
|
83
83
|
# omitted, it defaults to +$/+. If EOF is encountered before any data
|
84
|
-
# could be read, #gets will return +nil+.
|
85
|
-
|
86
|
-
|
84
|
+
# could be read, #gets will return +nil+. If the first argument is an
|
85
|
+
# integer, or optional second argument is given, the returning string
|
86
|
+
# would not be longer than the given value in bytes.
|
87
|
+
def gets(sep_or_limit=$/, limit=Float::INFINITY)
|
88
|
+
if sep_or_limit.is_a? Integer
|
89
|
+
sep_string = $/
|
90
|
+
lim = sep_or_limit
|
91
|
+
else
|
92
|
+
sep_string = sep_or_limit
|
93
|
+
lim = limit
|
94
|
+
end
|
95
|
+
|
96
|
+
delim = if sep_string && sep_string.length == 0
|
87
97
|
"#{$/}#{$/}"
|
88
98
|
else
|
89
99
|
sep_string
|
90
100
|
end
|
91
101
|
|
92
102
|
loop do
|
93
|
-
at = @buffer.index(delim)
|
103
|
+
at = @buffer.index(delim) if delim
|
94
104
|
if at
|
95
|
-
offset = at + delim.length
|
105
|
+
offset = [at + delim.length, lim].min
|
96
106
|
@pos += offset
|
97
107
|
line, @buffer = @buffer[0,offset], @buffer[offset..-1]
|
98
108
|
return line
|
109
|
+
elsif lim < @buffer.length
|
110
|
+
@pos += lim
|
111
|
+
line, @buffer = @buffer[0,lim], @buffer[lim..-1]
|
112
|
+
return line
|
99
113
|
elsif !fill
|
100
114
|
return nil if @buffer.empty?
|
101
115
|
@pos += @buffer.length
|
@@ -107,8 +121,8 @@ module Net; module SFTP; module Operations
|
|
107
121
|
|
108
122
|
# Same as #gets, but raises EOFError if EOF is encountered before any
|
109
123
|
# data could be read.
|
110
|
-
def readline(
|
111
|
-
line = gets(
|
124
|
+
def readline(sep_or_limit=$/, limit=Float::INFINITY)
|
125
|
+
line = gets(sep_or_limit, limit)
|
112
126
|
raise EOFError if line.nil?
|
113
127
|
return line
|
114
128
|
end
|
@@ -131,6 +145,15 @@ module Net; module SFTP; module Operations
|
|
131
145
|
nil
|
132
146
|
end
|
133
147
|
|
148
|
+
def size
|
149
|
+
stat.size
|
150
|
+
end
|
151
|
+
|
152
|
+
# Resets position to beginning of file
|
153
|
+
def rewind
|
154
|
+
self.pos = 0
|
155
|
+
end
|
156
|
+
|
134
157
|
# Writes each argument to the stream, appending a newline to any item
|
135
158
|
# that does not already end in a newline. Array arguments are flattened.
|
136
159
|
def puts(*items)
|
data/lib/net/sftp/version.rb
CHANGED
@@ -46,17 +46,17 @@ module Net
|
|
46
46
|
end
|
47
47
|
|
48
48
|
# The major component of this version of the Net::SFTP library
|
49
|
-
MAJOR =
|
49
|
+
MAJOR = 3
|
50
50
|
|
51
51
|
# The minor component of this version of the Net::SFTP library
|
52
|
-
MINOR =
|
52
|
+
MINOR = 0
|
53
53
|
|
54
54
|
# The tiny component of this version of the Net::SFTP library
|
55
|
-
TINY =
|
55
|
+
TINY = 0
|
56
56
|
|
57
57
|
# The prerelease component of this version of the Net::SFTP library
|
58
58
|
# nil allowed
|
59
|
-
PRE = "
|
59
|
+
PRE = "beta1"
|
60
60
|
|
61
61
|
# The current version of the Net::SFTP library as a Version instance
|
62
62
|
CURRENT = new(*[MAJOR, MINOR, TINY, PRE].compact)
|
data/net-sftp.gemspec
CHANGED
@@ -31,16 +31,16 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.specification_version = 3
|
32
32
|
|
33
33
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
34
|
-
spec.add_runtime_dependency(%q<net-ssh>, [">=
|
34
|
+
spec.add_runtime_dependency(%q<net-ssh>, [">= 5.0.0", "< 6.0.0"])
|
35
35
|
spec.add_development_dependency(%q<test-unit>, [">= 0"])
|
36
36
|
spec.add_development_dependency(%q<mocha>, [">= 0"])
|
37
37
|
else
|
38
|
-
spec.add_dependency(%q<net-ssh>, [">=
|
38
|
+
spec.add_dependency(%q<net-ssh>, [">= 5.0.0", "< 6.0.0"])
|
39
39
|
spec.add_dependency(%q<test-unit>, [">= 0"])
|
40
40
|
spec.add_dependency(%q<mocha>, [">= 0"])
|
41
41
|
end
|
42
42
|
else
|
43
|
-
spec.add_dependency(%q<net-ssh>, [">=
|
43
|
+
spec.add_dependency(%q<net-ssh>, [">= 5.0.0", "< 6.0.0"])
|
44
44
|
spec.add_dependency(%q<test-unit>, [">= 0"])
|
45
45
|
spec.add_dependency(%q<mocha>, [">= 0"])
|
46
46
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-sftp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamis Buck
|
@@ -32,7 +32,7 @@ cert_chain:
|
|
32
32
|
YBtB7WnyXXwkUAo0FUibVzXXSxU+wXhrfpOCo2ZOlQOspdOcGZjirOZoxUKSvMtn
|
33
33
|
URWm7gw7y0UkzFg4iZOFuC84+4GZ08U3/gr9sg==
|
34
34
|
-----END CERTIFICATE-----
|
35
|
-
date: 2018-12-
|
35
|
+
date: 2018-12-28 00:00:00.000000000 Z
|
36
36
|
dependencies:
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: net-ssh
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
43
|
+
version: 5.0.0
|
44
44
|
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 6.0.0
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: 5.0.0
|
54
54
|
- - "<"
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: 6.0.0
|
metadata.gz.sig
CHANGED
Binary file
|