Class: VagrantSyllabusProvisioner::SpecInfraBackend
- Inherits:
-
SpecInfra::Backend::Ssh
- Object
- SpecInfra::Backend::Ssh
- VagrantSyllabusProvisioner::SpecInfraBackend
- Defined in:
- lib/vagrant_syllabus_provisioner/spec_infra_backend.rb
Instance Attribute Summary collapse
-
#communicator ⇒ Object
Returns the value of attribute communicator.
-
#ui ⇒ Object
Returns the value of attribute ui.
Instance Method Summary collapse
Instance Attribute Details
#communicator ⇒ Object
Returns the value of attribute communicator.
6 7 8 |
# File 'lib/vagrant_syllabus_provisioner/spec_infra_backend.rb', line 6 def communicator @communicator end |
#ui ⇒ Object
Returns the value of attribute ui.
7 8 9 |
# File 'lib/vagrant_syllabus_provisioner/spec_infra_backend.rb', line 7 def ui @ui end |
Instance Method Details
#run_command(cmd, opts = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/vagrant_syllabus_provisioner/spec_infra_backend.rb', line 9 def run_command(cmd, opts={}) opts = {with_output: false}.merge(opts) stdout = "" stderr = "" @ui.info cmd, color: :green if opts[:with_output] exit_status = @communicator.sudo(cmd, error_check: false) do |type, data| case type when :stdout stdout << data when :stderr stderr << data end @ui.info data.chomp if opts[:with_output] end { :stdout => stdout, :stderr => stderr, :exit_status => exit_status, :exit_signal => nil } end |