bfs-scp 0.6.5 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bfs-scp.gemspec +1 -1
- data/lib/bfs/bucket/scp.rb +5 -3
- data/spec/bfs/bucket/scp_spec.rb +9 -12
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef0ef96a3e86298cb7dd7fa6ff941b737a7a8e81d77739628eb1bd94ddca8369
|
4
|
+
data.tar.gz: 2bdf06c5c853c2af45b7ab2ffb93877179134eafe4a9ee28d44fbbddf71e5370
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2438d29d8106ef151596a2a7556349796e0a2a491f0f8f35386182d65669b6db4fb1a7f8bc5ae8195fc46f983e52545f5c7d8782df64f5cc272f13bad954c6a9
|
7
|
+
data.tar.gz: 57e203c4d7b5a2d4d561f4a51a301312f3abe109eef6ab127335e62d70d56943c4abf95e3f03d7d80a534d4ddad8544ca923ab65e074fa18d735b291eeb730e6
|
data/bfs-scp.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.files = `git ls-files`.split("\n")
|
16
16
|
s.test_files = `git ls-files -- spec/*`.split("\n")
|
17
17
|
s.require_paths = ['lib']
|
18
|
-
s.required_ruby_version = '>= 2.
|
18
|
+
s.required_ruby_version = '>= 2.6.0'
|
19
19
|
|
20
20
|
s.add_dependency 'bfs', s.version
|
21
21
|
s.add_dependency 'net-scp'
|
data/lib/bfs/bucket/scp.rb
CHANGED
@@ -35,7 +35,7 @@ module BFS
|
|
35
35
|
@client = Net::SCP.start(host, nil, **opts.slice(*Net::SSH::VALID_OPTIONS))
|
36
36
|
|
37
37
|
if @prefix # rubocop:disable Style/GuardClause
|
38
|
-
@prefix = norm_path(@prefix)
|
38
|
+
@prefix = "#{norm_path(@prefix)}/"
|
39
39
|
mkdir_p abs_path(@prefix)
|
40
40
|
end
|
41
41
|
end
|
@@ -183,10 +183,12 @@ module BFS
|
|
183
183
|
end
|
184
184
|
end
|
185
185
|
|
186
|
-
BFS.register('scp', 'ssh') do |url, opts|
|
186
|
+
BFS.register('scp', 'ssh') do |url, opts, block|
|
187
|
+
prefix = BFS.norm_path(opts[:prefix] || url.path)
|
188
|
+
opts[:prefix] = prefix unless prefix.empty?
|
187
189
|
opts[:user] ||= CGI.unescape(url.user) if url.user
|
188
190
|
opts[:password] ||= CGI.unescape(url.password) if url.password
|
189
191
|
opts[:port] ||= url.port if url.port
|
190
192
|
|
191
|
-
BFS::Bucket::SCP.
|
193
|
+
BFS::Bucket::SCP.open(url.host, **opts, &block)
|
192
194
|
end
|
data/spec/bfs/bucket/scp_spec.rb
CHANGED
@@ -1,18 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
sandbox
|
4
|
-
run_spec = \
|
5
|
-
begin
|
6
|
-
Net::SCP.start sandbox[:host], nil, sandbox[:opts].merge(timeout: 1) do |scp|
|
7
|
-
scp.session.exec!('hostname')
|
8
|
-
end
|
9
|
-
true
|
10
|
-
rescue Net::SSH::Exception, Errno::ECONNREFUSED => e
|
11
|
-
warn "WARNING: unable to run #{File.basename __FILE__}: #{e.message}"
|
12
|
-
false
|
13
|
-
end
|
3
|
+
sandbox = { host: '127.0.0.1', opts: { port: 7022, user: 'root', password: 'root' } }.freeze
|
14
4
|
|
15
|
-
RSpec.describe BFS::Bucket::SCP,
|
5
|
+
RSpec.describe BFS::Bucket::SCP, scp: true do
|
16
6
|
context 'absolute' do
|
17
7
|
subject { described_class.new sandbox[:host], **sandbox[:opts].merge(prefix: SecureRandom.uuid) }
|
18
8
|
after { subject.close }
|
@@ -30,6 +20,13 @@ RSpec.describe BFS::Bucket::SCP, if: run_spec do
|
|
30
20
|
it 'should resolve from URL' do
|
31
21
|
bucket = BFS.resolve('scp://root:root@127.0.0.1:7022')
|
32
22
|
expect(bucket).to be_instance_of(described_class)
|
23
|
+
expect(bucket.instance_variable_get(:@prefix)).to be_nil
|
24
|
+
bucket.close
|
25
|
+
|
26
|
+
bucket = BFS.resolve('scp://root:root@127.0.0.1:7022/a/b/')
|
27
|
+
expect(bucket).to be_instance_of(described_class)
|
28
|
+
expect(bucket.instance_variable_get(:@prefix)).to eq('a/b/')
|
29
|
+
bucket.close
|
33
30
|
end
|
34
31
|
|
35
32
|
it 'should handle absolute and relative paths' do
|
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.
|
4
|
+
version: 0.7.4
|
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-
|
11
|
+
date: 2020-10-26 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.
|
19
|
+
version: 0.7.4
|
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.
|
26
|
+
version: 0.7.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: net-scp
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,7 +60,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
60
60
|
requirements:
|
61
61
|
- - ">="
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 2.
|
63
|
+
version: 2.6.0
|
64
64
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|