forked from InsightSoftwareConsortium/ITKWikiExamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSyncRepoWithWiki.sh
More file actions
executable file
·67 lines (54 loc) · 2.17 KB
/
SyncRepoWithWiki.sh
File metadata and controls
executable file
·67 lines (54 loc) · 2.17 KB
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
64
65
66
#!/bin/bash
#
# SyncRepoWithWiki - synchronize the wikiexamples with the
# itk.org/Wiki/ITK?examples wiki
#
# Make sure the wiki is up
echo "Synchronizing the wikiexamples repository with the wiki."
HOST=github.com
echo "0) Can we access the wiki?"
ping -c 1 $HOST &> /dev/null
if test "${?}" = 1
then
echo "$HOST is not accessible. Try again later"
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 "1.1) Protect vtkTestingObjectFactory.hxx"
mv CMake/vtkTestingObjectFactory.hxx CMake/vtkTestingObjectFactory.hxx.save
echo "2) Remove all .cxx, .h, .hxx, .txx, .py, .tcl, files from local repository"
find . -name mwclient -prune -type f -o "(" -name \*.cxx -o -name \*.h -o -name \*.hxx -o -name \*.txx -o -name \*.tcl -o -name \*.java -o -name \*.py ")" -exec rm -f {} \;
echo "3) Scrape the wiki"
./Admin/ScrapeWiki
echo "3.1) Restore vtkTestingObjectFactory.hxx"
mv CMake/vtkTestingObjectFactory.hxx.save CMake/vtkTestingObjectFactory.hxx
echo "3.2) Check for a successful scrape"
count=`find . -name \*.cxx | wc -l`
expected=365
if test $count -lt $expected; then
echo Admin/ScrapeWiki failed
echo Expected at least $expected cxx files but only found $count cxx files
git checkout .
exit 1
fi
echo "4) Update Wiki Templates"
git add Admin/ITKVTKCMakeLists
git add Admin/ITKCMakeLists
git commit -m"SYNC: Wiki template files modified on wiki" Admin/ITKVTKCMakeLists Admin/ITKCMakeLists
echo "5) 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 \*.hxx -o -name \*.txx -o -name \*.tcl -o -name \*.py -o -name \*.java ")" -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