Skip to content

Introducing Ruby gems: Capistrano-WP and Steps

Today we’re happy to announce we are the proud maintainers of two brand new gems on RubyGems: Capistrano-WP: A Ruby gem containing recipes for deploying, rolling back, and maintaining remote WordPress installations with Capistrano. In other words, these are the set of tasks that we use for local development environment configuration and remote Capistrano deployments…

Published on by Devin Reams

Today we're happy to announce we are the proud maintainers of two brand new gems on RubyGems:

Capistrano-WP: A Ruby gem containing recipes for deploying, rolling back, and maintaining remote WordPress installations with Capistrano. In other words, these are the set of tasks that we use for local development environment configuration and remote Capistrano deployments specific for our WordPress projects.

Steps: A Ruby gem that produces simple user feedback in scripting environments. It's a collection of utilities broken out of our larger in-house capistrano tasks to make nice spinners, prompts and messages.

While both Capistrano-WP and Steps have been Open Source, in use by Crowd Favorite, and freely available on GitHub for a while, we thought we'd take a moment to explain these tools and how we work with them. Our hope is that these are helpful for fellow developers in the WordPress and Ruby communities.

Capistrano-WP

Capistrano-WP is a Ruby gem containing recipes for deploying, rolling back, and maintaining remote WordPress installations with Capistrano.

For some background, Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH, and was originally designed to simplify and automate deployment of web applications to distributed environments.

Capistrano-WP is an alternative version control and deployment strategy from the one presented in WP-Stack. For one, WP-Stack expects WordPress Core to be included in the project as a git submodule; these recipes pull WordPress in from SVN. This both greatly reduces the time and size required for the WP source and can also (though, less necessary with the recent updates to WP) deploy multisite environments with WP at the root directory.

This allows for easy deploys; push code to production from the comfort of a local machine, with symlinks controlling releases and rollbacks when necessary. The recipes also identifies changes that may have been made to the code in production since the last deploy, to ease the process of getting them into source control. For example, if a CSS file has been edited directly on the server by someone, a new plugin was installed from the WordPress dashboard, or an existing plugin made configuration file changes.

Steps

Steps is a Ruby gem that produces simple user feedback in scripting environments.

The Steps gem is used to automate the process of creating useful and responsive shell output for Rake, Capistrano, and ruby scripting at large. It allows for complex (nested) step structure and user information retrieval (‘highline' integration). It allows the scripter to painlessly inform the user about where they are in the process and also provide a process spinner to say “Hey, don't worry, I've not locked up on this long running step… I'm still doing what you want me to be doing”.

In order words, this has provided us a convenient way to provide nested progress indicators along the lines of “We're starting to do X. Here's some feedback, and some more feedback. We're starting to do sub-task Y. Specify a piece of information for the script: … We're done with sub-task Y. We're done with task X.”

We use it extensively in our internal tools to provide consistent and straightforward feedback. The README and included test.rb provide extensive example code. Steps are also intended to execute nested blocks, so no explicit “this step is completed” command is required.

If these gems also seem useful to you, we invite you to review the READMEs and sample files, try them out yourself, and contribute to them on GitHub.