module Berkshelf::Mixin::Git

def git(command, error = true, **kwargs)

Raises:
  • (String) -

Parameters:
  • error (Boolean) --
  • command (String) --
def git(command, error = true, **kwargs)
  unless Berkshelf.which("git") || Berkshelf.which("git.exe") || Berkshelf.which("git.bat")
    raise GitNotInstalled.new
  end
  response = shell_out(%{git #{command}}, **kwargs)
  if response.error?
    raise GitCommandError.new(command, cache_path, response.stderr)
  end
  response.stdout.strip
end