Skip to content

Instantly share code, notes, and snippets.

@newloong
Forked from jasperf/Trellis setup
Created January 27, 2018 10:04
Show Gist options
  • Save newloong/0731dedb7ce7a2a0341ad3bad50c5f37 to your computer and use it in GitHub Desktop.
Save newloong/0731dedb7ce7a2a0341ad3bad50c5f37 to your computer and use it in GitHub Desktop.
Bash script to setup Bedrock, Trellis and Sage #Roots
#!/bin/bash
# set this variable - it will be used as both the root folder name and the theme name for sage
# no spaces - should not be a URL - I'm using 'my-site' or similar
SITENAME="your-site-name"
# Add BitBucket username/password to have a remote repo setup
BBUSER="YOUR-BB-USERNAME"
BBPASS="YOUR-BB-PASSWORD"
# save current pwd
cwd=$(pwd)/$SITENAME
# clone bedrock, trellis and sage
mkdir $SITENAME && cd $SITENAME
git clone --depth=1 git@github.com:roots/bedrock-ansible.git ansible && rm -rf ansible/.git
git clone --depth=1 git@github.com:roots/bedrock.git site && rm -rf site/.git
git clone --depth=1 git@github.com:roots/sage.git site/web/app/themes/$SITENAME && rm -rf site/web/app/themes/$SITENAME/.git
mv ansible/Vagrantfile .
# update ansible path
x="__dir__"
y="'ansible'"
sed -i -e "s/$x/$y/g" ./Vagrantfile
rm ./Vagrantfile-e
# add default theme
echo "define('WP_DEFAULT_THEME', '$SITENAME');" >> $cwd/site/config/application.php
# configure theme
cd $cwd/site/web/app/themes/$SITENAME
npm install
bower install
gulp
# add soil
cd $cwd/site && composer require roots/soil
# ansible roles
cd $cwd/ansible && ansible-galaxy install -r requirements.yml
# display some output
echo "New Trellis site '$SITENAME' installed in $cwd."
# setup new repo at BitBucket
curl --user $BBUSER:$BBPASS https://api.bitbucket.org/1.0/repositories/ --data name=$SITENAME
cd $cwd
git init
git remote add origin git@bitbucket.org:$BBUSER/$SITENAME.git
# display some output
echo "New Trellis site \033[0;31m$SITENAME\033[0m installed in \033[0;31m$cwd\033[0m."
# open atom
cd $cwd
mate .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment