WordPress and Rails

Most of my day is spent coding Rails apps, but most of them these days also have a WordPress component to them. This means I sometimes need to set up a local WordPress site that can communicate with my local Rails apps. I’ve tried various approaches over the years like setting up full blown Nginx locally to serve both my Rails and PHP apps. I’ve also tried tools like MAMP and Local. My new favorite approach though is to simply serve WordPress over Pow, which I already use for all of my local Rails development.

Quick side note on Local

If all you need is a quick way to spin up a WordPress site that doesn’t need to communicate with anything else on your host machine, Local is a fantastic tool. It has a very clean interface and sets up WordPress sites in an isolated way using virtual machines under the hood.

WordPress and Rails

The meat of getting this set up can be found in this great article by Per Søderlind about WordPress and Pow. It is an old article (2012), but it still works great on my brand new iMac with macOS Sierra.

The only change I made was that I used the excellent WP-CLI to download and install WP. Here is briefly how I used that.

Now I can happily continue using WordPress and Rails together using consistent URL formats without bothering to install other external tools. Best of all, its scriptable making it easy to set this back up on machine rebuilds.

Happy Railspressing!

My Bash Prompt

Firstly, rbenv, Here I Come

After being a long time, die hard RVM user, I recently decided to switch over to rbenv due to some ongoing bash weirdness that seemly went away after removing RVM. I also just wanted to try to see what the rbenv world would be like. As a result of doing this, I had to tweak my long-standing bash prompt configuration, since I like to include the current version of Ruby in my prompt.

My Updated Bash Prompt

I found this nifty Gist which gave me a good start on how to capture the current rbenv version in a bash function. So here is my new prompt showing ruby version, git branch and working directory:

My Bash Prompt

… configured by this script (embedded below) …