Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## post-receive hook
- /home/git/ruby/duplikate.rb mephisto "rel-0.8"
- ## duplicate.rb script
- # get duplicate lib from git@github.com:technoweenie/duplikate.git
- # and place in the duplicate dir in the same dir as this duplicate.rb script
- #! /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 # temporarily set this nil, post-receive hooks set this to the repo running the hook
- [%[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 => 'sekrit'
- ENV['GIT_DIR'] = old_git_dir
- end
- end
Add Comment
Please, Sign In to add comment