Closed donovanbray closed 13 years ago
Sorry, but I can't reproduce your issue. bundle install --binstubs
installs executables into the system gems bin
as well as ./bin
.
$ which dicks
$ cat Gemfile
source :rubygems
gem "dicks"
$ bundle install --binstubs --system
Fetching dependency information from the API at http://rubygems.org/.
Installing dicks (0.03)
Using bundler (1.1.pre.9)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
$ which dicks
/Library/Ruby/Gems/1.8/bin/dicks
$ ls bin
dicks
did you already have dicks installed before doing the bundle? if so it would have left the previously installed executable in place.
test with a gem that has an executable that is new to the system when you do the bundle.
before a bundle install with some gems already in place
vagrant@wallstreet:/vagrant$ sudo updatedb vagrant@wallstreet:/vagrant$ echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/ruby/bin/ vagrant@wallstreet:/vagrant$ which ruby /usr/bin/ruby vagrant@wallstreet:/vagrant$ gem list
* LOCAL GEMS *
archive-tar-minitar (0.5.2) bundler (1.0.18) kgio (2.6.0) linecache19 (0.5.12) minitest (1.6.0) rack (1.3.2) raindrops (0.7.0) rake (0.8.7) rdoc (2.5.8) ruby_core_source (0.1.5) rubygems-update (1.8.10) unicorn (4.0.1) vagrant@wallstreet:/vagrant$ locate bin/unicorn /usr/bin/unicorn /usr/bin/unicorn_rails /usr/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/bin/unicorn /usr/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/bin/unicorn_rails
Notice the executables are in the gempath as well as the regular path.
AFTER a bundle
bundle install --no-color --system --binstubs
vagrant@wallstreet:/vagrant$ sudo updatedb vagrant@wallstreet:/vagrant$ which ruby /usr/bin/ruby vagrant@wallstreet:/vagrant$ which rails vagrant@wallstreet:/vagrant$ locate bin/rails /usr/lib/ruby/gems/1.9.1/bin/rails /usr/lib/ruby/gems/1.9.1/gems/rails-3.1.0/bin/rails /usr/lib/ruby/gems/1.9.1/gems/railties-3.1.0/bin/rails /vagrant/bin/rails vagrant@wallstreet:/vagrant$ echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/ruby/bin/ vagrant@wallstreet:/vagrant$
/vagrant/bin/rails is the binstubs location, and note that /usr/bin/rails wasn't created, nor any other executable that was in the Gemfile and not already on the box.
Versions:
vagrant@wallstreet:/vagrant$ uname -a Linux wallstreet 2.6.32-33-generic #70-Ubuntu SMP Thu Jul 7 21:09:46 UTC 2011 i686 GNU/Linux vagrant@wallstreet:/vagrant$ ruby -v ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux] vagrant@wallstreet:/vagrant$ bundle -v Bundler version 1.0.18 vagrant@wallstreet:/vagrant$
As you can see in my output, which dicks
returned zero results before I ran the install.
On Sep 16, 2011, at 1:04 PM, Donovan Bray wrote:
did you already have dicks installed before doing the bundle? if so it would have left the previously installed executable in place.
test with a gem that has an executable that is new to the system when you do the bundle.
Reply to this email directly or view it on GitHub: https://github.com/carlhuda/bundler/issues/1417#issuecomment-2118281
correct me if I'm wrong but generally the structure under Gems/1.8... etc is NOT generally in the $PATH
/Library/Ruby/Gems/1.8/bin/dicks
I expected the gems executables to be in the same location where 'which ruby' is. Which would match where 'gem install
Rubygems doesn't expose the directory that it will install executables into. As a result, Bundler installs into (effectively) Gem.path+"/bin"
. Having that in your path is up to you. HTH.
so just to be clear; I shouldn't expect a bundler --system to install gems identically to a regular 'gem install':
ie: a regular gem install of rails, installs to the system path as well as the gem path, but bundler will not.
vagrant@wallstreet:~$ sudo gem install rails Successfully installed rails-3.1.0 1 gem installed Installing ri documentation for rails-3.1.0... file 'lib' not found Installing RDoc documentation for rails-3.1.0... file 'lib' not found vagrant@wallstreet:~$ which rails /usr/bin/rails
Because gem install
does not always install binaries into Gem.bindir
, it is not possible to guarantee that binstubs will be placed into the same directory as gem install
. What does your system return for Gem.bindir
?
vagrant@services:/vagrant$ irb irb(main):001:0> Gem.bindir => "/usr/bin"
vagrant@services:/vagrant$ gem env RubyGems Environment:
sorry ran that in the wrong vagrant box; this is the same one we've been dealing with:
vagrant@wallstreet:~$ gem env RubyGems Environment:
I think the clearest way that I can put it is like this: bundle install --system
installs your Bundled gems into your system's Rubygems. In my tests with Rubygems, there is no way to reliably sync up with the directory that gem install
will put binstubs into. For the time being, I suggest that you add Gem.path+"/bin"
to your PATH to ensure that you can reliably find binstubs for gems installed by Bundler. If you can figure out a way to guarantee that Bundler will put binstubs into the same place as gem install
, I would be happy to apply those changes to Bundler. Thanks!
This had been discussed and fixed before: https://github.com/carlhuda/bundler/issues/531
Gem.bindir
does not return the directory that Rubygems will install binaries into. That is the entire reason that we stopped using it.
Try putting gem: -n/tmp/bin
into your ~/.gemrc
file. Once you do that, Rubygems will install executables into /tmp/bin, and not into Gem.bindir. If you can figure out a way to get the directory that Rubygems will actually install the executables into, which is not Gem.bindir, I would love to use that instead.
We have 3 environments we use bundler to manage, one in development on our osx boxes with rvm, second is in production without rvm, and we are building vagrant development boxes where we don't want to use rvm, but don't want to use the --deployment option either.
We want the bundle to be sent to the system, AND it put the executables in same place we expect them to be in production.
but when we do --system to install them to the system location and --binstubs, the --binstubs are created, but the gem executables on the system aren't created. It should be both.