Module: Berkshelf::Mixin::Git
Instance Method Summary collapse
-
#git(command, error = true, **kwargs) ⇒ Object
Perform a git command.
Methods included from ShellOut
Instance Method Details
#git(command, error = true, **kwargs) ⇒ Object
Perform a git command.
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/berkshelf/mixin/git.rb', line 16 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 |