Commit 6641341b authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

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

Factor GITLAB_SHELL_VERSION get method
parents 36f9224e f36db59d
......@@ -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
......
......@@ -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?
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment