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.
- checksums.yaml +4 -4
- data/lib/spectre/ftp.rb +26 -21
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b8d6f6f87bd1046313a344b49321de16b08d13dd057ef2d1a2c13341b65111d7
|
|
4
|
+
data.tar.gz: 1f10d7313743695c98dc595736aa7fd4566c9e4b47e73fad364f2daffdff1df0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
298
|
-
username = config
|
|
299
|
-
password = config
|
|
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
|
-
|
|
302
|
-
|
|
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(
|
|
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
|
|
318
|
-
username = config
|
|
319
|
-
password = config
|
|
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
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
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
|
-
|
|
328
|
-
|
|
329
|
-
|
|
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
|
-
|
|
336
|
+
config[:non_interactive] = true
|
|
332
337
|
|
|
333
|
-
sftp_con = SFTPConnection.new(host, username,
|
|
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
|