summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTerence Lee <hone02@gmail.com>2013-01-09 16:09:59 -0800
committerTerence Lee <hone02@gmail.com>2013-01-09 16:09:59 -0800
commit65401310c8dce23899e2905e45810dd195217c02 (patch)
treec8ab9714c6ff3e7c51b63205cd38b9e5a35631c4
parente4327059d982a9b971d80fb93c01e26d62701337 (diff)
downloadbundler-65401310c8dce23899e2905e45810dd195217c02.tar.gz
don't check for existing binstubs, just overwrite during install
-rw-r--r--lib/bundler/cli.rb2
-rw-r--r--lib/bundler/installer.rb2
-rw-r--r--spec/runtime/executable_spec.rb17
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