summaryrefslogtreecommitdiff
path: root/lib/tasks
diff options
context:
space:
mode:
authorSato Hiroyuki <sathiroyuki@gmail.com>2013-05-08 14:19:51 +0900
committerSato Hiroyuki <sathiroyuki@gmail.com>2013-05-08 17:36:48 +0900
commit862e0ff6b846d9207c3adf9e86b5b84420595935 (patch)
treed06940ebe66d59a59550229004f10b8d25d0682e /lib/tasks
parent2e9599b746d5858eea0e4edcd5db4969b74c885c (diff)
downloadgitlab-ce-862e0ff6b846d9207c3adf9e86b5b84420595935.tar.gz
Add Gitlab::VersionInfo class to fix and simplify version check.
It returns "yes" if required version is "1.7.10" and current version is "1.6.10", because the patch version of current version equals to that of required version.
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/gitlab/check.rake34
1 files changed, 10 insertions, 24 deletions
diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake
index 36e3c1f4941..4a2789b55aa 100644
--- a/lib/tasks/gitlab/check.rake
+++ b/lib/tasks/gitlab/check.rake
@@ -655,39 +655,25 @@ namespace :gitlab do
end
def check_gitlab_shell
- required_version = '1.4.0'
+ required_version = Gitlab::VersionInfo.new(1, 4, 0)
+ current_version = Gitlab::VersionInfo.parse(gitlab_shell_version)
- print "GitLab Shell version? ... "
- if gitlab_shell_version.strip == required_version
- puts "OK (#{required_version})".green
+ print "GitLab Shell version >= #{required_version} ? ... "
+ if required_version <= current_version
+ puts "OK (#{current_version})".green
else
- puts "FAIL. Please update gitlab-shell to v#{required_version}".red
+ puts "FAIL. Please update gitlab-shell to #{required_version} from #{current_version}".red
end
end
def check_git_version
- required_version_major = 1
- required_version_minor = 7
- required_version_patch = 10
-
- required_version = "%d.%d.%d" %[required_version_major, required_version_minor, required_version_patch]
+ required_version = Gitlab::VersionInfo.new(1, 7, 10)
+ current_version = Gitlab::VersionInfo.parse(run("git --version"))
print "Git version >= #{required_version} ? ... "
- if m = run_and_match("git --version", /git version ((\d+)\.(\d+)\.(\d+))/)
- current_version = m[1]
- major = m[2].to_i
- minor = m[3].to_i
- patch = m[4].to_i
- unless major <= required_version_major && minor <= required_version_minor && patch < required_version_patch
- satisfying_git_version = true
- end
- else
- current_version = "Unknown"
- end
-
- if satisfying_git_version
- puts "yes".green
+ if required_version <= current_version
+ puts "yes (#{current_version})".green
else
puts "no".red
try_fixing_it(