Commit f36db59d authored by Ciro Santilli's avatar Ciro Santilli

Factor GITLAB_SHELL_VERSION get method

parent f9814bf2
...@@ -8,6 +8,13 @@ module Gitlab ...@@ -8,6 +8,13 @@ module Gitlab
end end
end end
class << self
def version_required
@version_required ||= File.read(Rails.root.
join('GITLAB_SHELL_VERSION')).strip
end
end
# Init new repository # Init new repository
# #
# name - project path with namespace # name - project path with namespace
......
...@@ -574,20 +574,16 @@ namespace :gitlab do ...@@ -574,20 +574,16 @@ namespace :gitlab do
Gitlab::Shell.new.version Gitlab::Shell.new.version
end end
def required_gitlab_shell_version
File.read(File.join(Rails.root, "GITLAB_SHELL_VERSION")).strip
end
def gitlab_shell_major_version def gitlab_shell_major_version
required_gitlab_shell_version.split(".")[0].to_i Gitlab::Shell.version_required.split('.')[0].to_i
end end
def gitlab_shell_minor_version def gitlab_shell_minor_version
required_gitlab_shell_version.split(".")[1].to_i Gitlab::Shell.version_required.split('.')[1].to_i
end end
def gitlab_shell_patch_version def gitlab_shell_patch_version
required_gitlab_shell_version.split(".")[2].to_i Gitlab::Shell.version_required.split('.')[2].to_i
end end
def has_gitlab_shell3? def has_gitlab_shell3?
......
...@@ -4,7 +4,7 @@ namespace :gitlab do ...@@ -4,7 +4,7 @@ namespace :gitlab do
task :install, [:tag, :repo] => :environment do |t, args| task :install, [:tag, :repo] => :environment do |t, args|
warn_user_is_not_gitlab 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") args.with_defaults(tag: 'v' + default_version, repo: "https://gitlab.com/gitlab-org/gitlab-shell.git")
user = Gitlab.config.gitlab.user 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