Wrap text
Report abuse
my repo's post-receive hook
|
|
/home/git/ruby/duplikate.rb mephisto "rel-0.8"
|
duplicate.rb
|
|
#! /usr/bin/ruby
require 'rubygems'
require 'lockfile'
require File.join(File.dirname(__FILE__), 'duplikate/lib/duplikate')
repo = ARGV.shift
branch = ARGV.shift || :master
path = "/home/git/sync/#{repo}/"
Dir.chdir "/home/git/sync/#{repo}/git" do
Lockfile.new '/home/git/sync/#{repo}.#{branch}.lock' do
puts "Updating #{path + 'git/.git'} while in #{Dir.pwd}..."
old_git_dir = ENV['GIT_DIR']
ENV['GIT_DIR'] = nil
[%[git checkout #{branch}], %[git pull]].each do |cmd |
puts ">> " + cmd
puts %x[#{cmd}]
end
puts "syncing #{path + 'git'} to #{path + 'svn'}..."
Duplikate.execute "Updating from git...", path + "git", path + "svn", :username => 'technoweenie', :password => 'ieatsourwheaties'
ENV['GIT_DIR'] = old_git_dir
end
end
|