diff options
-rw-r--r-- | lib/bundler/cli.rb | 2 | ||||
-rw-r--r-- | lib/bundler/installer.rb | 2 | ||||
-rw-r--r-- | spec/runtime/executable_spec.rb | 17 |
3 files changed, 19 insertions, 2 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 73b47f0aa5..3bb3b90df5 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -351,7 +351,7 @@ module Bundler if spec.name == "bundler" Bundler.ui.warn "Skipping bundler since can't bundle bundler." else - installer.generate_bundler_executable_stubs(spec, :force => options[:force]) + installer.generate_bundler_executable_stubs(spec, :force => options[:force], :binstubs_cmd => true) end end diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb index 857246aaca..6a8fbbb901 100644 --- a/lib/bundler/installer.rb +++ b/lib/bundler/installer.rb @@ -137,7 +137,7 @@ module Bundler write = true binstub_path = "#{bin_path}/#{executable}" next if executable == "bundle" - if File.exists?(binstub_path) && !options[:force] + if File.exists?(binstub_path) && !options[:force] && options[:binstubs_cmd] write = false Bundler.ui.warn <<-MSG Skipping #{executable} since it already exists. Pass --force to overwrite. diff --git a/spec/runtime/executable_spec.rb b/spec/runtime/executable_spec.rb index 34d5bba7c9..3040562e6d 100644 --- a/spec/runtime/executable_spec.rb +++ b/spec/runtime/executable_spec.rb @@ -129,4 +129,21 @@ describe "Running bin/* commands" do expect(bundled_app("bin/rackup")).to exist end + + it "always reinstalls the binstub" do + gemfile <<-G + source "file://#{gem_repo1}" + gem "rack" + G + + bundle "install --binstubs bin/" + + File.open(bundled_app("bin/rackup"), 'wb') do |file| + file.print "OMG" + end + + bundle "install" + + expect(File.read(bundled_app("bin/rackup"))).not_to eq("OMG") + end end |