summaryrefslogtreecommitdiff
path: root/lib/tasks
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-08-03 11:22:40 -0700
committerStan Hu <stanhu@gmail.com>2016-08-03 11:39:19 -0700
commit8a62f4e7d46908c56bedf155792323dc4218be94 (patch)
tree95ce62453b12470a6beff8840dcea50edf8502dd /lib/tasks
parent6c519b7a7420901a5ec608e9a73786d32bd23407 (diff)
downloadgitlab-ce-8a62f4e7d46908c56bedf155792323dc4218be94.tar.gz
Update the gitlab-shell version in the tmp/tests directory to the right versionupdate-gitlab-shell-in-tests
Previously the gitlab-shell version would never be updated if the directory existed via the `gitlab:shell:install` Rake task. This could lead to incompatibility issues or random errors.
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/gitlab/shell.rake10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/tasks/gitlab/shell.rake b/lib/tasks/gitlab/shell.rake
index c85ebdf8619..ba93945bd03 100644
--- a/lib/tasks/gitlab/shell.rake
+++ b/lib/tasks/gitlab/shell.rake
@@ -5,7 +5,8 @@ namespace :gitlab do
warn_user_is_not_gitlab
default_version = Gitlab::Shell.version_required
- args.with_defaults(tag: 'v' + default_version, repo: "https://gitlab.com/gitlab-org/gitlab-shell.git")
+ default_version_tag = 'v' + default_version
+ args.with_defaults(tag: default_version_tag, repo: "https://gitlab.com/gitlab-org/gitlab-shell.git")
user = Gitlab.config.gitlab.user
home_dir = Rails.env.test? ? Rails.root.join('tmp/tests') : Gitlab.config.gitlab.user_home
@@ -15,7 +16,12 @@ namespace :gitlab do
target_dir = Gitlab.config.gitlab_shell.path
# Clone if needed
- unless File.directory?(target_dir)
+ if File.directory?(target_dir)
+ Dir.chdir(target_dir) do
+ system(*%W(Gitlab.config.git.bin_path} fetch --tags --quiet))
+ system(*%W(Gitlab.config.git.bin_path} checkout --quiet #{default_version_tag}))
+ end
+ else
system(*%W(#{Gitlab.config.git.bin_path} clone -- #{args.repo} #{target_dir}))
end