socialforge/lib/tasks/git_post_update.rake

28 lines
652 B
Ruby
Raw Normal View History

namespace :git_post_update do
HOOK_TEMPLATE = %Q{#!/bin/sh
exec git update-server-info
CMD_PATH=`dirname $0`
cd $CMD_PATH
PY_PATH=$PWD/../../../git_refresh_changes.py
[[ -s "$PY_PATH" ]] && $(which python) $PY_PATH $(dirname $PWD)
cd -
}
desc "update old post-update file, REP_PATH"
task :update_old_file do
raise "please set REP_PATH" unless ENV["REP_PATH"]
Dir.chdir(ENV["REP_PATH"]) do
Dir.glob("**/post-update").each do |filename|
File.open(filename, "w+") do |f|
f.write(HOOK_TEMPLATE)
puts " file #{filename} changed"
end
end
end
end
end