Sha256: a070f07a3b7a27f1797453b69273a892a197c98ec7b3ab43d81b081cb8ded44f
Contents?: true
Size: 673 Bytes
Versions: 2
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}) 2>&1" @workdir = workdir end def execute! path = @workdir ? @workdir : Dir.pwd Dir.chdir(path) { @output = `#{@command}` } @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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
git_compound-0.1.0 | lib/git_compound/repository/git_command.rb |
git_compound-0.0.10 | lib/git_compound/repository/git_command.rb |