Added tests for a minimumGit version of 1.8.0.

This commit is contained in:
Jeremy Cook
2014-11-23 22:22:44 -05:00
parent a808f56caf
commit 7bd9759e81
4 changed files with 24 additions and 12 deletions

View File

@@ -4,10 +4,23 @@ module Homesick
# Git-related helper methods for Homesick
module GitActions
# Information on the minimum git version required for Homesick
MAJOR = 2
MINOR = 0
PATCH = 0
STRING = [MAJOR, MINOR, PATCH].compact.join('.')
MIN_VERSION = {
major: 1,
minor: 8,
patch: 0
}
STRING = MIN_VERSION.values.join('.')
def version_check
info = `git --version`.scan(/(\d+)\.(\d+)\.(\d+)/).flatten.map(&:to_i)
return false unless info.count == 3
current_version = Hash[ [:major, :minor, :patch].zip(info) ]
return true if current_version.eql?(MIN_VERSION)
current_version.each do |k,v|
return true if v > MIN_VERSION[k]
end
false
end
# TODO: move this to be more like thor's template, empty_directory, etc
def git_clone(repo, config = {})