summaryrefslogtreecommitdiff
path: root/lib/bundler
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2017-08-28 01:15:16 +0000
committerThe Bundler Bot <bot@bundler.io>2017-08-28 01:15:16 +0000
commitcda5ef70e2b07d5d78168b34eeeb9dc86df78894 (patch)
tree7a783ed69ebf329bf518c76a80d5703dd646baaf /lib/bundler
parent9aa6a6a0d2efb3d6068d4500f7c96eefdf1eb98f (diff)
parent3861a04f1f7fd45be5d992b1432eba9e5bcfaf58 (diff)
downloadbundler-cda5ef70e2b07d5d78168b34eeeb9dc86df78894.tar.gz
Auto merge of #5976 - bundler:colby/bundler-binstubs-standalone, r=segiddins
Fix bundle binstubs stanadlone flag ### What was the end-user problem that led to this PR? Currently, specifying the `--standalone` flag breaks `bundler binstubs` unless you have the `path` setting set in your bundle config. This is breaking in different ways but mostly for the same reason. Bundler Master: ``` RuntimeError: Can't standalone without an explicit path set /Users/c/Desktop/Projects/bundler/lib/bundler/installer.rb:158:in `generate_standalone_bundler_executable_stubs' /Users/c/Desktop/Projects/bundler/lib/bundler/cli/binstubs.rb:36:in `block in run' /Users/c/Desktop/Projects/bundler/lib/bundler/cli/binstubs.rb:26:in `each' ``` Bundler 1.15.4: ``` TypeError: no implicit conversion of nil into String /Users/c/.rubies/ruby-2.4.1/lib/ruby/2.4.0/pathname.rb:409:in `initialize' /Users/c/.rubies/ruby-2.4.1/lib/ruby/2.4.0/pathname.rb:409:in `new' /Users/c/.rubies/ruby-2.4.1/lib/ruby/2.4.0/pathname.rb:409:in `join' /Users/c/.gem/ruby/2.4.1/gems/bundler-1.15.4/lib/bundler/installer.rb:142:in `generate_standalone_bundler_executable_stubs' ``` This was not caught in our tests because the `--standalone` flag was infact not being tested. Another issue is that we have command options for the `bundle binstubs` command which are missing documentation in the man pages. ### What was your diagnosis of the problem? This error occurs when the `path` setting is not set which `generate_standalone_bundler_executable_stubs` expects to be set ### What is your fix for the problem, implemented in this PR? Set a temporary path setting in the binstubs command of either any currently set `path` setting or use `Bundler.root` instead. ### Why did you choose this fix out of the possible options? This was the most simplest solution that i can think of without having to change the standalone binstub generator.
Diffstat (limited to 'lib/bundler')
-rw-r--r--lib/bundler/cli/binstubs.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/bundler/cli/binstubs.rb b/lib/bundler/cli/binstubs.rb
index acec5741b7..1869eee628 100644
--- a/lib/bundler/cli/binstubs.rb
+++ b/lib/bundler/cli/binstubs.rb
@@ -33,7 +33,9 @@ module Bundler
if options[:standalone]
next Bundler.ui.warn("Sorry, Bundler can only be run via RubyGems.") if gem_name == "bundler"
- installer.generate_standalone_bundler_executable_stubs(spec)
+ Bundler.settings.temporary(:path => (Bundler.settings[:path] || Bundler.root)) do
+ installer.generate_standalone_bundler_executable_stubs(spec)
+ end
else
installer.generate_bundler_executable_stubs(spec, :force => options[:force], :binstubs_cmd => true)
end