bfs-ftp 0.6.2 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bfs-ftp.gemspec +1 -1
  3. data/lib/bfs/bucket/ftp.rb +16 -19
  4. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e46d16067aed45ba5b08ed78f8aef03c9a5bba71e1d3907a889342ce1f4947ca
4
- data.tar.gz: a877150fc240a0b79060d3c15295f734965b0d8ad04f09aac2ad565bddfc6c34
3
+ metadata.gz: 82596b06db1568d9f633733e9ee00a0473d3597c96b4ea755f7c67f1e0b150e2
4
+ data.tar.gz: ea4dfedb77af9e9a77167aac97745deb9fca9e598eab058d53e9270f0ef709c8
5
5
  SHA512:
6
- metadata.gz: cba1489d833132157c36c56259eb7bc3f7be852549a2915d72b9506606b966d9be3528d264023515b63ce74ce9b7bdd361e20d1a2d7666434750befa03f0cd16
7
- data.tar.gz: f152b36ca6a2548c8a4aee5a6c6f18e373bb5ddb65226ab9a7e4b0693b1d25557158df0ad9dee6515e549eb053aa8db871e0632d999f6c9effaf14b72d3024a1
6
+ metadata.gz: 6bc46e356ba7c382e7b7614f4770dafc3019796b212873f41fecbf6ab571ec5961e109cfd008120cf5fd7b3549be8d09b5a4a3d6c719b1dd6b93d8ff5464c9ec
7
+ data.tar.gz: cdb89ae7e48ca49e02a051c595ea021a69e8106d2427b615a5073152279dcdf0c3473dd64183838120765aeb879299ddbaf1cbbe514cb13256e77c26d6c24ca9
@@ -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'
@@ -1,11 +1,12 @@
1
1
  require 'bfs'
2
2
  require 'net/ftp/list'
3
- require 'cgi'
4
3
 
5
4
  module BFS
6
5
  module Bucket
7
6
  # FTP buckets are operating on ftp servers
8
7
  class FTP < Abstract
8
+ attr_reader :perm
9
+
9
10
  # Initializes a new bucket
10
11
  # @param [String] host the host name
11
12
  # @param [Hash] opts options
@@ -30,7 +31,7 @@ module BFS
30
31
 
31
32
  # Lists the contents of a bucket using a glob pattern
32
33
  def ls(pattern = '**/*', **_opts)
33
- dir = pattern[%r{^[^\*\?\{\}\[\]]+/}]
34
+ dir = pattern[%r{^[^*?\{\}\[\]]+/}]
34
35
  dir&.chomp!('/')
35
36
 
36
37
  Enumerator.new do |y|
@@ -49,11 +50,9 @@ module BFS
49
50
  end
50
51
 
51
52
  # Creates a new file and opens it for writing
52
- def create(path, encoding: nil, perm: nil, **_opts, &block)
53
+ def create(path, encoding: self.encoding, perm: self.perm, **_opts, &block)
53
54
  path = norm_path(path)
54
-
55
- enc = encoding || @encoding
56
- temp = BFS::TempWriter.new(path, encoding: enc, perm: perm) do |t|
55
+ temp = BFS::TempWriter.new(path, encoding: encoding, perm: perm) do |t|
57
56
  mkdir_p File.dirname(path)
58
57
  @client.put(t, path)
59
58
  end
@@ -67,14 +66,13 @@ module BFS
67
66
  end
68
67
 
69
68
  # Opens an existing file for reading
70
- def open(path, encoding: nil, tempdir: nil, **_opts, &block)
69
+ def open(path, encoding: self.encoding, perm: self.perm, tempdir: nil, **_opts, &block)
71
70
  path = norm_path(path)
72
- enc = encoding || @encoding
73
- temp = Tempfile.new(File.basename(path), tempdir, encoding: enc)
71
+ temp = Tempfile.new(File.basename(path), tempdir, encoding: encoding, perm: perm)
74
72
  temp.close
75
73
 
76
74
  @client.get(path, temp.path)
77
- File.open(temp.path, encoding: enc, &block)
75
+ File.open(temp.path, encoding: encoding, &block)
78
76
  rescue Net::FTPPermError
79
77
  raise BFS::FileNotFound, path
80
78
  end
@@ -116,13 +114,12 @@ module BFS
116
114
  end
117
115
  end
118
116
 
119
- BFS.register('ftp', 'sftp') do |url|
120
- params = CGI.parse(url.query.to_s)
121
-
122
- BFS::Bucket::FTP.new url.host,
123
- username: url.user ? CGI.unescape(url.user) : nil,
124
- password: url.password ? CGI.unescape(url.password) : nil,
125
- port: url.port,
126
- ssl: params.key?('ssl') || url.scheme == 'sftp',
127
- prefix: params.key?('prefix') ? params['prefix'].first : nil
117
+ BFS.register('ftp', 'sftp') do |url, opts, block|
118
+ extra = {
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',
123
+ }
124
+ BFS::Bucket::FTP.open url.host, **opts, **extra, &block
128
125
  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.2
4
+ version: 0.7.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-02-12 00:00:00.000000000 Z
11
+ date: 2020-07-02 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.2
19
+ version: 0.7.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.2
26
+ version: 0.7.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.5.0
63
+ version: 2.6.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.4
71
71
  signing_key:
72
72
  specification_version: 4
73
73
  summary: FTP adapter for bfs