Class: Kdeploy::DownloadCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/kdeploy/dsl.rb

Overview

Command class for file download operations

Instance Attribute Summary

Attributes inherited from Command

#command, #name, #options, #result

Instance Method Summary collapse

Methods inherited from Command

#should_run_on?

Constructor Details

#initialize(remote_path, local_path, global_variables = {}) ⇒ DownloadCommand

Returns a new instance of DownloadCommand.



446
447
448
449
450
451
# File 'lib/kdeploy/dsl.rb', line 446

def initialize(remote_path, local_path, global_variables = {})
  @remote_path = remote_path
  @local_path = local_path
  @global_variables = global_variables
  super()
end

Instance Method Details

#execute(host, connection) ⇒ Object



453
454
455
456
457
458
459
460
461
462
463
464
# File 'lib/kdeploy/dsl.rb', line 453

def execute(host, connection)
  start_time = Time.now
  processed_path = process_remote_path(host)

  begin
    connection.download(processed_path, @local_path)
    record_success(start_time, host)
  rescue StandardError => e
    record_failure(e, start_time, host)
    raise
  end
end