Capistrano, rbenv, Bundler & Jekyll


The other day I was figuring out how to use Capistrano to deploy a Jekyll site. I like using rbenv over other solutions, and I haven’t had any problems before deploying Rails apps using the capistrano-* gems.

However, I didn’t have a complete understanding on how to properly configure capistrano to mark that the jekyll executable should be prefixed both by rbenv and bundler.

Turns out, once you understand what you are doing, it’s a lot easier:

# Add jekyll to the commands that need to be exec'ed by rbenv
append :rbenv_map_bins, 'jekyll'

# Add jekyll to the commands that need to be exec'd by bundle
append :bundle_bins, 'jekyll'

New projects using Bundler, Rake and RSpec


When starting a new project, it might be a good idea to start with useful tools from the beginning.

In my experience, these are:

  • Bundler
  • Rake
  • RSpec

To do this, you just need to:

bundle init

to create a Gemfile. In there, you’ll need to add

gem 'rake'   
gem 'rspec'

After that, a quick bundle init will get set up your dependencies, and rpsec --init will setup rspec with sane defaults.

You will also need a Rakefile. In the root of your project create it with the following contents:

require 'rspec/core/rake_task'

task default: [:spec]

Prune those branches


Remember to prune old branches that are no longer present in the remote repository.

git fetch --prune

And delete the branch on the remote:

git push origin :${BRANCH_NAME}

Which means, ‘push nothing into this remote branch’.