bfs-ftp 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: 85b81fe78a4d4ed60e8bea55f766aeaca804f481134fe8f22e4c83d08b187a73
4
- data.tar.gz: bd0249940b1b8c636e29a9dd9d270078093040f630a7a3b027c3690e7b16c9c7
3
+ metadata.gz: a5820d3e120364beff252e9be4627e000b78ada20644d8bd5c84ad4eb44eb3e1
4
+ data.tar.gz: bac8723f260ec70508c558b8e6ca777741f91794efd4ee2ef31334c328076d28
5
5
  SHA512:
6
- metadata.gz: 66062208216843dea9ac3f5244851b8ed4e8e9c73f280aa02e3cc6b60205d7a88244d7431763e1e303beaf0d2ceca5ee86b9083f0656817d76efeaf47e561cb4
7
- data.tar.gz: e07b00f473543d6e825bb99d21ed4de2adc0e3b2c5ebe829b6edfbb5ed580ed82f01cb544a818040068e24b45b9620db9dbd15a047da2f33fdaa0fea6870889d
6
+ metadata.gz: 45921227dd24fe1a7114b8933bdf0beebe12ff85a2e3e6dfb98a1b8c011a446e60e5f48f5a7861d3c0a29a9a5cf34dc21a0fe2e7bd0623cea7ec0d7898dfffd4
7
+ data.tar.gz: f4c815dfaeb5f3c553dc629627af46857a3a38dbf49381fde8a65a66de94a903b6ed752f7d3e37344958b85fec79cc018a7ba818eee4f28f964b75aa1f53ec7e
@@ -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-ftp-list'
@@ -31,7 +31,7 @@ module BFS
31
31
 
32
32
  # Lists the contents of a bucket using a glob pattern
33
33
  def ls(pattern = '**/*', **_opts)
34
- dir = pattern[%r{^[^\*\?\{\}\[\]]+/}]
34
+ dir = pattern[%r{^[^*?\{\}\[\]]+/}]
35
35
  dir&.chomp!('/')
36
36
 
37
37
  Enumerator.new do |y|
@@ -114,10 +114,15 @@ module BFS
114
114
  end
115
115
  end
116
116
 
117
- BFS.register('ftp', 'sftp') do |url, opts|
118
- BFS::Bucket::FTP.new url.host, **opts,
119
- username: url.user ? CGI.unescape(url.user) : nil,
120
- password: url.password ? CGI.unescape(url.password) : nil,
121
- port: url.port,
122
- ssl: opts.key?(:ssl) || url.scheme == 'sftp'
117
+ BFS.register('ftp', 'sftp') do |url, opts, block|
118
+ prefix = BFS.norm_path(opts[:prefix] || url.path)
119
+ opts[:prefix] = prefix unless prefix.empty?
120
+
121
+ extra = {
122
+ username: url.user ? CGI.unescape(url.user) : nil,
123
+ password: url.password ? CGI.unescape(url.password) : nil,
124
+ port: url.port,
125
+ ssl: opts.key?(:ssl) || url.scheme == 'sftp',
126
+ }
127
+ BFS::Bucket::FTP.open url.host, **opts, **extra, &block
123
128
  end
@@ -1,17 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
- sandbox = { host: '127.0.0.1', port: 7021, username: 'ftpuser', password: 'ftppass' }.freeze
4
- run_spec = \
5
- begin
6
- ftp = Net::FTP.new sandbox[:host], sandbox
7
- ftp.list
8
- ftp.close
9
- rescue Errno::ECONNREFUSED, Net::FTPError => e
10
- warn "WARNING: unable to run #{File.basename __FILE__}: #{e.message}"
11
- false
12
- end
3
+ sandbox = { host: '127.0.0.1', port: 7021, username: 'ftpuser', password: 'ftppass' }.freeze
13
4
 
14
- RSpec.describe BFS::Bucket::FTP, if: run_spec do
5
+ RSpec.describe BFS::Bucket::FTP, ftp: true do
15
6
  subject { described_class.new sandbox[:host], **sandbox.merge(prefix: SecureRandom.uuid) }
16
7
  after { subject.close }
17
8
 
@@ -22,5 +13,12 @@ RSpec.describe BFS::Bucket::FTP, if: run_spec do
22
13
  it 'should resolve from URL' do
23
14
  bucket = BFS.resolve('ftp://ftpuser:ftppass@127.0.0.1:7021')
24
15
  expect(bucket).to be_instance_of(described_class)
16
+ expect(bucket.instance_variable_get(:@client).pwd).to eq('/ftp/ftpuser')
17
+ bucket.close
18
+
19
+ bucket = BFS.resolve('ftp://ftpuser:ftppass@127.0.0.1:7021/a/b/')
20
+ expect(bucket).to be_instance_of(described_class)
21
+ expect(bucket.instance_variable_get(:@client).pwd).to eq('/ftp/ftpuser/a/b')
22
+ bucket.close
25
23
  end
26
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bfs-ftp
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-ftp-list
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
  - - ">="