Skip to content

Commit

Permalink
Factor GITLAB_SHELL_VERSION get method
Browse files Browse the repository at this point in the history
  • Loading branch information
cirosantilli committed Nov 5, 2014
1 parent f9814bf commit f36db59
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
7 changes: 7 additions & 0 deletions lib/gitlab/backend/shell.rb
Expand Up @@ -8,6 +8,13 @@ def add_key(id, key)
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
Expand Down
10 changes: 3 additions & 7 deletions lib/tasks/gitlab/check.rake
Expand Up @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/gitlab/shell.rake
Expand Up @@ -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
Expand Down

0 comments on commit f36db59

Please sign in to comment.