Commit 5f864cf3fa78f27d68b55b9b5f82bf7e7e8d36dd
1 parent
6dec05ff
Exists in
master
and in
17 other branches
Create gitlab-shell wrappers using ERB
Showing
2 changed files
with
9 additions
and
12 deletions
Show diff stats
config/software/gitlab-shell.rb
| ... | ... | @@ -28,18 +28,10 @@ build do |
| 28 | 28 | block do |
| 29 | 29 | env_shebang = "#!/usr/bin/env ruby" |
| 30 | 30 | `grep -r -l '^#{env_shebang}' #{project_dir}`.split("\n").each do |ruby_script| |
| 31 | - File.open(ruby_script, "r+") do |file| | |
| 32 | - script = file.read | |
| 33 | - file.rewind | |
| 34 | - file.truncate(0) | |
| 35 | - file.print <<-EOH | |
| 36 | -#!/opt/gitlab/embedded/bin/ruby | |
| 37 | -# Fix the PATH so that gitlab-shell can find git-upload-pack and friends. | |
| 38 | -ENV['PATH'] = '/opt/gitlab/bin:/opt/gitlab/embedded/bin:' + ENV['PATH'] | |
| 39 | - | |
| 40 | - EOH | |
| 41 | - file.print script.gsub(/^#{env_shebang}\s*/, "") | |
| 42 | - end | |
| 31 | + script = File.read(ruby_script) | |
| 32 | + erb :dest => ruby_script, | |
| 33 | + :source => "ruby_script_wrapper.erb", | |
| 34 | + :mode => 0755 | |
| 43 | 35 | end |
| 44 | 36 | end |
| 45 | 37 | command "mkdir -p #{install_dir}/embedded/service/gitlab-shell" | ... | ... |