Class: TestbeatShellVagrant
- Inherits:
-
Object
- Object
- TestbeatShellVagrant
- Defined in:
- lib/spec_helper.rb
Instance Method Summary collapse
- #exec(cmd) ⇒ Object
- #exitstatus ⇒ Object
-
#initialize(vagrantFolder) ⇒ TestbeatShellVagrant
constructor
A new instance of TestbeatShellVagrant.
- #ok? ⇒ Boolean
-
#out ⇒ Object
output of latest exec (stdout and stderr merged, as we haven’t worked on separating them).
Constructor Details
#initialize(vagrantFolder) ⇒ TestbeatShellVagrant
Returns a new instance of TestbeatShellVagrant.
139 140 141 |
# File 'lib/spec_helper.rb', line 139 def initialize(vagrantFolder) @vagrantFolder = vagrantFolder end |
Instance Method Details
#exec(cmd) ⇒ Object
143 144 145 146 147 148 149 150 151 152 |
# File 'lib/spec_helper.rb', line 143 def exec(cmd) $logger.debug {"Exec: #{cmd}"} stdout = nil Dir.chdir(@vagrantFolder){ @out = %x[vagrant ssh -c '#{cmd}' 2>&1] @status = $? } $logger.debug {"Exec result #{exitstatus}: #{@out[0,50].strip}"} return self end |
#exitstatus ⇒ Object
159 160 161 |
# File 'lib/spec_helper.rb', line 159 def exitstatus @status.exitstatus end |
#ok? ⇒ Boolean
163 164 165 |
# File 'lib/spec_helper.rb', line 163 def ok? exitstatus == 0 end |
#out ⇒ Object
output of latest exec (stdout and stderr merged, as we haven’t worked on separating them)
155 156 157 |
# File 'lib/spec_helper.rb', line 155 def out @out end |