summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2016-08-21 20:43:44 +0900
committerHomu <homu@barosl.com>2016-08-21 20:43:44 +0900
commite7b9f2fd6655a6db3ed158bb11346d2c3f63ea7b (patch)
treed36ae435717e29de33d6831573ef7aacedffa1de
parentb0c7492a5e7efbd380c0b565bab8706483a821da (diff)
parent213704cb13b9b6c1a3029df31edd58777ef7f4ef (diff)
downloadbundler-e7b9f2fd6655a6db3ed158bb11346d2c3f63ea7b.tar.gz
Auto merge of #4784 - colby-swandale:path-already-exists-error-msg, r=indirect
update path already exists error message to not be specific to symlinks If i'm attempting to install my gems into a folder that conflicts with a file that already exists, Bundler will raise the following error: ``` Could not install to path `vendor` because of an invalid symlink. Remove the symlink so the directory can be created. ``` But this error will be raised even if its just a regular ol file and not a symlink. IMO its a better user experience to drop the symlink mention and ask the user to simply move or rename the file. Example: ``` Could not install to path `vendor` because a file already exists at that path. Either remove or rename the file so the directory can be created. ```
-rw-r--r--lib/bundler/installer.rb2
-rw-r--r--spec/install/path_spec.rb8
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb
index 528dee177e..824b1a45cd 100644
--- a/lib/bundler/installer.rb
+++ b/lib/bundler/installer.rb
@@ -207,7 +207,7 @@ module Bundler
end unless Bundler.bundle_path.exist?
rescue Errno::EEXIST
raise PathError, "Could not install to path `#{Bundler.settings[:path]}` " \
- "because of an invalid symlink. Remove the symlink so the directory can be created."
+ "because a file already exists at that path. Either remove or rename the file so the directory can be created."
end
def resolve_if_need(options)
diff --git a/spec/install/path_spec.rb b/spec/install/path_spec.rb
index 3d84fffd58..03c42f008c 100644
--- a/spec/install/path_spec.rb
+++ b/spec/install/path_spec.rb
@@ -130,21 +130,21 @@ describe "bundle install" do
end
end
- describe "to a dead symlink" do
+ describe "to a file" do
before do
in_app_root do
- `ln -s /tmp/idontexist bundle`
+ `touch /tmp/idontexist bundle`
end
end
- it "reports the symlink is dead" do
+ it "reports the file exists" do
gemfile <<-G
source "file://#{gem_repo1}"
gem "rack"
G
bundle "install --path bundle"
- expect(out).to match(/invalid symlink/)
+ expect(out).to match(/file already exists/)
end
end
end