-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSyncRepoWithWiki.sh
executable file
·63 lines (52 loc) · 2.3 KB
/
SyncRepoWithWiki.sh
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
#
# SyncRepoWithWiki - synchronize the wikiexamples with the
# vtk.org/Wiki/VTK?examples wiki
#
# Make sure the wiki is up
echo "Synchronizing the wikiexamples repository with the wiki."
HOST=www.github.com
echo "0) Can we access the wiki?"
ping -c 1 $HOST &> /dev/null
if test "${?}" != 0
then
echo "VTKWikiExamples: $HOST is not accessible. Try again later" | mail -s "SyncRepoWithWiki failed" [email protected]
exit 1
fi
echo "1) Pull updates from master repository"
git pull origin master
(cd Tarballs; git checkout .)
(cd Tarballs; git pull origin master)
echo "2) Remove all .cxx, .h, .py, .tcl, .java, .cs, .ui files from local repository"
find . -name mwclient -prune -type f -o "(" -name \*.cxx -o -name \*.h -o -name \*.tcl -o -name \*.java -o -name \*.py -o -name \*.cs -o -name \*.ui -o -name \*.cpp ")" -exec rm -f {} \;
echo "3) Scrape the wiki"
./Admin/ScrapeWiki
echo "3.1) Check for a successful scrape"
count=$((`find . -name \*.cxx | wc -l` + `find . -name \*.py | wc -l`))
expected=1000
if test $count -lt $expected; then
echo VTKWikiExamples/Admin/ScrapeWiki failed
echo VTKWikiExamples: Expected at least $expected cxx and py files but only found $count cxx and py files | mail -s "SyncRepoWithWiki failed" [email protected]
git checkout .
exit 1
fi
echo "4) Update Wiki Templates"
git add Admin/VTKCMakeLists
git add Admin/VTKQtCMakeLists
git commit -m"SYNC: Wiki template files modified on wiki" Admin/VTKCMakeLists Admin/VTKQtCMakeLists
echo "5.1) Change python permissions to execute"
find . -name mwclient -prune -type f -o -name \*.py -exec chmod +x {} \;
echo "5.2) Process modified files"
git commit -m "SYNC: Files modified on wiki." `git status | grep modified: | cut -d":" -f2,2`
echo "6) Process new files"
find . "(" -name \*.cxx -o -name \*.h -o -name \*.tcl -o -name \*.py -o -name \*.java -o -name \*.cs -o -name \*.ui -o -name \*.cpp ")" -exec git add {} \;
git commit -m "SYNC: Files added to wiki."
echo "7) Process deleted files"
git rm `git status | grep deleted: | cut -d":" -f2,2`
git commit -m "SYNC: Files deleted (or moved) from wiki."
echo "8) Update tarballs and push to tarball repo"
(cd Tarballs; git add *tar)
(cd Tarballs; git commit -m "SYNC: Tarballs modified")
(cd Tarballs; git push)
echo "9) Push the changes"
git push