Class: GitHub::Command::Shell

Inherits:
String
  • Object
show all
Defined in:
lib/github/command.rb

Instance Method Summary collapse

Constructor Details

#initialize(*command) ⇒ Shell

Returns a new instance of Shell.



56
57
58
# File 'lib/github/command.rb', line 56

def initialize(*command)
  @command = command
end

Instance Method Details

#commandObject



69
70
71
# File 'lib/github/command.rb', line 69

def command
  @command.join(' ')
end

#error?Boolean

Returns:

  • (Boolean)


73
74
75
# File 'lib/github/command.rb', line 73

def error?
  !!@error
end

#out?Boolean

Returns:

  • (Boolean)


77
78
79
# File 'lib/github/command.rb', line 77

def out?
  !!@out
end

#runObject



60
61
62
63
64
65
66
67
# File 'lib/github/command.rb', line 60

def run
  GitHub.debug "sh: #{command}"
  
  out = `#{command} 2>&1`
  replace @error = $?.exitstatus.to_s if $?.exitstatus != 0
  replace @out = out if out.any?
  return self
end