forked from scikit-image/scikit-image
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpush_github
executable file
·65 lines (54 loc) · 1.64 KB
/
push_github
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
# Make sure we start in the correct directory
if ! [[ -d ../.git ]]; then
echo "Call this script from the docs dir."
exit
fi
installed_ver=`python -c "import scikits.image; print scikits.image.__version__"`
if [ $installed_ver = "unbuilt-dev" ]; then
echo "Please build the scikit before generating the docs."
exit 1
fi
# Get current branch
ref=$(git symbolic-ref HEAD 2> /dev/null)
branch=${ref#refs/heads/}
wd=`pwd`
make clean
make html
rm -rf /tmp/scikits.image.docs
cp -r build/html /tmp/scikits.image.docs
cd ..
# This file changes upon build, so we have to back it up,
# otherwise git won't switch branches
ignore_files="scikits/image/version.py
scikits/image/opencv/opencv_cv.so
scikits/image/opencv/opencv_backend.so
scikits/image/graph/spath.so"
mkdir -p /tmp/_scikits_image_backup
for f in $ignore_files; do
cp $f /tmp/_scikits_image_backup
done
git checkout scikits/image/version.py
git checkout gh-pages || exit
rm -rf ./*
cp -r /tmp/scikits.image.docs/* .
# github doesn't like directories starting with "_"
sed -i 's/_static/static/g' `find . -name "*.html"`
sed -i 's/_images/images/g' `find . -name "*.html"`
mv _static static
mv _images images
for f in `find . | grep "./" | grep -v "\.git"`; do
git add $f
done
echo "--------------------------------------"
git status
echo "--------------------------------------"
echo "***"
echo "*** These changes are about to be committed. Press Ctrl-C to abort."
echo "*** Press enter to continue."
read
git commit -m "Update docs."
git push origin gh-pages
git checkout $branch
for f in $ignore_files; do
cp /tmp/_scikits_image_backup/`basename $f` $f
done