diff --git a/scripts/website_push_docs.sh b/scripts/website_push_docs.sh index 9bcb167bd..0f7674252 100755 --- a/scripts/website_push_docs.sh +++ b/scripts/website_push_docs.sh @@ -1,17 +1,38 @@ #!/bin/bash +# Set the tmpdir +if [ -z "$TMPDIR" ]; then + TMPDIR="/tmp" +fi + +# Create a temporary build dir and make sure we clean it up. For +# debugging, comment out the trap line. +DEPLOY=`mktemp -d /tmp/vagrant-docs-XXXXXX` +trap "rm -rf $DEPLOY" INT TERM EXIT + # Get the parent directory of where this script is. SOURCE="${BASH_SOURCE[0]}" while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )" +# Copy into tmpdir +cp -R $DIR/website/docs/ $DEPLOY/ + # Change into that directory -cd $DIR +cd $DEPLOY -# Add the git remote if it doesn't exist -git remote | grep heroku-docs || { - git remote add heroku-docs git@heroku.com:vagrantup-docs-2.git -} +# Ignore some stuff +touch .gitignore +echo ".sass-cache" >> .gitignore +echo "build" >> .gitignore -# Push the subtree (force) -git push heroku-docs `git subtree split --prefix website/docs master`:master --force +# Add everything +git init . +git add . +git commit -q -m "Deploy by $USER" + +git remote add heroku git@heroku.com:vagrantup-docs-2.git +git push -f heroku master + +# Cleanup the deploy +rm -rf $DEPLOY diff --git a/scripts/website_push_www.sh b/scripts/website_push_www.sh index cc1e639b7..ad74a7b63 100755 --- a/scripts/website_push_www.sh +++ b/scripts/website_push_www.sh @@ -1,17 +1,38 @@ #!/bin/bash +# Set the tmpdir +if [ -z "$TMPDIR" ]; then + TMPDIR="/tmp" +fi + +# Create a temporary build dir and make sure we clean it up. For +# debugging, comment out the trap line. +DEPLOY=`mktemp -d /tmp/vagrant-www-XXXXXX` +trap "rm -rf $DEPLOY" INT TERM EXIT + # Get the parent directory of where this script is. SOURCE="${BASH_SOURCE[0]}" while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )" +# Copy into tmpdir +cp -R $DIR/website/www/ $DEPLOY/ + # Change into that directory -cd $DIR +cd $DEPLOY -# Add the git remote if it doesn't exist -git remote | grep heroku-www || { - git remote add heroku-www git@heroku.com:vagrantup-www-2.git -} +# Ignore some stuff +touch .gitignore +echo ".sass-cache" >> .gitignore +echo "build" >> .gitignore -# Push the subtree (force) -git push heroku-www `git subtree split --prefix website/www master`:master --force +# Add everything +git init . +git add . +git commit -q -m "Deploy by $USER" + +git remote add heroku git@heroku.com:vagrantup-www-2.git +git push -f heroku master + +# Cleanup the deploy +rm -rf $DEPLOY