From ea37040cc1e7d53c66cc935096e0e977a0c9377a Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 12 Feb 2014 15:10:29 +0100 Subject: [PATCH] Make the gitlab-shell PATH patch idempotent --- config/software/gitlab-shell.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config/software/gitlab-shell.rb b/config/software/gitlab-shell.rb index b93e097..85b4d74 100644 --- a/config/software/gitlab-shell.rb +++ b/config/software/gitlab-shell.rb @@ -26,7 +26,8 @@ source :git => "https://gitlab.com/gitlab-org/gitlab-shell.git" build do block do - `grep -r -l '#!/usr/bin/env ruby' #{project_dir}`.split("\n").each do |ruby_script| + env_shebang = "#!/usr/bin/env ruby" + `grep -r -l '^#{env_shebang}' #{project_dir}`.split("\n").each do |ruby_script| File.open(ruby_script, "r+") do |file| script = file.read file.rewind @@ -37,7 +38,7 @@ build do ENV['PATH'] = '/opt/gitlab/bin:/opt/gitlab/embedded/bin:' + ENV['PATH'] EOH - file.print script + file.print script.gsub(/^#{env_shebang}\s*/, "") end end end -- libgit2 0.21.2