title: How to install a gem into rvm with puppet on a vagrant box?
body: <p>I've setup a simple Vagrant box with puppet provisioner. 
  With puppet I've installed rvm:</p>
  
  <pre><code>exec { 'install_rvm':
    command =&gt; "${as_vagrant} 'curl -L https://get.rvm.io | bash -s stable'",
    creates =&gt; "${home}/.rvm",
    require =&gt; Package['curl']
  }
  </code></pre>
  
  <p>and ruby:</p>
  
  <pre><code>exec { 'install_ruby':
    command =&gt; "${as_vagrant} '${home}/.rvm/bin/rvm install 2.0.0 --latest-binary --autolibs=enabled &amp;&amp; rvm --fuzzy alias create default 2.0.0'",
    creates =&gt; "${home}/.rvm/bin/ruby",
    require =&gt; Exec['install_rvm']
  }
  </code></pre>
  
  <p>I'm trying to install a gem that would be available on the default ruby version of rvm (in this case 2.0.0)</p>
  
  <p>If I try the puppet documented code it doen's work (I suppose it instals the gem on the system ruby):</p>
  
  <pre><code>package { 'sinatra':
      ensure   =&gt; 'installed',
      provider =&gt; 'gem',
  }
  </code></pre>
  
  <p><strong>Current workaround:</strong>  If I execute a command as a vagrant user it works, but it doesn't look nice:</p>
  
  <pre><code>$as_vagrant   = 'sudo -u vagrant -H bash -l -c'
  
  exec { "${as_vagrant} 'sudo -u vagrant -H bash -l -c gem install stasis'":
    require =&gt; Exec['install_ruby']
  }
  </code></pre>
  
  <p>Any ideas?<br>
  Thank you.</p>