lib/backticks.rb in backticks-0.1.1 vs lib/backticks.rb in backticks-0.3.0

- old
+ new

@@ -3,21 +3,34 @@ require_relative 'backticks/command' require_relative 'backticks/runner' require_relative 'backticks/ext' module Backticks - # Run a command. + # Run a command; return a Command object that can be used to interact with + # the running process. Method parameters are passed through to the Runner. # + # @see Backticks::Runner#command # @return [Backticks::Command] a running command - def self.new(*argv) - Backticks::Runner.new.command(*argv) + def self.new(*cmd) + Backticks::Runner.new.command(*cmd) end - # Run a command and return its stdout. + # Run a command; return its stdout. # + # @param [String] cmd # @return [String] the command's output - def self.command(*argv) - command = self.new(*argv) + def self.run(*cmd) + command = self.new(*cmd) command.join command.captured_output + end + + # Run a command; return its success or failure. + # + # @param [String] cmd + # @return [Boolean] true if the command succeeded; false otherwise + def self.system(*cmd) + command = self.new(*cmd) + command.join + $?.success? end end