Guest User

Untitled

a guest
May 16th, 2018
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. ## post-receive hook
  2.  
  3. /home/git/ruby/duplikate.rb mephisto "rel-0.8"
  4.  
  5. ## duplicate.rb script
  6.  
  7. # get duplicate lib from git@github.com:technoweenie/duplikate.git
  8. # and place in the duplicate dir in the same dir as this duplicate.rb script
  9.  
  10. #! /usr/bin/ruby
  11. require 'rubygems'
  12. require 'lockfile'
  13. require File.join(File.dirname(__FILE__), 'duplikate/lib/duplikate')
  14.  
  15. repo = ARGV.shift
  16. branch = ARGV.shift || :master
  17. path = "/home/git/sync/#{repo}/"
  18.  
  19. Dir.chdir "/home/git/sync/#{repo}/git" do
  20. Lockfile.new '/home/git/sync/#{repo}.#{branch}.lock' do
  21. puts "Updating #{path + 'git/.git'} while in #{Dir.pwd}..."
  22. old_git_dir = ENV['GIT_DIR']
  23. ENV['GIT_DIR'] = nil # temporarily set this nil, post-receive hooks set this to the repo running the hook
  24. [%[git checkout #{branch}], %[git pull]].each do |cmd |
  25. puts ">> " + cmd
  26. puts %x[#{cmd}]
  27. end
  28.  
  29. puts "syncing #{path + 'git'} to #{path + 'svn'}..."
  30. Duplikate.execute "Updating from git...", path + "git", path + "svn", :username => 'technoweenie', :password => 'sekrit'
  31. ENV['GIT_DIR'] = old_git_dir
  32. end
  33. end
Add Comment
Please, Sign In to add comment