Merge pull request #8254 from cirosantilli/factor-get-shell-version

Factor GITLAB_SHELL_VERSION get method
This commit is contained in:
Dmitriy Zaporozhets 2014-11-08 11:04:56 +02:00
commit 6641341b65
3 changed files with 11 additions and 8 deletions

View file

@ -8,6 +8,13 @@ module Gitlab
end
end
class << self
def version_required
@version_required ||= File.read(Rails.root.
join('GITLAB_SHELL_VERSION')).strip
end
end
# Init new repository
#
# name - project path with namespace

View file

@ -574,20 +574,16 @@ namespace :gitlab do
Gitlab::Shell.new.version
end
def required_gitlab_shell_version
File.read(File.join(Rails.root, "GITLAB_SHELL_VERSION")).strip
end
def gitlab_shell_major_version
required_gitlab_shell_version.split(".")[0].to_i
Gitlab::Shell.version_required.split('.')[0].to_i
end
def gitlab_shell_minor_version
required_gitlab_shell_version.split(".")[1].to_i
Gitlab::Shell.version_required.split('.')[1].to_i
end
def gitlab_shell_patch_version
required_gitlab_shell_version.split(".")[2].to_i
Gitlab::Shell.version_required.split('.')[2].to_i
end
def has_gitlab_shell3?

View file

@ -4,7 +4,7 @@ namespace :gitlab do
task :install, [:tag, :repo] => :environment do |t, args|
warn_user_is_not_gitlab
default_version = File.read(File.join(Rails.root, "GITLAB_SHELL_VERSION")).strip
default_version = Gitlab::Shell.version_required
args.with_defaults(tag: 'v' + default_version, repo: "https://gitlab.com/gitlab-org/gitlab-shell.git")
user = Gitlab.config.gitlab.user