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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 29d510784470981aeebbf54fdde1c56cafbe6e7a53bb3aa7cc1ac6f043315c3f
4
- data.tar.gz: d80b9721dbb7934abddbb5ea09adf1fb0de83421cf9deeb298d0bf0ae450a50e
3
+ metadata.gz: 44a0713c9f175213b7c659269892ea70cb8ed870cf60d8346e04d884d59c26c0
4
+ data.tar.gz: f47f64d9a6c0e981c45ebecb993d70ee6f8a3813e327a23f1ac817824bf67321
5
5
  SHA512:
6
- metadata.gz: 1d9bf7a73342ae2090dbbb487d87fc28aefd8680b6f6145c82f790905467e2e662152e7c5710f73147a163f4adc43687dbb63afece37b8867e20c437169b9af6
7
- data.tar.gz: e0458841db2fa130caa4a64d4b954f4ef3fda113a905ce9ae3b9e556d3a468f3747cfdb83d9f5f629dda505a27ed35b60b445a10f35fdc7aeec1db70462f5495
6
+ metadata.gz: f81f0d970feacce7728442dc01b645b797202473ac5798eaa9c13593362a80fcdcee4324d3193ea269e8203db0354211f7ffad0a60914dbb6ed53a1b013b25b6
7
+ data.tar.gz: 75112da87d9464b66ae823a03d28c9ae7074d47bb1ca237ccc53d61f93af4760317ad8067a9ae12e9248b07704d800050d20d1be8713c329302b4657ede9e660
@@ -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
- yield data
158
- else
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
 
@@ -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 'should resolve from URL' do
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 'should handle absolute and relative paths' do
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 'should support custom perms' do
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.0
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: 2020-12-01 00:00:00.000000000 Z
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.0
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.0
26
+ version: 0.8.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: net-scp
29
29
  requirement: !ruby/object:Gem::Requirement