[LRUG] November talk proposal

Tom Stuart tom at tomstuart.co.uk
Thu Oct 11 02:28:09 PDT 2012


On 10 October 2012 21:41, Paul Battley <pbattley at gmail.com> wrote:
> On the topic of Rake, I've been using Make a lot recently - even for
> Ruby projects. Tab indentation requirements aside, I think it's a
> better tool for the job (not to mention that you don't have to type
> "bundle exec" all the time*).
>
> * If your "solution" to this involves some 2000-line shell function
> that "automagically" detects when to prefix "bundle exec" on a
> command, we probably shouldn't ever work together.

I agree with the sentiment - running bundle exec semi-invisibly is a
recipe for hours of confusion at best - but I do tend to avoid using
bundle exec for running rake. In most contexts in which bundler will
be needed, rake will be requiring it in early on in execution (e.g. by
loading config/environment in a Rails context, or 'bundler/setup'
outside Rails). So running bundle exec rake requires loading the
Bundler runtime twice, which entails a not-insignificant performance
overhead. (In a former life I would have ranted on about Bundler at
this point, but I am serene now or something.) It's relatively easy to
avoid this, since the only reason we use bundle exec rake is to ensure
that the rake executable's gem version matches the version of rake
specified in the Gemfile. If you're already using rvm/rbenv (which
seem like necessary evils), both support gemsets, and you can ensure
that there is only one version of rake installed in the gemset
currently in use, and that it matches the version specified in the
Gemfile.

If you've somehow managed to avoid using rvm/rbenv, and hence are not
able to use gemsets, you could relatively simply create shell aliases
pointing at the different versions of rake you have installed, and
then run e.g. rake0.8 or rake 0.9 to achieve the same outcome.

Anyway, WFM. And yes, I'm aware it depends on rvm, which is arguably
even more evil than 'some 2000-line shell function that
"automagically" detects when to prefix "bundle exec"'. I'll update the
list if and when I find a way to avoid that particular monster.

With best wishes from Germany,

T



More information about the Chat mailing list