application_ruby ruby/rails version


#1

Hi,

How can I force application_ruby to use a specific version of ruby and
rails?

I have been able to install ruby with ruby_build but I can’t figure out how
to tell application_ruby where it is.

Thanks
Rob


#2

I’m still stuck with this. Any hints or commnets would be appreciated.

Thanks
Rob

---------- Forwarded message ----------
From: Rob Watkin robwatkin@gmail.com
Date: 6 December 2013 14:33
Subject: application_ruby ruby/rails version
To: Chef List chef@lists.opscode.com

Hi,

How can I force application_ruby to use a specific version of ruby and
rails?

I have been able to install ruby with ruby_build but I can’t figure out how
to tell application_ruby where it is.

Thanks
Rob


#3

Hi Rob,

It’s not that you need to tell application_ruby where your locally built Ruby is, it’s more that you need to tell bundler where it is. It’s not entirely obvious, but the best way I’ve found is to use a wrapper for bundler which puts your version of Ruby in the path first.

I’d asked a while back in #chef IRC and was pointed towards: https://gist.github.com/grahamc/0c4079e43b5f997a5bd6

Essentially, you create a wrapper that is dropped at the root of your deployment path. The wrapper overrides the path so your local Ruby is first and passes any arguments through to the bundle command. In your application LWRP call, set the bundle_command to the wrapper. As a result, any commands executed by application_ruby as part of deploying your Rails app that call bundler are now run with your locally built Ruby.

Also, after you’ve built your local Ruby with ruby_build_ruby, make sure to install the bundler, rake and builder gems into that local Ruby as well, otherwise it won’t work :).

As for setting a specific Rails version, the best/only sensible way to do that is through specifying a version for the Rails gem in your Gemfile for Bundler.

Hope that helps!

Regards,
Gavin

On 9 Dec 2013, at 13:03, Rob Watkin robwatkin@gmail.com wrote:

I’m still stuck with this. Any hints or commnets would be appreciated.

Thanks
Rob

---------- Forwarded message ----------
From: Rob Watkin robwatkin@gmail.com
Date: 6 December 2013 14:33
Subject: application_ruby ruby/rails version
To: Chef List chef@lists.opscode.com

Hi,

How can I force application_ruby to use a specific version of ruby and rails?

I have been able to install ruby with ruby_build but I can’t figure out how to tell application_ruby where it is.

Thanks
Rob

Gavin Reynolds
SRC IT Support
University of Glasgow Students’ Representative Council

The University of Glasgow Students’ Representative Council is a charity
registered in Scotland. Registration number SC006970