doc.silverstripe.org/scripts/pull-from-git

61 lines
1.4 KiB
Plaintext
Raw Normal View History

#!/bin/bash
#
# Pulls the documentation from our temp github repo and pulls it
# into the specific folders
#
# Usage ./scripts/pull-from-git
#
if [ `whoami` = "Will" ]; then
repo=git@github.com:willrossi/silverstripe-doc-restructuring.git
else
repo=git://github.com/willrossi/silverstripe-doc-restructuring.git
fi
scrpt=`dirname $0`
temp="docs"
# make sure that we're in the correct dir
cd $scrpt; cd ../
# clone the repo down, or update it if it already exists
if [ ! -d $temp ]; then
echo "Checking out documentation"
mkdir $temp
touch $temp/_manifest_exclude
git clone $repo $temp
else
# git pull must be performed in the folder with the checkout
echo "Updating documentation"
cd $temp
git pull origin master
cd ../
fi
# remove the current docs if they exists.
# move it to a backup location because I know someone will
# make some changes to the docs and lose all their work
echo "Preparing folders"
if [ -d "cms/docs" ]; then
if [ -d "cms/docs_backup" ]; then
rm -rf cms/docs_backup
fi
mv cms/docs cms/docs_backup
fi
if [ -d "sapphire/docs" ]; then
if [ -d "sapphire/docs_backup" ]; then
rm -rf sapphire/docs_backup
fi
mv sapphire/docs sapphire/docs_backup
fi
echo "Moving files into place"
# copy the cms and sapphire docs to their correct locations
cp -R $temp/master/cms/docs cms/
cp -R $temp/master/sapphire/docs sapphire/
echo "Finished. Time for a beer."