bfs-scp 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bfs/bucket/scp.rb +6 -13
  3. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d2a1d8aa79faab191a46b8719628bc1b92fa2528be1e9b95d1e0c88e34e5131
4
- data.tar.gz: 3b8ed648fc045c535b360c9541028655a18748c4421cdec5f6ac23b3ca04681a
3
+ metadata.gz: 88c4450a085548f67333ffeed22e97809d46b75fa67b594ac381ea0e21880541
4
+ data.tar.gz: 9c6468f065820d8e5265cda9f3e16e95832667dd564ea6d5ef4689e319f3842a
5
5
  SHA512:
6
- metadata.gz: 375ed1a9efc068961df091335dd6950e934d3f9363d7c79b6e8428c4d04febe368569189caf8b941ca74b3b1c964229cc7df6ed1399e6cdb783e16a2e71c1814
7
- data.tar.gz: faaccfff6e02b43e0e41374596dd89f169c827916ca1902d3504de4cdbafb6fcc53594055170a68a7b76715783d82217e55200bdb233c379392446d4853888aa
6
+ metadata.gz: 67a1cb18ac12d0751d3bd9093e8e224f4df380d8b84b05a79de6e518abebfa907d1ee630d30d437fb2b46598e737fda198d668ee609679cc3ac188e008c09189
7
+ data.tar.gz: 6dc91a25174c7e039e48f212fa5742f6a0b54bdb3bdc595dc66e7c699493fd5ab1b0e80811f6f22cf2077276cd8e9307bbad3cb5ffca4f6b95a409482ae6c60f
@@ -1,6 +1,5 @@
1
1
  require 'bfs'
2
2
  require 'net/scp'
3
- require 'cgi'
4
3
  require 'shellwords'
5
4
 
6
5
  module BFS
@@ -68,12 +67,11 @@ module BFS
68
67
  # Creates a new file and opens it for writing
69
68
  # @option opts [String|Encoding] :encoding Custom file encoding.
70
69
  # @option opts [Integer] :perm Custom file permission, default: 0600.
71
- def create(path, encoding: nil, perm: nil, **opts, &block)
70
+ def create(path, encoding: self.encoding, perm: self.perm, **opts, &block)
72
71
  full = full_path(path)
73
72
 
74
73
  opts[:preserve] = true if perm && !opts.key?(:preserve)
75
- enc = encoding || @encoding
76
- temp = BFS::TempWriter.new(path, encoding: enc, perm: perm) do |temp_path|
74
+ temp = BFS::TempWriter.new(path, encoding: encoding, perm: perm) do |temp_path|
77
75
  mkdir_p File.dirname(full)
78
76
  @client.upload!(temp_path, full, **opts)
79
77
  end
@@ -87,14 +85,13 @@ module BFS
87
85
  end
88
86
 
89
87
  # Opens an existing file for reading
90
- def open(path, encoding: nil, tempdir: nil, **_opts, &block)
88
+ def open(path, encoding: self.encoding, tempdir: nil, **_opts, &block)
91
89
  full = full_path(path)
92
- enc = encoding || @encoding
93
- temp = Tempfile.new(File.basename(path), tempdir, encoding: enc)
90
+ temp = Tempfile.new(File.basename(path), tempdir, encoding: encoding)
94
91
  temp.close
95
92
 
96
93
  @client.download!(full, temp.path)
97
- File.open(temp.path, encoding: enc, &block)
94
+ File.open(temp.path, encoding: encoding, &block)
98
95
  rescue Net::SCP::Error
99
96
  raise BFS::FileNotFound, path
100
97
  end
@@ -185,11 +182,7 @@ module BFS
185
182
  end
186
183
  end
187
184
 
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
185
+ BFS.register('scp', 'ssh') do |url, opts|
193
186
  opts[:user] ||= CGI.unescape(url.user) if url.user
194
187
  opts[:password] ||= CGI.unescape(url.password) if url.password
195
188
  opts[:port] ||= url.port if url.port
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.6.2
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-12 00:00:00.000000000 Z
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.2
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.2
26
+ version: 0.6.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: net-scp
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.0.6
70
+ rubygems_version: 3.1.2
71
71
  signing_key:
72
72
  specification_version: 4
73
73
  summary: SCP/SSH adapter for bfs