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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f7d0399a5fa1d89c350c262f5051f3a00910581075f61fd4a43c5ea1bc75708e
4
- data.tar.gz: '019131a51c1f72e08726ec832702b3da3dceda032752b7601b1f8728adb5af91'
3
+ metadata.gz: ef0ef96a3e86298cb7dd7fa6ff941b737a7a8e81d77739628eb1bd94ddca8369
4
+ data.tar.gz: 2bdf06c5c853c2af45b7ab2ffb93877179134eafe4a9ee28d44fbbddf71e5370
5
5
  SHA512:
6
- metadata.gz: c03f5bdc38ad4d7bd7ee475489d0697c3d933ac16e832a205dd88c92377b208c81a0d20b8799f9403d44c294c66ad36392afebc43654f98ca22dc55bac4ee459
7
- data.tar.gz: 3ce40183b6d57dc539ae9b6084e798ba3277a98d7d1c0475e4b8c730541e99bfcbf027b7b5ba4614295eab1259a9c49eb62d375a261c12710252dfb8d51766d1
6
+ metadata.gz: 2438d29d8106ef151596a2a7556349796e0a2a491f0f8f35386182d65669b6db4fb1a7f8bc5ae8195fc46f983e52545f5c7d8782df64f5cc272f13bad954c6a9
7
+ data.tar.gz: 57e203c4d7b5a2d4d561f4a51a301312f3abe109eef6ab127335e62d70d56943c4abf95e3f03d7d80a534d4ddad8544ca923ab65e074fa18d735b291eeb730e6
@@ -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.5.0'
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'
@@ -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.new(url.host, **opts)
193
+ BFS::Bucket::SCP.open(url.host, **opts, &block)
192
194
  end
@@ -1,18 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
- sandbox = { host: '127.0.0.1', opts: { port: 7022, user: 'root', password: 'root' } }.freeze
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, if: run_spec do
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.6.5
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-02-17 00:00:00.000000000 Z
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.6.5
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.6.5
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.5.0
63
+ version: 2.6.0
64
64
  required_rubygems_version: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="