spectre-ftp 2.0.1 → 2.0.3
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 +36 -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: 7e46fba6cb0d3e4b4d028a9c6a55f83560a4f17bd35d7539e250806c234eca1d
|
|
4
|
+
data.tar.gz: a0d862670094baa553b7a23d46eaac7b3a6bbde87f2ad8b0f432ee2dbe560667
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dc6eeb05d1e853f16351a8dbb598e0bd5768bb13ac9af72235ecb64fa599d7505ffc703c99a75c87e7fda80bcdf1dca9c23a55e34f8180ca5c0801757f5a01db
|
|
7
|
+
data.tar.gz: 50cec5fc3bef75a2ad843ee618580bf6025691076cc8d5989818ec2b90d65d8e3af5590471979fd97266b780925a2f1ebeb8bd8685f6ca0b239cbec393c1f635
|
data/lib/spectre/ftp.rb
CHANGED
|
@@ -291,18 +291,34 @@ module Spectre
|
|
|
291
291
|
@logger = logger
|
|
292
292
|
end
|
|
293
293
|
|
|
294
|
+
def ftps(name, config = {}, &)
|
|
295
|
+
config[:ssl] = true
|
|
296
|
+
config[:port] ||= 990
|
|
297
|
+
config[:implicit] = true
|
|
298
|
+
|
|
299
|
+
ftp(name, config, &)
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
def ftpes(name, config = {}, &)
|
|
303
|
+
config[:ssl] = true
|
|
304
|
+
config[:port] ||= 21
|
|
305
|
+
config[:implicit] = false
|
|
306
|
+
|
|
307
|
+
ftp(name, config, &)
|
|
308
|
+
end
|
|
309
|
+
|
|
294
310
|
def ftp(name, config = {}, &)
|
|
295
311
|
cfg = @config[name] || {}
|
|
296
312
|
|
|
297
|
-
|
|
298
|
-
username = config
|
|
299
|
-
password = config
|
|
313
|
+
hostname = config.delete(:host) || cfg['host'] || name
|
|
314
|
+
username = config.delete(:username) || cfg['username']
|
|
315
|
+
password = config.delete(:password) || cfg['password']
|
|
300
316
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
317
|
+
config[:port] = config[:port] || cfg['port'] || 21
|
|
318
|
+
config[:ssl] = config[:ssl] || cfg['ssl'] || false
|
|
319
|
+
config[:implicit_ftps] = config.delete(:implicit) || cfg['implicit'] || false
|
|
304
320
|
|
|
305
|
-
ftp_conn = FTPConnection.new(
|
|
321
|
+
ftp_conn = FTPConnection.new(hostname, username, password, config, @logger)
|
|
306
322
|
|
|
307
323
|
begin
|
|
308
324
|
ftp_conn.instance_eval(&)
|
|
@@ -314,23 +330,22 @@ module Spectre
|
|
|
314
330
|
def sftp(name, config = {}, &)
|
|
315
331
|
cfg = @config[name] || {}
|
|
316
332
|
|
|
317
|
-
host = config
|
|
318
|
-
username = config
|
|
319
|
-
password = config
|
|
333
|
+
host = config.delete(:host) || cfg['host'] || name
|
|
334
|
+
username = config.delete(:username) || cfg['username']
|
|
335
|
+
password = config.delete(:password) || cfg['password']
|
|
320
336
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
opts[:passphrase] = cfg['passphrase'] if cfg.key? 'passphrase'
|
|
337
|
+
config[:password] = password
|
|
338
|
+
config[:port] ||= cfg['port'] || 22
|
|
339
|
+
config[:keys] = [cfg['key']] if cfg.key? 'key'
|
|
340
|
+
config[:passphrase] = cfg['passphrase'] if cfg.key? 'passphrase'
|
|
326
341
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
342
|
+
config[:auth_methods] = []
|
|
343
|
+
config[:auth_methods].push 'publickey' if config[:keys]
|
|
344
|
+
config[:auth_methods].push 'password' if config[:password]
|
|
330
345
|
|
|
331
|
-
|
|
346
|
+
config[:non_interactive] = true
|
|
332
347
|
|
|
333
|
-
sftp_con = SFTPConnection.new(host, username,
|
|
348
|
+
sftp_con = SFTPConnection.new(host, username, config, @logger)
|
|
334
349
|
|
|
335
350
|
begin
|
|
336
351
|
sftp_con.instance_eval(&)
|
|
@@ -341,5 +356,5 @@ module Spectre
|
|
|
341
356
|
end
|
|
342
357
|
end
|
|
343
358
|
|
|
344
|
-
Engine.register(FTP::Client, :ftp, :sftp) if defined? Engine
|
|
359
|
+
Engine.register(FTP::Client, :ftp, :sftp, :ftps, :ftpes) if defined? Engine
|
|
345
360
|
end
|