How to use latest Ruby versions on anynines

1000px-Ruby_logo.svgAs Ruby versions get rolled out pretty frequently we need to be able to reflect this in our applications.

Since the current Heroku buildpack version only supports ruby versions up to 2.1.2 using the default environment settings we need to use the STACK environment variable to enable Ruby versions >= 2.1.3 when pushing applications to anynines. As Heroku introduced support for stacks we need to specify the “cedar” stack to enable current ruby version support for our application. 

Gemfile

At first we need to specify the  version within our Gemfile as usual:

[bash light=”true”]
source ‘https://rubygems.org’
ruby ‘2.2.0’

[/bash]

This will specify the Ruby version dependency for our application.

STACK environment variable

After pushing your application for the first time use the application identifier to set the STACK environment variable to “cedar”:

[bash light=”true”]
$> cf set-env <APP_NAME> STACK cedar
[/bash]

Push the Ruby application to anynines

Just re-push the application specifying the Heroku buildpack url as parameter. The STACK variable will be read during the buildpack execution (staging) phase. The buildpack will enable support for versions
> 2.1.2.

[bash light=”true”]
$> cf push -b https://github.com/heroku/heroku-buildpack-ruby
[/bash]

Enjoy using latest Ruby versions on anynines.

This blog post is an adaption of an article written by our colleague Robert. Please have a look at his blog about technical topics too.

Leave a Reply

Your email address will not be published. Required fields are marked *