blob: 5769a19b37ec679f3dda799e4835a206db28e16b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!ruby -an
BEGIN {
require 'fileutils'
dir = ARGV.shift
ARGF.eof?
FileUtils.mkdir_p(dir)
Dir.chdir(dir)
}
n, v, u = $F
case n
when "test-unit"
else
v = "v" + v
end
if File.directory?(n)
puts "updating #{n} ..."
if v == "master"
system(*%W"git pull", chdir: n) or abort
else
system(*%W"git fetch", chdir: n) or abort
end
else
puts "retrieving #{n} ..."
system(*%W"git clone #{u} #{n}") or abort
end
unless system(*%W"git checkout #{v}", chdir: n)
unless v.sub!(/\Av/, '') and system(*%W"git checkout #{v}", chdir: n)
abort
end
end
|