Skip to content

Instantly share code, notes, and snippets.

@saltednut
Last active December 17, 2015 22:09
Show Gist options
  • Save saltednut/5680040 to your computer and use it in GitHub Desktop.
Save saltednut/5680040 to your computer and use it in GitHub Desktop.
quick build for Drupal distro using Vagrant and drupal_cookbook
#!/usr/bin/env bash
# Usage: vice makefile destination distro project vagrant-command
vagrant_install_clean_env() {
MAKEFILE=$1
TARGET=$2
DISTRO=$3
PROJECT=$4
VAGRANT=$5
if [[ ! -r ~/.vice ]]; then
mkdir ~/.vice
fi
if [[ -r $TARGET ]]; then
if [[ $VAGRANT == 'reload' ]]; then
mv $TARGET/.vagrant ~/.vice/.vagrant
fi
sudo rm -r $TARGET
cd ~/
fi
if [[ -r $MAKEFILE ]]; then
drush make --working-copy --concurrency=5 $MAKEFILE $TARGET
if [[ $VAGRANT == 'reload' ]]; then
mv ~/.vice/.vagrant $TARGET/.vagrant
fi
export DRUPAL_DISTRO=$DISTRO
export DRUPAL_PROJECT=$PROJECT
if [[ -r $TARGET/profiles/$DISTRO/Berksfile* ]]; then
cp $TARGET/profiles/$DISTRO/Berksfile* $TARGET/.
else
wget -O $TARGET/Berksfile https://gist.github.com/brantwynn/5680070/raw/Berksfile
fi
if [[ -r $TARGET/profiles/$DISTRO/Vagrant* ]]; then
cp $TARGET/profiles/$DISTRO/Vagrant* $TARGET/.
else
wget -O $TARGET/Vagrantfile https://gist.github.com/brantwynn/5680085/raw/Vagrantfile
fi
cd $TARGET
vagrant $VAGRANT
fi
}
alias vice=vagrant_install_clean_env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment