bfs-ftp 0.6.2 → 0.6.3
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.
- checksums.yaml +4 -4
- data/lib/bfs/bucket/ftp.rb +10 -15
- 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: d222bfc10f937a2ad321be7eb63c1408057cc77b5d1807ed8229310f3482444a
|
4
|
+
data.tar.gz: 1a50538331195f067090a9b0d3fbd1afb1b0eb1b611d730d09a3433f3668b9be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 845561eeac7af25ebe8616a6c0bb0c30ad7cbc287ff0f6d7df31456b03c3e3c755358927c503d9bb3b41a4c7d8b82d00e51e96406ea018b884da016444a959e5
|
7
|
+
data.tar.gz: 6e2d0c34cadee4fc961e1a495df04fed73ec98918d5ae0fc5e7a673272a7abf7daf665f33c915adbac6666bbbf79655589a34db8ca135970234cbfcebd85e8e8
|
data/lib/bfs/bucket/ftp.rb
CHANGED
@@ -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
|
@@ -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:
|
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:
|
69
|
+
def open(path, encoding: self.encoding, perm: self.perm, tempdir: nil, **_opts, &block)
|
71
70
|
path = norm_path(path)
|
72
|
-
|
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:
|
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,10 @@ module BFS
|
|
116
114
|
end
|
117
115
|
end
|
118
116
|
|
119
|
-
BFS.register('ftp', 'sftp') do |url|
|
120
|
-
|
121
|
-
|
122
|
-
BFS::Bucket::FTP.new url.host,
|
117
|
+
BFS.register('ftp', 'sftp') do |url, opts|
|
118
|
+
BFS::Bucket::FTP.new url.host, **opts,
|
123
119
|
username: url.user ? CGI.unescape(url.user) : nil,
|
124
120
|
password: url.password ? CGI.unescape(url.password) : nil,
|
125
121
|
port: url.port,
|
126
|
-
ssl:
|
127
|
-
prefix: params.key?('prefix') ? params['prefix'].first : nil
|
122
|
+
ssl: opts.key?(:ssl) || url.scheme == 'sftp'
|
128
123
|
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.
|
4
|
+
version: 0.6.3
|
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-
|
11
|
+
date: 2020-02-13 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.
|
19
|
+
version: 0.6.3
|
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.
|
26
|
+
version: 0.6.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: net-ftp-list
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
requirements: []
|
70
|
-
rubygems_version: 3.
|
70
|
+
rubygems_version: 3.1.2
|
71
71
|
signing_key:
|
72
72
|
specification_version: 4
|
73
73
|
summary: FTP adapter for bfs
|