Hey Andy,<div><br></div><div>As far as I'm aware, binstubs are just a convenience to avoid typing "bundle exec" (please correct me if I'm wrong). </div><div><br></div><div>So I guess the question is: does a binstub bring any benefit over the plain ol' bundle exec? (Aside from a prettier command, of course)</div><div><br></div><div>Nik<br><div><br>On Wednesday, October 8, 2014, Andrew Stewart <<a href="mailto:boss@airbladesoftware.com">boss@airbladesoftware.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello!<br>
<br>
For a long time I have had on my server a cronjob which runs a rake task:<br>
<br>
    42 * * * * RAILS_ENV=production cd /path/to/my/app && bundle exec rake blah<br>
<br>
Recently I decided to get with the program and use a binstub instead:<br>
<br>
    42 * * * * RAILS_ENV=production /path/to/my/app/bin/rake blah<br>
<br>
But it fails with: "rake aborted! No Rakefile found".  Naturally there is a Rakefile at /path/to/my/app.<br>
<br>
My rake binstub is the one that comes with Rails 4:<br>
<br>
   <a href="https://github.com/rails/rails/commit/009873aec89a4b843b41accf616b42b7a9917ba8#diff-15" target="_blank">https://github.com/rails/rails/commit/009873aec89a4b843b41accf616b42b7a9917ba8#diff-15</a><br>
<br>
– not the one that Bundler would generate:<br>
<br>
    #!/usr/bin/env ruby<br>
    #<br>
    # This file was generated by Bundler.<br>
    #<br>
    # The application 'rake' is installed as part of a gem, and<br>
    # this file is here to facilitate running it.<br>
    #<br>
<br>
    require 'pathname'<br>
    ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",<br>
      Pathname.new(__FILE__).realpath)<br>
<br>
    require 'rubygems'<br>
    require 'bundler/setup'<br>
<br>
    load Gem.bin_path('rake', 'rake')<br>
<br>
After doing some research on this I learned it's controversial, a surprise for Rails ;)<br>
<br>
Now that the dust has settled, what's the generally recommended approach?  Keep the Rails-generated binstub for rake, and cronjobs that cd into the app directory, or go for a bundler-generated binstub (which presumably works from anywhere)?<br>
<br>
Thanks in advance,<br>
<br>
Andy Stewart<br>
_______________________________________________<br>
Chat mailing list<br>
<a href="javascript:;" onclick="_e(event, 'cvml', 'Chat@lists.lrug.org')">Chat@lists.lrug.org</a><br>
Archives: <a href="http://lists.lrug.org/pipermail/chat-lrug.org" target="_blank">http://lists.lrug.org/pipermail/chat-lrug.org</a><br>
Manage your subscription: <a href="http://lists.lrug.org/options.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/options.cgi/chat-lrug.org</a><br>
List info: <a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>
</blockquote></div></div>