Skip to content

Commit

Permalink
Merge pull request #15 from hello-jason/release/2.0.0
Browse files Browse the repository at this point in the history
Release/2.0.0
  • Loading branch information
hello-jason committed Oct 15, 2016
2 parents 4a9201e + 6c32dfa commit 9f53804
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 72 deletions.
26 changes: 12 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
# Deploy Bedrock+Sage WordPress project to WP Engine hosting platform
# Deploy Roots Bedrock WordPress project to WP Engine hosting platform

Last tested: October 8, 2016
Works up to Bedrock 1.7.2

Works up to Bedrock 1.7.2, Sage 8.5
Repo: [https://github.com/hello-jason/bedrock-deploy-to-wpengine](https://github.com/hello-jason/bedrock-deploy-to-wpengine)

Repo: [https://github.com/hello-jason/bedrock-sage-deploy-to-wpengine](https://github.com/hello-jason/bedrock-sage-deploy-to-wpengine)
## Changelog

v2 - Removes build process for Sage theme. Now focuses purely on deploying your Bedrock project, regardless of theme.
v1 - Works up to Bedrock 1.7.2, Sage 8.5

## Description

This bash script prepares a WordPress project built on Root's [Bedrock](https://roots.io/bedrock/) boilerplate with the [Sage](https://roots.io/sage/) starter theme and deploys it **to the WP Engine hosting platform**. It can be easily modified if you do not use the Sage theme.
This bash script prepares a WordPress project built on Root's [Bedrock](https://roots.io/bedrock/) boilerplate and deploys it **to the WP Engine hosting platform**.

WP Engine expects to see a standard WordPress project in the document root for your account. Since Bedrock shifts folders and files around a bit, this script temporarily moves everything back to their original locations (on a safe, temporary branch), which is then pushed to WP Engine.

The result is a properly-versioned Bedrock repo that you can safely and repeatedly deploy to WP Engine's production and staging environments.

Demo:

* Demo Bedrock+Sage site on WP Engine: [http://bedrocksage.wpengine.com/](http://bedrocksage.wpengine.com/)
* Demo Bedrock+Sage site repo: [https://github.com/hello-jason/bedrock-sage-on-wpengine-demo](https://github.com/hello-jason/bedrock-sage-on-wpengine-demo)
* Demo Bedrock site on WP Engine: [http://rootsbedrock.wpengine.com/](http://rootsbedrock.wpengine.com/)
* Demo Bedrock site repo: [https://github.com/hello-jason/bedrock-on-wpengine-demo](https://github.com/hello-jason/bedrock-on-wpengine-demo)

## Installation & Setup

### 1. Grab the script

Source code is available at [https://github.com/hello-jason/bedrock-sage-deploy-to-wpengine](https://github.com/hello-jason/bedrock-sage-deploy-to-wpengine). This repo is not meant to be cloned into your project. Rather, just grab the `wpedeploy.sh` file and place it in the top-level directory of your Bedrock project, and keep it with your project's repo.
Source code is available at [https://github.com/hello-jason/bedrock-deploy-to-wpengine](https://github.com/hello-jason/bedrock-deploy-to-wpengine). This repo is not meant to be cloned into your project. Rather, just grab the `wpedeploy.sh` file and place it in the top-level directory of your Bedrock project, and keep it with your project's repo.

### 2. Setup git push

Expand All @@ -34,12 +37,6 @@ This readme assumes your remotes are named as follows:
* **Production**: wpeproduction
* **Staging**: wpestaging

### 3. Set theme variable

Out the box, this script assumes your theme's name is **sage**. Open `wpdeploy.sh` and change the following variable (around line 17).

* Set `themeName` to the **directory name** of your theme (/app/themes/**yourthemename**)

## Usage

Run at the **top level** of your project, in the same directory as your `.env` and `composer.json` files. Replace each remote name with the ones you created during step 1.
Expand All @@ -63,3 +60,4 @@ bash wpedeploy.sh wpeproduction
* **How does it handle plugin versions?** - You can upgrade or downgrade version numbers in the `composer.json` file, run `composer update`, then run this script to deploy the new version to WP Engine. However, this script **will not delete** plugins from WP Engine's servers; you will have to do that via SFTP or wp-admin.
* **What about WordPress core?** - This script only deploys the contents of `wp-content` to WP Engine's servers. You should keep WordPress core updated in your composer file, but that only benefits your local dev environment. You will manage WP core for your publicly-facing site in WP Engine's interface directly.
* **Why doesn't it work on Ubuntu?** - It does! But Ubuntu defaults to `dash` rather than `bash`, and the script may fail if you simply run `sh`. Other distros may do the same, so running this script with the `bash` command is important.
* **Why did you remove the build processes for Sage?** - Since each project will have a different build process for its theme, it makes more sense to focus solely on deploying to WP Engine. More info in [this issue](https://github.com/hello-jason/bedrock-sage-deploy-to-wpengine/issues/13).
64 changes: 6 additions & 58 deletions wpedeploy.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
#!/bin/bash
# Version: 0.3.1
# Last Update: February 21, 2016
# Version: 2.0.0
# Last Update: October 15, 2016
#
# Description: Bash script to deploy a Bedrock+Sage WordPress project to WP Engine's hosting platform
# Repository: https://github.com/hello-jason/bedrock-sage-deploy-to-wpengine.git
# README: https://github.com/hello-jason/bedrock-sage-deploy-to-wpengine/blob/master/README.md
# Description: Bash script to deploy a Bedrock WordPress project to WP Engine's hosting platform
# Repository: https://github.com/hello-jason/bedrock-deploy-to-wpengine.git
# README: https://github.com/hello-jason/bedrock-deploy-to-wpengine/blob/master/README.md
#
# Tested Bedrock Version: 1.5.3
# Tested Sage Version: 8.4.2
# Tested Bedrock Version: 1.7.2
# Tested bash version: 4.3.42
# Author: Jason Cross
# Author URL: http://hellojason.net/
########################################
# PLEASE EDIT
# Your theme directory name (/web/app/themes/yourtheme)
themeName="sage"
########################################

####################
# Usage
####################
# bash wpedeploy.sh nameOfRemote
Expand Down Expand Up @@ -65,16 +58,6 @@ if [ "$?" -ne 0 ]; then
exit 1
fi

# Directory checks
####################
# Halt if theme directory does not exist
if [ ! -d "$presentWorkingDirectory"/web/app/themes/"$themeName" ]; then
echo -e "[\033[31mERROR\e[0m] Theme \"$themeName\" not found.\n Set \033[32mthemeName\e[0m variable in $0 to match your theme in $bedrockThemesDirectory"
echo "Available themes:"
ls $bedrockThemesDirectory
exit 1
fi

####################
# Begin deploy process
####################
Expand All @@ -92,41 +75,6 @@ echo -e "/*\n!wp-content/" > ./.gitignore
# Copy meaningful contents of web/app into wp-content
mkdir wp-content && cp -rp web/app/plugins wp-content && cp -rp web/app/themes wp-content

# Go into theme directory
cd "$presentWorkingDirectory/wp-content/themes/$themeName" &> /dev/null

# Build theme assets
npm install && bower install && gulp --production

# Back to the top
cd "$presentWorkingDirectory"

# Cleanup wp-content
####################
# Remove sage theme cruft
# Files
rm "$presentWorkingDirectory"/wp-content/themes/"$themeName"/.bowerrc &> /dev/null
rm "$presentWorkingDirectory"/wp-content/themes/"$themeName"/.editorconfig &> /dev/null
rm "$presentWorkingDirectory"/wp-content/themes/"$themeName"/.gitignore &> /dev/null
rm "$presentWorkingDirectory"/wp-content/themes/"$themeName"/.jscsrc &> /dev/null
rm "$presentWorkingDirectory"/wp-content/themes/"$themeName"/.jshintrc &> /dev/null
rm "$presentWorkingDirectory"/wp-content/themes/"$themeName"/.travis.yml &> /dev/null
rm "$presentWorkingDirectory"/wp-content/themes/"$themeName"/bower.json &> /dev/null
rm "$presentWorkingDirectory"/wp-content/themes/"$themeName"/gulpfile.js &> /dev/null
rm "$presentWorkingDirectory"/wp-content/themes/"$themeName"/package.json &> /dev/null
rm "$presentWorkingDirectory"/wp-content/themes/"$themeName"/composer.json &> /dev/null
rm "$presentWorkingDirectory"/wp-content/themes/"$themeName"/composer.lock &> /dev/null
rm "$presentWorkingDirectory"/wp-content/themes/"$themeName"/ruleset.xml &> /dev/null
rm "$presentWorkingDirectory"/wp-content/themes/"$themeName"/CHANGELOG.md &> /dev/null
rm "$presentWorkingDirectory"/wp-content/themes/"$themeName"/CONTRIBUTING.md &> /dev/null
rm "$presentWorkingDirectory"/wp-content/themes/"$themeName"/LICENSE.md &> /dev/null
rm "$presentWorkingDirectory"/wp-content/themes/"$themeName"/README.md &> /dev/null
# Directories
rm -rf "$presentWorkingDirectory"/wp-content/themes/"$themeName"/node_modules &> /dev/null
rm -rf "$presentWorkingDirectory"/wp-content/themes/"$themeName"/bower_components &> /dev/null
rm -rf "$presentWorkingDirectory"/wp-content/themes/"$themeName"/assets &> /dev/null
rm -rf "$presentWorkingDirectory"/wp-content/themes/"$themeName"/vendor &> /dev/null

####################
# Push to WP Engine
####################
Expand Down

0 comments on commit 9f53804

Please sign in to comment.