Skip to content

Instantly share code, notes, and snippets.

@niladam
Forked from tobyl/Trellis setup
Created May 10, 2016 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niladam/bec5bd7f684d40b350f28e40e930732b to your computer and use it in GitHub Desktop.
Save niladam/bec5bd7f684d40b350f28e40e930732b to your computer and use it in GitHub Desktop.
Bash script to setup Bedrock, Trellis and Sage
#!/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
atom .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment