-
-
Save teknikqa/9112a74098952fd8939c to your computer and use it in GitHub Desktop.
A function, when added to bash profile, clones the Vagrant Drupal-Dev-VM (https://github.com/geerlingguy/drupal-dev-vm), augments configuration (based on d7 or d8), renames the VM to something other than drupaltest.dev and starts vagrant up. Uses include <newd 7 my-drupal-site> and <newd 8 my-other-drupal-site>.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# new drupal vagrant install | |
# A function, when added to bash profile, clones the Vagrant Drupal-Dev-VM (https://github.com/geerlingguy/drupal-dev-vm), | |
# augments config (based on d7 or d8), renames the VM to something other than drupaltest.dev and starts vagrant up. Uses | |
# include <newd 7 my-drupal-site> and <newd 8 my-other-drupal-site>. | |
function newd { | |
if [ $2 == ]; then | |
echo 'USAGE: newd8 <version> <sitename>' | |
elif [[ -d ~/vagrant/$2 ]]; then | |
echo "Nope that folder $2 already exists. Choose another or delete it" | |
else | |
echo 'Cloing repo' | |
cd ~/vagrant | |
git clone https://github.com/geerlingguy/drupal-dev-vm.git $2 | |
cd - | |
cd ~/vagrant/$2 | |
echo 'Renaming example files' | |
mv example.drupal.make.yml drupal.make.yml | |
mv example.config.yml config.yml | |
echo 'Ansible about to nstall requirements' | |
sudo ansible-galaxy install -r requirements.txt | |
cd - | |
# Change to D7 | |
if [[ $1 == 7 ]]; then | |
echo 'Changing config files for Drupal 7 install' | |
cd ~/vagrant/$2 | |
sed -i 's/core\: 8.x/core\: 7.x/' drupal.make.yml | |
sed -i 's/version\: 8.0.x/version: 7.x/' drupal.make.yml | |
sed -i 's/drupal_major_version\: 8/drupal_major_version\: 7/' config.yml | |
cd - | |
fi | |
# Change drupal.dev to <project>.dev ($2) | |
cd ~/vagrant/$2 | |
sed -i s/drupalvm.dev/$2.dev/ config.yml | |
sed -i s/drupalvm.dev/$2.dev/ README.md | |
sed -i s/\/Sites\/drupal/vagrant\/$2/www | |
cd - | |
# vagrant up | |
mkdir -p ~/Sites/drupal | |
cd ~/vagrant/$2 | |
vagrant up | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment