Sha256: 9fce43dda50431a7b2eb7d60e5e1f55c66fabb9d9c5be84918357e7b4b04023e
Contents?: true
Size: 673 Bytes
Versions: 5
Compression:
Stored size: 673 Bytes
Contents
require 'English' module GitCompound module Repository # Execute git command # class GitCommand attr_reader :output, :status, :command def initialize(cmd, args, workdir = nil) @command = "git #{cmd} #{args}" @workdir = workdir end def execute! path = @workdir ? @workdir : Dir.pwd Dir.chdir(path) { @output = `(#{@command}) 2>&1` } @status = $CHILD_STATUS.exitstatus @output.sub!(/\n\Z/, '') end def execute execute! raise GitCommandError, @output unless valid? @output end def valid? @status == 0 end end end end
Version data entries
5 entries across 5 versions & 1 rubygems