2017-10-25 19:35:46 -04:00
|
|
|
#!ruby -an
|
|
|
|
BEGIN {
|
|
|
|
require 'fileutils'
|
2017-10-21 05:50:36 -04:00
|
|
|
|
2017-10-25 19:35:46 -04:00
|
|
|
dir = ARGV.shift
|
|
|
|
ARGF.eof?
|
|
|
|
FileUtils.mkdir_p(dir)
|
|
|
|
Dir.chdir(dir)
|
|
|
|
}
|
2017-10-21 05:50:36 -04:00
|
|
|
|
2017-10-25 19:35:46 -04:00
|
|
|
n, v, u = $F
|
|
|
|
case n
|
|
|
|
when "test-unit"
|
|
|
|
else
|
2017-10-21 05:50:36 -04:00
|
|
|
v = "v" + v
|
2017-10-25 19:35:46 -04:00
|
|
|
end
|
2017-10-21 05:50:36 -04:00
|
|
|
|
2017-10-25 19:35:46 -04:00
|
|
|
if File.directory?(n)
|
|
|
|
puts "updating #{n} ..."
|
2019-09-03 23:36:45 -04:00
|
|
|
if v == "master"
|
|
|
|
system(*%W"git pull", chdir: n) or abort
|
|
|
|
else
|
|
|
|
system(*%W"git fetch", chdir: n) or abort
|
|
|
|
end
|
2017-10-25 19:35:46 -04:00
|
|
|
else
|
|
|
|
puts "retrieving #{n} ..."
|
|
|
|
system(*%W"git clone #{u} #{n}") or abort
|
2017-10-21 05:50:36 -04:00
|
|
|
end
|
2017-10-25 19:35:46 -04:00
|
|
|
system(*%W"git checkout #{v}", chdir: n) or abort
|