2016-09-28 06:45:46 -04:00
|
|
|
namespace :gitlab do
|
|
|
|
namespace :workhorse do
|
|
|
|
desc "GitLab | Install or upgrade gitlab-workhorse"
|
2017-05-02 12:58:37 -04:00
|
|
|
task :install, [:dir, :repo] => :environment do |t, args|
|
2016-09-28 06:45:46 -04:00
|
|
|
warn_user_is_not_gitlab
|
|
|
|
unless args.dir.present?
|
2016-11-29 13:21:25 -05:00
|
|
|
abort %(Please specify the directory where you want to install gitlab-workhorse:\n rake "gitlab:workhorse:install[/home/git/gitlab-workhorse]")
|
2016-09-28 06:45:46 -04:00
|
|
|
end
|
2017-05-02 12:58:37 -04:00
|
|
|
args.with_defaults(repo: 'https://gitlab.com/gitlab-org/gitlab-workhorse.git')
|
2016-09-28 06:45:46 -04:00
|
|
|
|
2017-04-10 19:15:48 -04:00
|
|
|
version = Gitlab::Workhorse.version
|
2016-09-28 06:45:46 -04:00
|
|
|
|
2017-05-02 12:58:37 -04:00
|
|
|
checkout_or_clone_version(version: version, repo: args.repo, target_dir: args.dir)
|
2016-09-28 06:45:46 -04:00
|
|
|
|
|
|
|
_, status = Gitlab::Popen.popen(%w[which gmake])
|
|
|
|
command = status.zero? ? 'gmake' : 'make'
|
|
|
|
|
|
|
|
Dir.chdir(args.dir) do
|
2016-11-24 08:19:09 -05:00
|
|
|
run_command!([command])
|
2016-09-28 06:45:46 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|