class Really::Drivers::DriverBase
Attributes
role_names[RW]
Public Class Methods
new(&block)
click to toggle source
# File lib/really/drivers/driver_base.rb, line 9 def initialize(&block) @role_names = [] instance_eval &block if block end
Public Instance Methods
close()
click to toggle source
# File lib/really/drivers/driver_base.rb, line 45 def close # Subclasses can override this to perform any necessary driver teardown. end
execute_task(task, options = {})
click to toggle source
Internal public API
# File lib/really/drivers/driver_base.rb, line 27 def execute_task(task, options = {}) task.commands.each do |command| logger.debug "command:#{command}" if command.kind_of?(FileTransferCommand) transfer_file command.source_path, command.destination_path, command.options else execute_command command, command.options unless options[:test_run] end end end
open()
click to toggle source
# File lib/really/drivers/driver_base.rb, line 39 def open # Subclasses can override this to perform any driver initialization # that is not appropriate for its constructor (like connecting to # remote hosts, etc.). end
roles(*roles)
click to toggle source
Public API for use within ‘via` blocks in really.rb scripts
# File lib/really/drivers/driver_base.rb, line 20 def roles(*roles) @role_names += roles end
Also aliased as: role
to_s()
click to toggle source
# File lib/really/drivers/driver_base.rb, line 14 def to_s "<#{self.class} roles:#{@role_names}>" end
Protected Instance Methods
command_exited_with_exit_code(exit_code, options = {})
click to toggle source
# File lib/really/drivers/driver_base.rb, line 59 def command_exited_with_exit_code(exit_code, options = {}) raise "Command failed with exit code #{exit_code}." unless exit_code == 0 || options[:allow_failure] end
execute_command(command, options = {})
click to toggle source
# File lib/really/drivers/driver_base.rb, line 51 def execute_command(command, options = {}) raise "Subclasses must implement #execute_command." end
transfer_file(source_path, destination_path, options = {})
click to toggle source
# File lib/really/drivers/driver_base.rb, line 55 def transfer_file(source_path, destination_path, options = {}) raise "Subclasses must implement #transfer_file." end