I'm trying to set up an RVM gemset through a Rails 3 template and then, via commands in the template, start using the gemset and install the gems into the new gemset (named after the app). This does not seem to work properly. The new gems do not get installed into the gemset and in fact the gemset does not get created at all.
Here's some of the relevant code extracted from the template file:
rvmrc = <<-RVMRC
rvm_gemset_create_on_use_flag=1
rvm_trust_rvmrcs=1
rvm gemset use #{app_name}
RVMRC
create_file ".rvmrc", rvmrc
Then, further down the road:
run "cd path/to/new/app"
run 'gem install bundler --pre'
run 'bundle install'
I also tried a different version:
inside app_name do
run 'gem install bundler --pre'
run 'bundle install'
end
And a third version:
inside app_name do
run "rvm gemset create #{app_name} && rvm gemset use #{app_name}"
run 'gem install bundler --pre'
run 'bundle install'
end
It works perfectly if I just cd into the new app folder in the console after the template has run. I get the RVM message: "info: Now using gemset 'test_app'." If I run the bundle install command at that point, the gems get correctly installed into the new gemset, but I can't get the same result if I just run those commands from the template file.
The log for the app generator says this:
run cd ~/rails3_sites/test_app from "."
run gem install bundler --pre from "./test_app"
run bundle install from "./test_app"
What am I missing? Any help is greatly appreciated. I am using ruby 1.9.2, by the way.
Thanks,
~ Andrea