bfs-ftp 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/ftp.rb +10 -15
  3. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e46d16067aed45ba5b08ed78f8aef03c9a5bba71e1d3907a889342ce1f4947ca
4
- data.tar.gz: a877150fc240a0b79060d3c15295f734965b0d8ad04f09aac2ad565bddfc6c34
3
+ metadata.gz: d222bfc10f937a2ad321be7eb63c1408057cc77b5d1807ed8229310f3482444a
4
+ data.tar.gz: 1a50538331195f067090a9b0d3fbd1afb1b0eb1b611d730d09a3433f3668b9be
5
5
  SHA512:
6
- metadata.gz: cba1489d833132157c36c56259eb7bc3f7be852549a2915d72b9506606b966d9be3528d264023515b63ce74ce9b7bdd361e20d1a2d7666434750befa03f0cd16
7
- data.tar.gz: f152b36ca6a2548c8a4aee5a6c6f18e373bb5ddb65226ab9a7e4b0693b1d25557158df0ad9dee6515e549eb053aa8db871e0632d999f6c9effaf14b72d3024a1
6
+ metadata.gz: 845561eeac7af25ebe8616a6c0bb0c30ad7cbc287ff0f6d7df31456b03c3e3c755358927c503d9bb3b41a4c7d8b82d00e51e96406ea018b884da016444a959e5
7
+ data.tar.gz: 6e2d0c34cadee4fc961e1a495df04fed73ec98918d5ae0fc5e7a673272a7abf7daf665f33c915adbac6666bbbf79655589a34db8ca135970234cbfcebd85e8e8
@@ -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: 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,10 @@ 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,
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: params.key?('ssl') || url.scheme == 'sftp',
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.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-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.0.6
70
+ rubygems_version: 3.1.2
71
71
  signing_key:
72
72
  specification_version: 4
73
73
  summary: FTP adapter for bfs