Skip to content

Commit

Permalink
first draft of doc viewer script
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreedm committed Dec 17, 2013
1 parent 3b2be13 commit 5beb7b3
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions bin/install-docviewer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

die() {
echo $1
exit 1
}

log() {
echo -e "\033[1;34m===== $1 \033[1;37m$2 \033[1;34m=====\033[0m"
}

INDEX=
while getopts ":i:" opt; do
case $opt in
i)
INDEX="$OPTARG"
;;
:)
die "Option -$OPTARG requires an argument"
;;
esac
done

if [ -z $INDEX ]; then
die "Need index.html to copy, use -i flag to specify"
fi

shift $(($OPTIND - 1))

for repo in $@; do
name=${repo##*[/\\]};
log "Installing Doc Viewer to" "$name"
if [ -e $repo/index.html ] && [ -e $repo/smoke.html ]; then
continue;
fi
if [ -e $repo/index.html ]; then
echo "moving old index.html to smoke test"
mv $repo/index.html $repo/smoke.html
fi
echo "Copying doc index.html"
cp $INDEX $repo/index.html
done

0 comments on commit 5beb7b3

Please sign in to comment.