2011-04-20 13:09:17 +00:00
|
|
|
#!/usr/bin/env zsh
|
|
|
|
|
|
|
|
rootdir=$HOME/Sites/webroot
|
|
|
|
|
2011-04-20 14:28:44 +00:00
|
|
|
function log {
|
|
|
|
print -P -- $*
|
|
|
|
}
|
2011-04-20 13:38:41 +00:00
|
|
|
function debug {
|
2012-06-15 13:53:26 +00:00
|
|
|
print -- $*
|
2011-04-20 13:38:41 +00:00
|
|
|
eval $*
|
|
|
|
}
|
|
|
|
|
2012-04-10 23:28:19 +00:00
|
|
|
|
2011-04-20 14:02:44 +00:00
|
|
|
current_branch=$(git branch | egrep '^\*' | awk '{print $2}')
|
|
|
|
|
2011-04-20 13:09:17 +00:00
|
|
|
cd $rootdir || { print -- "Unable to go to $HOME/Sites/webroot"; exit 1 }
|
|
|
|
git co master || { exit 1 }
|
|
|
|
git pull || { exit 1 }
|
2012-04-10 23:31:01 +00:00
|
|
|
if [[ $1 = '--unsafe' ]]; then
|
|
|
|
log "UNSAFE no compilation"
|
|
|
|
else
|
|
|
|
# empty regen depencies cache because of a bug
|
|
|
|
\rm -f ./tmp/*(N)
|
|
|
|
./tasks/recompile
|
|
|
|
fi
|
2011-04-20 13:09:17 +00:00
|
|
|
|
|
|
|
if git status | grep 'nothing to commit'>/dev/null 2>&1; then
|
|
|
|
else
|
|
|
|
git add .
|
|
|
|
git commit -m "regeneration"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# update & push gh-pages
|
2011-04-20 14:28:44 +00:00
|
|
|
log "Update and push gh-pages"
|
2011-04-20 13:38:41 +00:00
|
|
|
debug git co gh-pages
|
2011-04-20 13:09:17 +00:00
|
|
|
(( $? == 0 )) || { exit 1 }
|
2011-04-20 14:18:30 +00:00
|
|
|
debug git pull
|
|
|
|
(( $? == 0 )) || { exit 1 }
|
2012-06-15 13:47:04 +00:00
|
|
|
for fic in *(N); do
|
|
|
|
case $fic in
|
|
|
|
output) continue;;
|
|
|
|
esac
|
2012-06-15 13:50:41 +00:00
|
|
|
debug \rm -rf $fic
|
2012-06-15 13:47:04 +00:00
|
|
|
done
|
2011-04-20 13:09:17 +00:00
|
|
|
(( $? == 0 )) || { exit 1 }
|
2011-04-20 13:38:41 +00:00
|
|
|
debug mv output/index.html .
|
2011-04-20 13:09:17 +00:00
|
|
|
(( $? == 0 )) || { exit 1 }
|
2011-04-22 06:37:12 +00:00
|
|
|
debug mv output/* .
|
2011-04-20 13:09:17 +00:00
|
|
|
(( $? == 0 )) || { exit 1 }
|
2011-04-20 13:38:41 +00:00
|
|
|
debug \rm -rf output
|
2011-04-20 13:27:06 +00:00
|
|
|
(( $? == 0 )) || { exit 1 }
|
2011-04-22 06:37:12 +00:00
|
|
|
debug cp Scratch/en/error/404-not_found/index.html 404.html
|
2011-04-20 13:09:17 +00:00
|
|
|
(( $? == 0 )) || { exit 1 }
|
2011-04-20 13:38:41 +00:00
|
|
|
debug echo "yannesposito.com" > CNAME
|
2011-04-20 13:27:06 +00:00
|
|
|
(( $? == 0 )) || { exit 1 }
|
2011-04-20 13:38:41 +00:00
|
|
|
debug git add .
|
2011-04-20 13:27:06 +00:00
|
|
|
(( $? == 0 )) || { exit 1 }
|
2011-04-20 13:38:41 +00:00
|
|
|
debug git commit -m '"updated website"'
|
2011-04-20 13:09:17 +00:00
|
|
|
(( $? == 0 )) || { exit 1 }
|
2011-04-20 13:46:13 +00:00
|
|
|
debug git push origin gh-pages:gh-pages
|
2011-04-20 14:02:44 +00:00
|
|
|
(( $? == 0 )) || { exit 1 }
|
|
|
|
debug git co $current_branch
|