forked from iut-lille/projets-agiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clone
executable file
·42 lines (35 loc) · 865 Bytes
/
clone
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
#!/bin/bash
set -x
WORK_DIR=/tmp/clones/
ORG_DIR=$(pwd)/$(dirname $0)
rm -rf $WORK_DIR
mkdir $WORK_DIR
function clone {
url=$1
title=$2
directory=$3
if [ -z $url ]
then
echo "$title : pas de git"
return
fi
git clone --quiet $url ${directory} 2>/dev/null
if [ $? -gt 0 ]
then
echo "$title : pas les droits"
return
fi
cd $WORK_DIR/$directory && $ORG_DIR/commit-by-sprint
}
cd $WORK_DIR
csplit --quiet $ORG_DIR/2017-2018/N3-FIFC.md '/^# /' '{*}'
for projet in xx*
do
cd $WORK_DIR
url=$(cat $WORK_DIR/$projet | grep 'git :' | sed -e 's/.*git ://g')
title=$(head -n 1 $projet)
echo "$projet ==> $title"
directory=$(echo $title | iconv -f utf8 -t ascii//TRANSLIT | sed -e 's/[^[:alnum:]]/-/g' -e 's/^-*//' -e 's/-*$//' | tr -s '-' | tr A-Z a-z)
clone "$url" "$title" "$directory"
rm $WORK_DIR/$projet
done