Module: Backticks

Defined in:
lib/backticks.rb,
lib/backticks/cli.rb,
lib/backticks/ext.rb,
lib/backticks/runner.rb,
lib/backticks/command.rb,
lib/backticks/version.rb

Defined Under Namespace

Modules: CLI, Ext Classes: Command, Runner

Constant Summary collapse

VERSION =
"0.3.0"

Class Method Summary collapse

Class Method Details

.new(*cmd) ⇒ Backticks::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.



13
14
15
# File 'lib/backticks.rb', line 13

def self.new(*cmd)
  Backticks::Runner.new.command(*cmd)
end

.run(*cmd) ⇒ String

Run a command; return its stdout.



21
22
23
24
25
# File 'lib/backticks.rb', line 21

def self.run(*cmd)
  command = self.new(*cmd)
  command.join
  command.captured_output
end

.system(*cmd) ⇒ Boolean

Run a command; return its success or failure.



31
32
33
34
35
# File 'lib/backticks.rb', line 31

def self.system(*cmd)
  command = self.new(*cmd)
  command.join
  $?.success?
end