bfs-scp 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bfs/bucket/scp.rb +10 -3
- data/spec/bfs/bucket/scp_spec.rb +7 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44a0713c9f175213b7c659269892ea70cb8ed870cf60d8346e04d884d59c26c0
|
4
|
+
data.tar.gz: f47f64d9a6c0e981c45ebecb993d70ee6f8a3813e327a23f1ac817824bf67321
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f81f0d970feacce7728442dc01b645b797202473ac5798eaa9c13593362a80fcdcee4324d3193ea269e8203db0354211f7ffad0a60914dbb6ed53a1b013b25b6
|
7
|
+
data.tar.gz: 75112da87d9464b66ae823a03d28c9ae7074d47bb1ca237ccc53d61f93af4760317ad8067a9ae12e9248b07704d800050d20d1be8713c329302b4657ede9e660
|
data/lib/bfs/bucket/scp.rb
CHANGED
@@ -153,10 +153,11 @@ module BFS
|
|
153
153
|
@client.session.open_channel do |ch|
|
154
154
|
ch.exec(cmdstr) do |_, _success|
|
155
155
|
ch.on_data do |_, data|
|
156
|
+
stdout << data
|
157
|
+
|
156
158
|
if block_given?
|
157
|
-
|
158
|
-
|
159
|
-
stdout += data
|
159
|
+
pos = stdout.rindex("\n")
|
160
|
+
yield stdout.slice!(0..pos) if pos
|
160
161
|
end
|
161
162
|
end
|
162
163
|
ch.on_extended_data do |_, _, data|
|
@@ -167,6 +168,12 @@ module BFS
|
|
167
168
|
end
|
168
169
|
end
|
169
170
|
end
|
171
|
+
|
172
|
+
if block_given? && stdout.length.positive?
|
173
|
+
yield stdout
|
174
|
+
stdout.clear
|
175
|
+
end
|
176
|
+
|
170
177
|
@client.session.loop
|
171
178
|
raise CommandError.new(cmdstr, status, stderr) unless status.zero?
|
172
179
|
|
data/spec/bfs/bucket/scp_spec.rb
CHANGED
@@ -1,24 +1,25 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
RSpec.describe BFS::Bucket::SCP, scp: true do
|
4
|
+
subject { described_class.new hostname, **conn_opts }
|
5
|
+
|
4
6
|
let(:hostname) { '127.0.0.1' }
|
5
7
|
let(:conn_opts) { { port: 7022, user: 'root', password: 'root', prefix: prefix } }
|
6
8
|
let(:prefix) { SecureRandom.uuid }
|
7
9
|
|
8
|
-
subject { described_class.new hostname, **conn_opts }
|
9
10
|
after { subject.close }
|
10
11
|
|
11
|
-
context 'absolute' do
|
12
|
+
context 'with absolute path' do
|
12
13
|
it_behaves_like 'a bucket', content_type: false, metadata: false
|
13
14
|
end
|
14
15
|
|
15
|
-
context 'relative' do
|
16
|
+
context 'with relative path' do
|
16
17
|
let(:prefix) { "~/#{SecureRandom.uuid}" }
|
17
18
|
|
18
19
|
it_behaves_like 'a bucket', content_type: false, metadata: false
|
19
20
|
end
|
20
21
|
|
21
|
-
it '
|
22
|
+
it 'resolves from URL' do
|
22
23
|
bucket = BFS.resolve('scp://root:root@127.0.0.1:7022')
|
23
24
|
expect(bucket).to be_instance_of(described_class)
|
24
25
|
expect(bucket.instance_variable_get(:@prefix)).to be_nil
|
@@ -30,7 +31,7 @@ RSpec.describe BFS::Bucket::SCP, scp: true do
|
|
30
31
|
bucket.close
|
31
32
|
end
|
32
33
|
|
33
|
-
it '
|
34
|
+
it 'handles absolute and relative paths' do
|
34
35
|
abs = BFS::Blob.new("scp://root:root@127.0.0.1:7022/#{SecureRandom.uuid}/file.txt")
|
35
36
|
abs.create {|w| w.write 'absolute' }
|
36
37
|
|
@@ -44,7 +45,7 @@ RSpec.describe BFS::Bucket::SCP, scp: true do
|
|
44
45
|
rel.close
|
45
46
|
end
|
46
47
|
|
47
|
-
it '
|
48
|
+
it 'supports custom perms' do
|
48
49
|
blob = BFS::Blob.new("scp://root:root@127.0.0.1:7022/#{SecureRandom.uuid}/file.txt")
|
49
50
|
blob.create(perm: 0o666) {|w| w.write 'foo' }
|
50
51
|
expect(blob.info.mode).to eq(0o666)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bfs-scp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dimitrij Denissenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bfs
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.8.
|
19
|
+
version: 0.8.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.8.
|
26
|
+
version: 0.8.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: net-scp
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|