<div dir="ltr"><div>TL;DR<br></div><div>I've decided to avoid both in server/automated environments and tend towards rbenv + bundler for ruby/gem isolation in my local development environments, though I don't think we need to endorse one or the other for the latter. For mediawiki-vagrant, I actually reverted the use of rbenv via Puppet in favor of distro packages which are new enough for browser tests and much easier/faster to provision (there were already a few complaints about how slow provisioning was after introducing rbenv).[1]<div>
<br></div><div>For those developing outside of mw-vagrant, I'm not sure there's any empirical answer as to which is better, but there are a number of pros and cons for different use cases. In my experience, it helps to consider how each is implemented before deciding on whether to use it in a particular environment.<br>
</div><div><br></div><div>First, some facts.</div><div><br></div><div>RVM implements:</div><div> - installation of rubies (from source and binary packages)</div><div> - isolation of rubies (into user- or system-wide sandboxes)</div>
<div> - definition and isolation of "gemsets" (into sandboxes for each version of ruby installed)</div><div> - switching between versions of ruby <i>and gemsets</i> automatically by:</div><div> - intercepting every invocation of `cd` using a bash alias[2] which</div>
<div> - traverses directories upward for .ruby-version and .ruby-gemset files</div><div> - prepends PATH (for ruby) and exports GEM_* env variables </div><div><br></div><div>rbenv implements:</div><div> - installation of rubies* (from source only; *requires ruby-build plugin)</div>
<div> - isolation of rubies (into user- or system-wide sandboxes)</div><div> - switching between versions of ruby automatically by:</div><div> - installing bin stubs for all ruby executables (ruby, gem, etc.) and every installed gem</div>
<div> - prepending PATH once per (sub-)shell</div><div> - intercepting every invocation of a bin stub (ruby, gem, etc.; see above) which</div><div> - traverses directories upward for .ruby-version and</div><div> - delegates to the corresponding version of the real binary</div>
<div><br></div><div>Second, my experience with each—and perhaps emotional response though let's call it intuition.</div><div> </div><div>RVM:<br></div><div>Both the out-of-the-box support for ruby installation—especially from binary packages—and implementation of gemsets are useful when you hack on a wide variety of disparate ruby projects. However, the hijacking of `cd` seems like a huge hammer that I'm trepidatious about introducing anywhere near a server, especially those that depend on automation through lots of shell invocation—and, in fact, I never have used RVM in server environments for this reason.</div>
<div><br></div><div>rbenv:</div><div>I appreciate the small footprint when compared to RVM, and installation of rubies is easy enough (albeit slow) using ruby-build. The lack of gemsets was annoying at first, but one can use `bundler --path` to achieve almost the same thing, and since you're almost always invoking gem binaries via `bundle exec`, real gemsets are actually overkill. The use of bin stubs over hijacking `cd` seemed more sane at first, but it introduces substantial lag when executing anything ruby related. Additionally, bin stubs lead to shell-scripting fallacies where a binary seems to exist ([ -x $bin] is true), but when executed returns "rbenv: command doesn't exist for this ruby version." For these latter reasons, I am also hesitant to use rbenv on servers.<br>
</div><div><br></div><div>Anyway, sorry for the long read. It really comes down to preference for developers, and my preference is usually for tools that are less intrusive. That's why I now use rbenv over RVM for local development.</div>
<div><br></div><div>1: <a href="https://gerrit.wikimedia.org/r/#/c/140877/">https://gerrit.wikimedia.org/r/#/c/140877/</a></div><div>2: <a href="http://stackoverflow.com/questions/5605277/how-does-rvm-detect-when-youve-changed-directories">http://stackoverflow.com/questions/5605277/how-does-rvm-detect-when-youve-changed-directories</a></div>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jun 28, 2014 at 6:39 PM, Nikolas Everett <span dir="ltr"><<a href="mailto:neverett@wikimedia.org" target="_blank">neverett@wikimedia.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">For my part I don't know enough to have an opinion other than that we need something to do the dependency management and isolation. I don't care which one. I know puppet has an rbenv patch merged or waiting. </p>
<div class="gmail_quote"><div><div class="h5">On Jun 28, 2014 2:52 PM, "Chris McMahon" <<a href="mailto:christopher.mcmahon@gmail.com" target="_blank">christopher.mcmahon@gmail.com</a>> wrote:<br type="attribution">
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jun 28, 2014 at 4:33 AM, Željko Filipin <span dir="ltr"><<a href="mailto:zfilipin@wikimedia.org" target="_blank">zfilipin@wikimedia.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">This is mostly question for <span style="font-family:arial,sans-serif;font-size:13px">Dan Duvall, but I wanted to ask it in public, so others could contribute too.</span><div>
<span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Dan, what are you thoughts about </span><font face="arial, sans-serif">RVM[1] and rbenv[2]? Should we use one or the other exclusively? Or are there times when one or the other is the better choice?</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">Are there other options?</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">We are using </font><span style="font-family:arial,sans-serif">RVM for browser tests, mostly because at the time we were starting the project I did not know about any other Ruby version/environment managers.</span></div>
</div></blockquote><div><br></div><div> As I recall, it was also because I had recommendations from Ruby experts at places like Groupon and Leandog who recommended RVM at the time. </div></div><br></div></div>
<br></div></div>_______________________________________________<br>
QA mailing list<br>
<a href="mailto:QA@lists.wikimedia.org" target="_blank">QA@lists.wikimedia.org</a><br>
<a href="https://lists.wikimedia.org/mailman/listinfo/qa" target="_blank">https://lists.wikimedia.org/mailman/listinfo/qa</a><br>
<br></blockquote></div>
<br>_______________________________________________<br>
QA mailing list<br>
<a href="mailto:QA@lists.wikimedia.org">QA@lists.wikimedia.org</a><br>
<a href="https://lists.wikimedia.org/mailman/listinfo/qa" target="_blank">https://lists.wikimedia.org/mailman/listinfo/qa</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Dan Duvall<div>Automation Engineer</div><div><a href="http://wikimediafoundation.org" target="_blank">Wikimedia Foundation</a><br></div></div>
</div>