Question

Working on this project: https://github.com/cucumber/bool

There's a makefile to construct the various items, and I'd like to use RVM to be able to switch between rubies for the stuff within the ruby directory, however, when I give the makefile commands to switch rubies, I get a nasty error

RVM is not a function, selecting rubies with 'rvm use ...' will not work.

You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for a example.

Of course, it works just fine if I issue rvm use 1.9.3 on the command line, so this is a symptom of something else, but I'm not sure what.

Était-ce utile?

La solution

When you call RVM from cron (or a Makefile, I would expect) it's important to set up the right environment. The Scout team have a great blog article explaining this:

http://blog.scoutapp.com/articles/2010/09/07/rvm-and-cron-in-production

The important part is ensuring you have a full login shell so you have access to RVM.

/bin/bash -l -c 'the_command_inside_makefile"

Autres conseils

This seems like a good use for an RVM wrapper script, which will let you generate a shell script which loads a given RVM ruby instance into that environment without using the normal, interactive RVM setup.

For example:

rvm wrapper 1.9.3@bool ruby bool

... will create a wrapped script called 'bool' with a given Ruby selected.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top