Module: Berkshelf::Mixin::Git
- Included in:
- GitLocation, InitGenerator
- Defined in:
- lib/berkshelf/mixin/git.rb
Instance Method Summary collapse
-
#git(command, error = true) ⇒ Object
Perform a git command.
Instance Method Details
#git(command, error = true) ⇒ Object
Perform a git command.
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/berkshelf/mixin/git.rb', line 15 def git(command, error = true) unless Berkshelf.which('git') || Berkshelf.which('git.exe') raise GitNotInstalled.new end response = Buff::ShellOut.shell_out(%|git #{command}|) if error && !response.success? raise GitCommandError.new(command, cache_path, response.stderr) end response.stdout.strip end |