class GitCompound::Repository::GitCommand

Debug messages for GitCommand

Execute git command

Attributes

command[R]
output[R]
status[R]

Public Class Methods

new(cmd, args, workdir = nil) click to toggle source
# File lib/git_compound/repository/git_command.rb, line 10
def initialize(cmd, args, workdir = nil)
  @command = "git #{cmd} #{args}"
  @workdir = workdir
end

Public Instance Methods

execute() click to toggle source
# File lib/git_compound/repository/git_command.rb, line 22
def execute
  execute!
  raise GitCommandError, @output unless valid?
  @output
end
execute!() click to toggle source
# File lib/git_compound/repository/git_command.rb, line 15
def execute!
  path = @workdir ? @workdir : Dir.pwd
  Dir.chdir(path) { @output = `(#{@command}) 2>&1` }
  @status = $CHILD_STATUS.exitstatus
  @output.sub!(/\n\Z/, '')
end
valid?() click to toggle source
# File lib/git_compound/repository/git_command.rb, line 28
def valid?
  @status == 0
end