How to use very latest Bundler in Travis

TL;DR: When Bundler has fixes in master that you need, use the specific_install Rubygems plugin to install and use Bundler directly from a git branch. Example Travis YAML configuration excerpt:

before_install:
  - gem update --system
  - gem install specific_install
  - gem specific_install https://github.com/bundler/bundler.git
Picture: taken at Cambridge U Library. This is a CC0 free stock photo. But those are nice columns surrounding and wrapping the body of the page. Also: note the shadows of the supporting lines still visible in the finished book.

I will spend the rest of this post unpacking what the above means.

In Ruby, there is a package manager called Bundler. It’s continuously developed, and like all software,¬†can have bugs.

When a Bundler bug gets fixed, the code changes are “merged to master branch”. Then we all wait for the next release. The workarounds are about sticking to an older, non-broken version: use the -v option to choose an exact release. Example: gem install bundler -v'1.13.7'

The Rubygems system does not have a way to install gems “from a Git source URI”, but it does have a plugin system. And luckily, one of the plugins available (but not on that page) is specific_install.

allows you to install an “edge” gem straight from its github repository, or install one from an arbitrary url

In order to work around the “we all wait for the next release” step, we can install the latest and greatest using this plugin.

The plugin’s has also aliased its specific_install action to git_install. The manual claims:

This alias is shorter and is more intention-revealing
of the gem's behavior.

Source: The above Travis configuration snippet comes from a PR to the releaf project.

Rubygems now features ‘Skip this gem’ in installation

Ruby’s code-distribution mechanism Rubygems is being released in a new version real soon, and some small useful features are already in the RCs. Like “Skip this gem”, which makes it possible to skip a single update, but continue with the rest of the set of updates for your gems. Here is a demonstration of just that:

$ sudo gem up -y
Password:
Updating installed gems...
Need to update 25 gems from http://gems.rubyforge.org
.........................
complete
Attempting remote update of sqlite3-ruby
Select which gem to install for your platform (powerpc-darwin8.8.0)
 1. sqlite3-ruby 1.2.0 (mswin32)
 2. sqlite3-ruby 1.2.0 (ruby)
 3. sqlite3-ruby 1.1.0.1 (ruby)
 4. sqlite3-ruby 1.1.0.1 (mswin32)
 5. sqlite3-ruby 1.1.0.1 (ruby)
 6. sqlite3-ruby 1.1.0.1 (mswin32)
 7. Skip this gem
 8. Cancel installation
> 2
Building native extensions.  This could take a while...
Successfully installed sqlite3-ruby-1.2.0
Installing ri documentation for sqlite3-ruby-1.2.0...
Installing RDoc documentation for sqlite3-ruby-1.2.0...
Gems: [sqlite3-ruby] updated

Pretty damn necessary.

[tags]ruby,rubygems[/tags]