bfs-ftp 0.6.0 → 0.6.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: 3b5e49a381ab76953cfffc9dd522b818be1b5423509bc35798758c5ca968f88a
4
- data.tar.gz: a821689a6b8de899193ac293f0f51e786f23ea07a52ef9ca9d7d63a7ac27d225
3
+ metadata.gz: 1382d2b94a93557fd39b9fa5a81a932836bb381e5eb96b4cf41551b8b7d1cfea
4
+ data.tar.gz: c8152beba12ccc144e5b740bc768d5559be75ee0b79029c9bfdadbdc415975ed
5
5
  SHA512:
6
- metadata.gz: 3903fc670e7e5709289e2cea5a95e7fe39383df0ae26e578d863654dfca016862c0309f286403241fd82ac0328a014fa29dec5956b1410ac660fb80107a1f67a
7
- data.tar.gz: b8d81cc725fc66a79d52a882f9c5789978559311884eb54a5f51fc23c13d523957a7a8fd7379b9bf019e2eb8886180788f6e5aa9b20910d6e5f1b62e2bdcdbef
6
+ metadata.gz: 5d12dedbf6a8ef0f96dccaf21c9104298739ed9deb821006ef10a3596d76ec1d2b3da1ec95e2f2e37ac9ad0af24afdf9638dff001bcc0e74e0f7c8ffdccc42ee
7
+ data.tar.gz: afc2daba69cacdb914a474b2b1575e627eb6e72f026e1da34aa4759f46d328cab123211c2366885882e347e17bd19f021984c3d25449ea6a5c423b50f8aed316
data/bfs-ftp.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.4.0'
18
+ s.required_ruby_version = '>= 2.5.0'
19
19
 
20
20
  s.add_dependency 'bfs', s.version
21
21
  s.add_dependency 'net-ftp-list'
@@ -6,7 +6,6 @@ module BFS
6
6
  module Bucket
7
7
  # FTP buckets are operating on ftp servers
8
8
  class FTP < Abstract
9
-
10
9
  # Initializes a new bucket
11
10
  # @param [String] host the host name
12
11
  # @param [Hash] opts options
@@ -16,16 +15,16 @@ module BFS
16
15
  # @option opts [String] :password password for login.
17
16
  # @option opts [String] :passive connect in passive mode. Default: true.
18
17
  # @option opts [String] :prefix optional prefix.
19
- def initialize(host, opts={})
18
+ def initialize(host, **opts)
20
19
  opts = opts.dup
21
20
  opts.keys.each do |key|
22
21
  val = opts.delete(key)
23
22
  opts[key.to_sym] = val unless val.nil?
24
23
  end
25
- super(opts)
24
+ super(**opts)
26
25
 
27
26
  prefix = opts.delete(:prefix)
28
- @client = Net::FTP.new(host, opts)
27
+ @client = Net::FTP.new(host, **opts)
29
28
  @client.binary = true
30
29
 
31
30
  if prefix # rubocop:disable Style/GuardClause
@@ -36,7 +35,7 @@ module BFS
36
35
  end
37
36
 
38
37
  # Lists the contents of a bucket using a glob pattern
39
- def ls(pattern='**/*', _opts={})
38
+ def ls(pattern = '**/*', **_opts)
40
39
  dir = pattern[%r{^[^\*\?\{\}\[\]]+/}]
41
40
  dir&.chomp!('/')
42
41
 
@@ -48,7 +47,7 @@ module BFS
48
47
  end
49
48
 
50
49
  # Info returns the object info
51
- def info(path, _opts={})
50
+ def info(path, **_opts)
52
51
  path = norm_path(path)
53
52
  BFS::FileInfo.new(path, @client.size(path), @client.mtime(path))
54
53
  rescue Net::FTPPermError
@@ -56,7 +55,7 @@ module BFS
56
55
  end
57
56
 
58
57
  # Creates a new file and opens it for writing
59
- def create(path, opts={}, &block)
58
+ def create(path, **opts, &block)
60
59
  path = norm_path(path)
61
60
  enc = opts.delete(:encoding) || @encoding
62
61
  temp = BFS::TempWriter.new(path, encoding: enc) do |t|
@@ -73,7 +72,7 @@ module BFS
73
72
  end
74
73
 
75
74
  # Opens an existing file for reading
76
- def open(path, opts={}, &block)
75
+ def open(path, **opts, &block)
77
76
  path = norm_path(path)
78
77
  enc = opts.delete(:encoding) || @encoding
79
78
  temp = Tempfile.new(File.basename(path), encoding: enc)
@@ -86,7 +85,7 @@ module BFS
86
85
  end
87
86
 
88
87
  # Deletes a file.
89
- def rm(path, _opts={})
88
+ def rm(path, **_opts)
90
89
  path = norm_path(path)
91
90
  @client.delete(path)
92
91
  rescue Net::FTPPermError # rubocop:disable Lint/SuppressedException
@@ -114,10 +113,8 @@ module BFS
114
113
  def mkdir_p(path)
115
114
  parts = path.split('/').reject(&:empty?)
116
115
  (0...parts.size).each do |i|
117
- begin
118
- @client.mkdir parts[0..i].join('/')
119
- rescue Net::FTPPermError # rubocop:disable Lint/SuppressedException
120
- end
116
+ @client.mkdir parts[0..i].join('/')
117
+ rescue Net::FTPPermError # rubocop:disable Lint/SuppressedException
121
118
  end
122
119
  end
123
120
  end
@@ -128,9 +125,9 @@ BFS.register('ftp', 'sftp') do |url|
128
125
  params = CGI.parse(url.query.to_s)
129
126
 
130
127
  BFS::Bucket::FTP.new url.host,
131
- username: url.user ? CGI.unescape(url.user) : nil,
132
- password: url.password ? CGI.unescape(url.password) : nil,
133
- port: url.port,
134
- ssl: params.key?('ssl') || url.scheme == 'sftp',
135
- prefix: params.key?('prefix') ? params['prefix'].first : nil
128
+ username: url.user ? CGI.unescape(url.user) : nil,
129
+ password: url.password ? CGI.unescape(url.password) : nil,
130
+ port: url.port,
131
+ ssl: params.key?('ssl') || url.scheme == 'sftp',
132
+ prefix: params.key?('prefix') ? params['prefix'].first : nil
136
133
  end
@@ -12,12 +12,12 @@ run_spec = \
12
12
  end
13
13
 
14
14
  RSpec.describe BFS::Bucket::FTP, if: run_spec do
15
- subject { described_class.new sandbox[:host], sandbox.merge(prefix: SecureRandom.uuid) }
15
+ subject { described_class.new sandbox[:host], **sandbox.merge(prefix: SecureRandom.uuid) }
16
16
  after { subject.close }
17
17
 
18
18
  it_behaves_like 'a bucket',
19
- content_type: false,
20
- metadata: false
19
+ content_type: false,
20
+ metadata: false
21
21
 
22
22
  it 'should resolve from URL' do
23
23
  bucket = BFS.resolve('ftp://ftpuser:ftppass@127.0.0.1:7021')
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.0
4
+ version: 0.6.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: 2019-12-19 00:00:00.000000000 Z
11
+ date: 2020-02-11 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.0
19
+ version: 0.6.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.6.0
26
+ version: 0.6.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: net-ftp-list
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -60,14 +60,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - ">="
62
62
  - !ruby/object:Gem::Version
63
- version: 2.4.0
63
+ version: 2.5.0
64
64
  required_rubygems_version: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  requirements: []
70
- rubygems_version: 3.0.6
70
+ rubygems_version: 3.1.2
71
71
  signing_key:
72
72
  specification_version: 4
73
73
  summary: FTP adapter for bfs