module Gergich

Public Class Methods

git(args) click to toggle source
# File lib/gergich.rb, line 21
def self.git(args)
  Dir.chdir(GERGICH_GIT_PATH) do
    raise(GergichError, "git not installed") unless system("which git > /dev/null 2>&1")

    output, error, status = Open3.capture3("git #{args}")
    if status.success?
      Logging.logger.debug "git #{args}: #{output}"
      output
    else
      Logging.logger.warn "Output: #{output}"
      Logging.logger.warn "git #{args} failed: #{error}"
      nil
    end
  end
end
use_git?() click to toggle source
# File lib/gergich.rb, line 17
def self.use_git?
  !git("rev-parse --show-toplevel").nil?
end