bfs-scp 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.
- checksums.yaml +4 -4
- data/bfs-scp.gemspec +1 -1
- data/lib/bfs/bucket/scp.rb +9 -15
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3ac45a899e6b5a91f4eaa84e8adfb1c6d5e6e179872fe76af60f8a5bfb46d20
|
4
|
+
data.tar.gz: 077d7b94bc27f0be53cad5219f73541edae90faca2bc1d16cf63f1c0af68483c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97744f1e6f7762a7c56e9d78049e78d9b14bff967c75a84f066275eeeebc6625b3f5185b06ddba0831bf4759febd1cae299c687f096cfb4f57fc295d99c97b67
|
7
|
+
data.tar.gz: d34bf523fb6a8e23b3ce5b9ec81c1c077e8507f46b678ca0b598575ca1c0cb4c7c658752f099c852b4bd7bc84bbca5c63f1b55956f53e138ae5e91ae60316f23
|
data/bfs-scp.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.
|
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'
|
data/lib/bfs/bucket/scp.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'bfs'
|
2
2
|
require 'net/scp'
|
3
|
-
require '
|
3
|
+
require 'net/ssh'
|
4
4
|
require 'shellwords'
|
5
5
|
|
6
6
|
module BFS
|
@@ -32,7 +32,7 @@ module BFS
|
|
32
32
|
super(**opts)
|
33
33
|
|
34
34
|
@prefix = prefix
|
35
|
-
@client = Net::SCP.start(host, nil, **opts)
|
35
|
+
@client = Net::SCP.start(host, nil, **opts.slice(*Net::SSH::VALID_OPTIONS))
|
36
36
|
|
37
37
|
if @prefix # rubocop:disable Style/GuardClause
|
38
38
|
@prefix = norm_path(@prefix) + '/'
|
@@ -68,12 +68,11 @@ module BFS
|
|
68
68
|
# Creates a new file and opens it for writing
|
69
69
|
# @option opts [String|Encoding] :encoding Custom file encoding.
|
70
70
|
# @option opts [Integer] :perm Custom file permission, default: 0600.
|
71
|
-
def create(path, encoding:
|
71
|
+
def create(path, encoding: self.encoding, perm: self.perm, **opts, &block)
|
72
72
|
full = full_path(path)
|
73
73
|
|
74
74
|
opts[:preserve] = true if perm && !opts.key?(:preserve)
|
75
|
-
|
76
|
-
temp = BFS::TempWriter.new(path, encoding: enc, perm: perm) do |temp_path|
|
75
|
+
temp = BFS::TempWriter.new(path, encoding: encoding, perm: perm) do |temp_path|
|
77
76
|
mkdir_p File.dirname(full)
|
78
77
|
@client.upload!(temp_path, full, **opts)
|
79
78
|
end
|
@@ -87,14 +86,13 @@ module BFS
|
|
87
86
|
end
|
88
87
|
|
89
88
|
# Opens an existing file for reading
|
90
|
-
def open(path, encoding:
|
89
|
+
def open(path, encoding: self.encoding, tempdir: nil, **_opts, &block)
|
91
90
|
full = full_path(path)
|
92
|
-
|
93
|
-
temp = Tempfile.new(File.basename(path), tempdir, encoding: enc)
|
91
|
+
temp = Tempfile.new(File.basename(path), tempdir, encoding: encoding)
|
94
92
|
temp.close
|
95
93
|
|
96
94
|
@client.download!(full, temp.path)
|
97
|
-
File.open(temp.path, encoding:
|
95
|
+
File.open(temp.path, encoding: encoding, &block)
|
98
96
|
rescue Net::SCP::Error
|
99
97
|
raise BFS::FileNotFound, path
|
100
98
|
end
|
@@ -185,14 +183,10 @@ module BFS
|
|
185
183
|
end
|
186
184
|
end
|
187
185
|
|
188
|
-
BFS.register('scp', 'ssh') do |url|
|
189
|
-
opts = {}
|
190
|
-
CGI.parse(url.query.to_s).each do |key, values|
|
191
|
-
opts[key.to_sym] = values.first
|
192
|
-
end
|
186
|
+
BFS.register('scp', 'ssh') do |url, opts, block|
|
193
187
|
opts[:user] ||= CGI.unescape(url.user) if url.user
|
194
188
|
opts[:password] ||= CGI.unescape(url.password) if url.password
|
195
189
|
opts[:port] ||= url.port if url.port
|
196
190
|
|
197
|
-
BFS::Bucket::SCP.
|
191
|
+
BFS::Bucket::SCP.open(url.host, **opts, &block)
|
198
192
|
end
|
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.
|
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
|
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.
|
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.
|
26
|
+
version: 0.7.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: net-scp
|
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.
|
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.
|
70
|
+
rubygems_version: 3.1.4
|
71
71
|
signing_key:
|
72
72
|
specification_version: 4
|
73
73
|
summary: SCP/SSH adapter for bfs
|