Sha256: 4aae9d77cca91ca1f6675cc12ad7a6012cafcd569c4aa82c5f88522ffc362e0c
Contents?: true
Size: 775 Bytes
Versions: 19
Compression:
Stored size: 775 Bytes
Contents
require "berkshelf/shell_out" module Berkshelf module Mixin module Git include Berkshelf::ShellOut # Perform a git command. # # @param [String] command # the command to run # @param [Boolean] error # whether to raise error if the command fails # # @raise [String] # the +$stdout+ from the command def git(command, error = true) unless Berkshelf.which("git") || Berkshelf.which("git.exe") || Berkshelf.which("git.bat") raise GitNotInstalled.new end response = shell_out(%{git #{command}}) if response.error? raise GitCommandError.new(command, cache_path, response.stderr) end response.stdout.strip end end end end
Version data entries
19 entries across 19 versions & 1 rubygems