title: Setting up RVM gemset via Rails 3 template
body: <p>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.</p>
  
  <p>Here's some of the relevant code extracted from the template file:</p>
  
  <pre><code>rvmrc = &lt;&lt;-RVMRC
  rvm_gemset_create_on_use_flag=1
  rvm_trust_rvmrcs=1
  rvm gemset use #{app_name}
  RVMRC
  
  create_file ".rvmrc", rvmrc
  </code></pre>
  
  <p>Then, further down the road:</p>
  
  <pre><code>run "cd path/to/new/app"
  run 'gem install bundler --pre'
  run 'bundle install'
  </code></pre>
  
  <p>I also tried a different version:</p>
  
  <pre><code>inside app_name do 
    run 'gem install bundler --pre'
    run 'bundle install'
  end
  </code></pre>
  
  <p>And a third version:</p>
  
  <pre><code>inside app_name do 
    run "rvm gemset create #{app_name} &amp;&amp; rvm gemset use #{app_name}"
    run 'gem install bundler --pre'
    run 'bundle install'
  end
  </code></pre>
  
  <p>It works perfectly if I just cd into the new app folder in the console <em>after</em> 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. </p>
  
  <p>The log for the app generator says this:</p>
  
  <pre><code> run    cd ~/rails3_sites/test_app from "."
   run    gem install bundler --pre from "./test_app"
   run    bundle install from "./test_app"
  </code></pre>
  
  <p>What am I missing? Any help is greatly appreciated. I am using ruby 1.9.2, by the way.</p>
  
  <p>Thanks, </p>
  
  <p>~ Andrea</p>