Commit fd2ebba8 authored by Nick Thomas's avatar Nick Thomas

Promote Gitlab::Shell#version to a class method

This brings it more inline with, e.g., Gitlab::Workhorse
parent b29eed55
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
%p %p
GitLab Shell GitLab Shell
%span.float-right %span.float-right
= Gitlab::Shell.new.version = Gitlab::Shell.version
%p %p
GitLab Workhorse GitLab Workhorse
%span.float-right %span.float-right
......
unless Rails.env.test? unless Rails.env.test?
required_version = Gitlab::VersionInfo.parse(Gitlab::Shell.version_required) required_version = Gitlab::VersionInfo.parse(Gitlab::Shell.version_required)
current_version = Gitlab::VersionInfo.parse(Gitlab::Shell.new.version) current_version = Gitlab::VersionInfo.parse(Gitlab::Shell.version)
unless current_version.valid? && required_version <= current_version unless current_version.valid? && required_version <= current_version
warn "WARNING: This version of GitLab depends on gitlab-shell #{required_version}, but you're running #{current_version}. Please update gitlab-shell." warn "WARNING: This version of GitLab depends on gitlab-shell #{required_version}, but you're running #{current_version}. Please update gitlab-shell."
......
...@@ -34,6 +34,13 @@ module Gitlab ...@@ -34,6 +34,13 @@ module Gitlab
.join('GITLAB_SHELL_VERSION')).strip .join('GITLAB_SHELL_VERSION')).strip
end end
# Return GitLab shell version
#
# @return [String] version
def version
@version ||= File.read(gitlab_shell_version_file).chomp if File.readable?(gitlab_shell_version_file)
end
# Return a SSH url for a given project path # Return a SSH url for a given project path
# #
# @param [String] full_path project path (URL) # @param [String] full_path project path (URL)
...@@ -44,6 +51,14 @@ module Gitlab ...@@ -44,6 +51,14 @@ module Gitlab
private private
def gitlab_shell_path
File.expand_path(Gitlab.config.gitlab_shell.path)
end
def gitlab_shell_version_file
File.join(gitlab_shell_path, 'VERSION')
end
# Create (if necessary) and link the secret token file # Create (if necessary) and link the secret token file
def generate_and_link_secret_token def generate_and_link_secret_token
secret_file = Gitlab.config.gitlab_shell.secret_file secret_file = Gitlab.config.gitlab_shell.secret_file
...@@ -244,17 +259,6 @@ module Gitlab ...@@ -244,17 +259,6 @@ module Gitlab
false false
end end
# Return GitLab shell version
#
# @return [String] version
def version
gitlab_shell_version_file = "#{gitlab_shell_path}/VERSION"
if File.readable?(gitlab_shell_version_file)
File.read(gitlab_shell_version_file).chomp
end
end
# Check if repository exists on disk # Check if repository exists on disk
# #
# @example Check if repository exists # @example Check if repository exists
...@@ -271,10 +275,6 @@ module Gitlab ...@@ -271,10 +275,6 @@ module Gitlab
protected protected
def gitlab_shell_path
File.expand_path(Gitlab.config.gitlab_shell.path)
end
def full_path(storage, dir_name) def full_path(storage, dir_name)
raise ArgumentError.new("Directory name can't be blank") if dir_name.blank? raise ArgumentError.new("Directory name can't be blank") if dir_name.blank?
......
...@@ -50,7 +50,7 @@ module SystemCheck ...@@ -50,7 +50,7 @@ module SystemCheck
end end
def gitlab_shell_version def gitlab_shell_version
Gitlab::Shell.new.version Gitlab::Shell.version
end end
end end
end end
...@@ -82,15 +82,10 @@ namespace :gitlab do ...@@ -82,15 +82,10 @@ namespace :gitlab do
puts "Using Omniauth:\t#{Gitlab::Auth.omniauth_enabled? ? "yes".color(:green) : "no"}" puts "Using Omniauth:\t#{Gitlab::Auth.omniauth_enabled? ? "yes".color(:green) : "no"}"
puts "Omniauth Providers: #{omniauth_providers.join(', ')}" if Gitlab::Auth.omniauth_enabled? puts "Omniauth Providers: #{omniauth_providers.join(', ')}" if Gitlab::Auth.omniauth_enabled?
# check Gitolite version # check Gitlab Shell version
gitlab_shell_version_file = "#{Gitlab.config.gitlab_shell.path}/VERSION"
if File.readable?(gitlab_shell_version_file)
gitlab_shell_version = File.read(gitlab_shell_version_file)
end
puts "" puts ""
puts "GitLab Shell".color(:yellow) puts "GitLab Shell".color(:yellow)
puts "Version:\t#{gitlab_shell_version || "unknown".color(:red)}" puts "Version:\t#{Gitlab::Shell.version || "unknown".color(:red)}"
puts "Repository storage paths:" puts "Repository storage paths:"
Gitlab::GitalyClient::StorageSettings.allow_disk_access do Gitlab::GitalyClient::StorageSettings.allow_disk_access do
Gitlab.config.repositories.storages.each do |name, repository_storage| Gitlab.config.repositories.storages.each do |name, repository_storage|
......
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