Class: Really::Drivers::DriverBase
- Defined in:
- lib/really/drivers/driver_base.rb
Instance Attribute Summary collapse
-
#role_names ⇒ Object
Returns the value of attribute role_names.
Instance Method Summary collapse
- #close ⇒ Object
-
#execute_task(task, options = {}) ⇒ Object
Internal public API.
-
#initialize(&block) ⇒ DriverBase
constructor
A new instance of DriverBase.
- #open ⇒ Object
-
#roles(*roles) ⇒ Object
(also: #role)
Public API for use within
viablocks in really.rb scripts. - #to_s ⇒ Object
Constructor Details
#initialize(&block) ⇒ DriverBase
Returns a new instance of DriverBase.
9 10 11 12 |
# File 'lib/really/drivers/driver_base.rb', line 9 def initialize(&block) @role_names = [] instance_eval &block if block end |
Instance Attribute Details
#role_names ⇒ Object
Returns the value of attribute role_names.
7 8 9 |
# File 'lib/really/drivers/driver_base.rb', line 7 def role_names @role_names end |
Instance Method Details
#close ⇒ Object
45 46 47 |
# 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 = {}) ⇒ Object
Internal public API
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/really/drivers/driver_base.rb', line 27 def execute_task(task, = {}) task.commands.each do |command| logger.debug "command:#{command}" if command.kind_of?(FileTransferCommand) transfer_file command.source_path, command.destination_path, command. else execute_command command, command. unless [:test_run] end end end |
#open ⇒ Object
39 40 41 42 43 |
# 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) ⇒ Object Also known as: role
Public API for use within via blocks in really.rb scripts
20 21 22 |
# File 'lib/really/drivers/driver_base.rb', line 20 def roles(*roles) @role_names += roles end |
#to_s ⇒ Object
14 15 16 |
# File 'lib/really/drivers/driver_base.rb', line 14 def to_s "<#{self.class} roles:#{@role_names}>" end |