Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binstubs made by Rails 4 are different from those made by Bundler 1.3 (pre5) #8974

Closed
jlecour opened this issue Jan 17, 2013 · 10 comments
Closed

Comments

@jlecour
Copy link
Contributor

jlecour commented Jan 17, 2013

Hi,

I'm working on a Rails 4 app (using 555cb0a) and Bundler 1.3.0.pre.5.

When I execute bin/rake rails:update I end up with those binstubs :

#!/usr/bin/env ruby
APP_PATH = File.expand_path('../../config/application',  __FILE__)
require_relative '../config/boot'
require 'rails/commands'
#!/usr/bin/env ruby
require_relative '../config/boot'
require 'rake'
Rake.application.run

And later if I bin/bundle they are changed back to :

#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'rails' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
  Pathname.new(__FILE__).realpath)

require 'rubygems'
require 'bundler/setup'

load Gem.bin_path('railties', 'rails')
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'rake' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
  Pathname.new(__FILE__).realpath)

require 'rubygems'
require 'bundler/setup'

load Gem.bin_path('rake', 'rake')

Which of those should I keep?

Thanks

@rafaelfranca
Copy link
Member

@hone @jeremy

@jeremy
Copy link
Member

jeremy commented Jan 17, 2013

This will be fixed in the next bundler --pre release. It won't overwrite executables you already have in ./bin

@jeremy jeremy closed this as completed Jan 17, 2013
@jlecour
Copy link
Contributor Author

jlecour commented Feb 26, 2013

It was fine with pre-releases (including pre.8), but with the 1.3.0 release I get overwritten binstubs every time I bundle, bundle update or bundle install.

I'm using Rails 4.0.0.beta1, Ruby 2.0.0-p0 and Bundler 1.3.0 with Rbenv 0.4.0 on Mac OS X 10.8.2.

@jeremy
Copy link
Member

jeremy commented Feb 26, 2013

Bundler reverted this change for semver compliance. To avoid it, don't use bundle install --binstubs which "sticks" the binstubs option in .bundle/config. To fix it now, you can wipe the sticky config. Sorry about that!

@jlecour
Copy link
Contributor Author

jlecour commented Feb 26, 2013

@jeremy Thanks, but what if I want to create binstubs, only not overwriting them when they are already present?

@jeremy
Copy link
Member

jeremy commented Feb 26, 2013

@jlecour Use the new bundle binstubs <gemname> command.

@epipheus
Copy link

so is there a Rails 4 friendly way to create all binstubs without individually specifying the names of each executable. Currently I do: bundle install --binstubs and then rake rails:update:bin

@steveklabnik
Copy link
Member

The idea is that you should do them individually; gems provide lots of executables you may or may not use. It's a one-time thing that doesn't take very long.

You shouldn't be using --binstubs with rails 4.

@epipheus
Copy link

Why shouldn't it be one's choice whether to have binstubs of everything or
just a few?

@chrismo
Copy link
Contributor

chrismo commented Aug 21, 2013

Bundler did attempt to change itself to not overwrite bin entries on every invocation, so that the rails entry would be left alone, but this wasn't backwards compatible, so it was reverted: rubygems/bundler@f00e085

I agree with you about the way it should be - it was perhaps a hasty move by Rails to stick its business into the bin directory.

FWIW, in practice I find I don't have many bin-able gems and handling them one at a time has not been a big deal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants