blob: ca7e003fe16a50eb6dda8f9a0299dd0e2234c314 (
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
34
35
36
37
38
39
40
41
42
|
#!/usr/bin/env bash
# To add new directories, after running this tool, manually delete the
# .git directory in the vended directory before running "git add". Then
# you can run this tool again to reclone it.
set -eu
set -x
set -o errexit
rm -rf vendor
SCRIPT_DIR="$(cd "$(dirname ${BASH_SOURCE[0]})" && pwd)"
cd $SCRIPT_DIR
set_dependencies() {
local pids=()
while read line; do
local line=`echo $line | sed 's/#.*//;/^\s*$/d' || echo ""`
[ ! "$line" ] && continue
line=($line)
local dest=${line[0]}
local version=${line[1]}
if [[ -n ${line[2]:-} ]]; then
package=${line[2]}
else
package=$dest
fi
local giturl="https://$package"
local install_path="vendor/$dest"
mkdir -p "$install_path"
git clone $giturl "$install_path"
( cd $install_path && git checkout "$version" && rm -rf '.git' )
done < $1
echo ">> All Done"
}
set_dependencies "Godeps"
|