Class: Kdeploy::UploadCommand

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

Overview

Command class for file upload 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(local_path, remote_path, global_variables = {}) ⇒ UploadCommand

Returns a new instance of UploadCommand.



401
402
403
404
405
406
# File 'lib/kdeploy/dsl.rb', line 401

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

Instance Method Details

#execute(host, connection) ⇒ Object



408
409
410
411
412
413
414
415
416
417
418
419
# File 'lib/kdeploy/dsl.rb', line 408

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

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