diff options
author | Homu <homu@barosl.com> | 2015-11-27 07:48:31 +0900 |
---|---|---|
committer | Homu <homu@barosl.com> | 2015-11-27 07:48:31 +0900 |
commit | acbc5e4717144cc4e9c7b6373402741e00fea4f2 (patch) | |
tree | 94e509cf1d090d0f5979df54d63f395659039425 | |
parent | 22754a89e9cdce2979e82a2ef30330e09e813aa4 (diff) | |
parent | accee5e72162bf2ac08fb377952484847e85369a (diff) | |
download | bundler-acbc5e4717144cc4e9c7b6373402741e00fea4f2.tar.gz |
Auto merge of #4021 - jaym:bin-move, r=segiddins
Use exe instead of bin for BUNDLE_BIN_PATH fallback
Looks like these got moved.
I'm having a hard time getting this to actually fail in the tests. Here's a gist of something that fails:
Gemfile
----------
```ruby
source 'https://rubygems.org'
gem 'rake'
```
Rakefile
-----------
```ruby
desc "foo"
task :foo do
sh 'bundle -v'
end
```
> bundle install
> bundle install --deployment
> bundle exec rake foo
```
bundle -v
/Users/jmundrawala/.rbenv/versions/2.1.2/bin/bundle:23:in `load': cannot load such file -- /Users/jmundrawala/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.10.6/bin/bundle (LoadError)
from /Users/jmundrawala/.rbenv/versions/2.1.2/bin/bundle:23:in `<main>'
rake aborted!
Command failed with status (1): [bundle -v...]
/Users/jmundrawala/workspace/bundler/foo/Rakefile:4:in `block in <top (required)>'
Tasks: TOP => foo
(See full trace by running task with --trace)
```
-rw-r--r-- | lib/bundler/runtime.rb | 2 | ||||
-rw-r--r-- | spec/commands/exec_spec.rb | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb index 4a1e3c92f9..179ce53ec4 100644 --- a/lib/bundler/runtime.rb +++ b/lib/bundler/runtime.rb @@ -192,7 +192,7 @@ module Bundler begin ENV["BUNDLE_BIN_PATH"] = Bundler.rubygems.bin_path("bundler", "bundle", VERSION) rescue Gem::GemNotFoundException - ENV["BUNDLE_BIN_PATH"] = File.expand_path("../../../bin/bundle", __FILE__) + ENV["BUNDLE_BIN_PATH"] = File.expand_path("../../../exe/bundle", __FILE__) end # Set BUNDLE_GEMFILE diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb index 3dd3e882e0..cfbc18107e 100644 --- a/spec/commands/exec_spec.rb +++ b/spec/commands/exec_spec.rb @@ -345,4 +345,20 @@ describe "bundle exec" do expect(out).to match('"TODO" is not a summary') end end + + describe "with gems bundled for deployment" do + it "works when calling bundler from another script" do + gemfile <<-G + module Monkey + def bin_path(a,b,c) + raise Gem::GemNotFoundException.new('Fail') + end + end + Bundler.rubygems.extend(Monkey) + G + bundle "install --deployment" + bundle "exec ruby -e '`bundler -v`; puts $?.success?'" + expect(out).to match("true") + end + end end |