blob: c5fdbc99fc6f26634fb7003abe9f096410cced15 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#!/usr/bin/env ruby
require 'tempfile'
require_relative 'run'
REMOTE = 'https://gitlab.com/gitlab-org/gitlab-shell.git'
REMOVE_PATHS = %w[go support spec/action .git spec/gitlab_shell_gitlab_shell_spec.rb].freeze
def main
Dir.mktmpdir do |dir|
run!(%W[git clone --depth=1 --quiet #{REMOTE} gitlab-shell], dir)
tmp_shell_dir = File.join(dir, 'gitlab-shell')
run!(%w[mv README.md README.orig.md], tmp_shell_dir)
revision = capture!(%w[git rev-parse HEAD], tmp_shell_dir).chomp
remote_project = REMOTE.sub(/\.git$/, '')
readme = <<-EOS
# gitlab-shell
Vendored from #{remote_project} at [#{revision}](#{remote_project}/commit/#{revision}).
Original README: [README.orig.md](README.orig.md).
EOS
File.write(File.join(tmp_shell_dir, 'README.md'), readme)
run!(%w[rm -rf --] + REMOVE_PATHS, tmp_shell_dir)
gitlab_init = File.join(tmp_shell_dir, 'lib/gitlab_init.rb')
gitlab_init_contents = File.read(gitlab_init)
File.write(gitlab_init, gitlab_init_contents.sub(/^GITALY_EMBEDDED =.*/, 'GITALY_EMBEDDED = true'))
shell_vendor_dir = 'ruby/vendor/gitlab-shell'
run!(%W[mkdir -p #{shell_vendor_dir}])
run!(%W[rsync -av --delete #{tmp_shell_dir}/ #{shell_vendor_dir}/])
end
end
main
|