lib/serverspec/backend/exec.rb in serverspec-0.8.1 vs lib/serverspec/backend/exec.rb in serverspec-0.9.0

- old
+ new

@@ -1,24 +1,11 @@ require 'singleton' module Serverspec module Backend - class Exec - include Singleton + class Exec < Base - def set_commands(c) - @commands = c - end - - def set_example(e) - @example = e - end - - def commands - @commands - end - def run_command(cmd, opts={}) cmd = build_command(cmd) cmd = add_pre_command(cmd) stdout = `#{build_command(cmd)} 2>&1` # In ruby 1.9, it is possible to use Open3.capture3, but not in 1.8 @@ -48,19 +35,9 @@ if Serverspec.configuration.pre_command cmd = "#{Serverspec.configuration.pre_command} && #{cmd}" cmd = "env PATH=#{path}:$PATH #{cmd}" if path end cmd - end - - def check_zero(cmd, *args) - ret = run_command(commands.send(cmd, *args)) - ret[:exit_status] == 0 - end - - # Default action is to call check_zero with args - def method_missing(meth, *args, &block) - check_zero(meth, *args) end def check_running(process) ret = run_command(commands.check_running(process)) if ret[:exit_status] == 1 || ret[:stdout] =~ /stopped/