I'm building a Yeoman generator and I'd like to have ruby gems installed automatically and have both gem and Ruby versions locked down to the project by using rvm/bundler. So running 'yo my-generator' would then run rvm use 2.11@my-generator
.
The gems I'll be installing are Sass/Compass and other related gems.
I've found that rvm only seems to automatically switch Ruby versions when changing into a directory, and that it also requires using a 'login shell'.
When using:
var sh = require('execSync');
sh.run('rvm use 2.1.1@my-generator | bundle install');
I get the following 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.
I've attempted using npm's child_process module and running exec("/bin/bash --login | rvm use 2.1.1"
but I'm still getting the same error.
Is this workflow possible? Or even advisable? Is there a way to lock down both gem versions and Ruby versions within a Yeoman generator?