spectre-ftp 2.0.1 → 2.0.2

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/spectre/ftp.rb +26 -21
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '055907f899bb094c17845e01db766dd1d643ef78d87981fc4bd007bf3b430b2e'
4
- data.tar.gz: 3b9fb444b4949712f8df4891c4276a938aa04b4c34b9a5b7789023234a572722
3
+ metadata.gz: b8d6f6f87bd1046313a344b49321de16b08d13dd057ef2d1a2c13341b65111d7
4
+ data.tar.gz: 1f10d7313743695c98dc595736aa7fd4566c9e4b47e73fad364f2daffdff1df0
5
5
  SHA512:
6
- metadata.gz: 3d0f4f82bf15afe3d0927a86af940ca8dfa291fdb4f4958f66811541666f202fec7922f8a38515a2500da14b70dd01276733ff607bc57b029539b6213f81c11f
7
- data.tar.gz: 5ef3c799773931a559725d3f296358451e4e7db8c424deec11b7a549357db5716652511a3a582aab7ed7a47aa06dd4aa5f811e15bbda2bad7b4b9867a59d0345
6
+ metadata.gz: a5409c0acb1cefaf3b6cf392f7dfe6f6cefb97346eca7a078920c2c1f0ec84745bf5347b325bc2b8f0571d3f40e578d52c3212ac5dc5f253dc6acd9a4a7e85fa
7
+ data.tar.gz: f93d905e0264e1225716a24ace24aa944c667c5b4c887a7aed8412af0145692db462de5c3b8a5d1b437bf81dc273628a7c794f412b28de72e41b61f9f1287088
data/lib/spectre/ftp.rb CHANGED
@@ -291,18 +291,24 @@ module Spectre
291
291
  @logger = logger
292
292
  end
293
293
 
294
+ def ftps(name, config = {}, &)
295
+ config[:ssl] ||= { implicit: true }
296
+ config[:port] ||= 990
297
+
298
+ ftp(name, config, &)
299
+ end
300
+
294
301
  def ftp(name, config = {}, &)
295
302
  cfg = @config[name] || {}
296
303
 
297
- host = config[:host] || cfg['host'] || name
298
- username = config[:username] || cfg['username']
299
- password = config[:password] || cfg['password']
304
+ hostname = config.delete(:host) || cfg['host'] || name
305
+ username = config.delete(:username) || cfg['username']
306
+ password = config.delete(:password) || cfg['password']
300
307
 
301
- opts = {}
302
- opts[:ssl] = config[:ssl]
303
- opts[:port] = config[:port] || cfg['port'] || 21
308
+ config[:port] = config[:port] || cfg['port'] || 21
309
+ config[:ssl] = config[:ssl] || cfg['ssl']
304
310
 
305
- ftp_conn = FTPConnection.new(host, username, password, opts, @logger)
311
+ ftp_conn = FTPConnection.new(hostname, username, password, config, @logger)
306
312
 
307
313
  begin
308
314
  ftp_conn.instance_eval(&)
@@ -314,23 +320,22 @@ module Spectre
314
320
  def sftp(name, config = {}, &)
315
321
  cfg = @config[name] || {}
316
322
 
317
- host = config[:host] || cfg['host'] || name
318
- username = config[:username] || cfg['username']
319
- password = config[:password] || cfg['password']
323
+ host = config.delete(:host) || cfg['host'] || name
324
+ username = config.delete(:username) || cfg['username']
325
+ password = config.delete(:password) || cfg['password']
320
326
 
321
- opts = {}
322
- opts[:password] = password
323
- opts[:port] = config[:port] || cfg['port'] || 22
324
- opts[:keys] = [cfg['key']] if cfg.key? 'key'
325
- opts[:passphrase] = cfg['passphrase'] if cfg.key? 'passphrase'
327
+ config[:password] = password
328
+ config[:port] ||= cfg['port'] || 22
329
+ config[:keys] = [cfg['key']] if cfg.key? 'key'
330
+ config[:passphrase] = cfg['passphrase'] if cfg.key? 'passphrase'
326
331
 
327
- opts[:auth_methods] = []
328
- opts[:auth_methods].push 'publickey' if opts[:keys]
329
- opts[:auth_methods].push 'password' if opts[:password]
332
+ config[:auth_methods] = []
333
+ config[:auth_methods].push 'publickey' if config[:keys]
334
+ config[:auth_methods].push 'password' if config[:password]
330
335
 
331
- opts[:non_interactive] = true
336
+ config[:non_interactive] = true
332
337
 
333
- sftp_con = SFTPConnection.new(host, username, opts, @logger)
338
+ sftp_con = SFTPConnection.new(host, username, config, @logger)
334
339
 
335
340
  begin
336
341
  sftp_con.instance_eval(&)
@@ -341,5 +346,5 @@ module Spectre
341
346
  end
342
347
  end
343
348
 
344
- Engine.register(FTP::Client, :ftp, :sftp) if defined? Engine
349
+ Engine.register(FTP::Client, :ftp, :sftp, :ftps) if defined? Engine
345
350
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spectre-ftp
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Neubauer