summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2016-06-25 14:28:43 +0900
committerSamuel Giddins <segiddins@segiddins.me>2016-06-27 16:17:38 -0500
commita682e88735f80930aa81a8983d179744a5f324d0 (patch)
tree5a47eaf0334b04989e0c8cc4eab827ca7839d58c
parente4fd51d0e05bf38a4e3bc928c9331d55adae3807 (diff)
downloadbundler-a682e88735f80930aa81a8983d179744a5f324d0.tar.gz
Auto merge of #4715 - jenseng:fix_absolute_path_message, r=segiddins
Don't incorrectly relativize sibling `--path` with the same prefix Given current working directory `/foo/app`, when you install with `--path /foo/app_cache`, ensure that the messaging says: Bundled gems are installed into /foo/app_cache instead of the incorrect: Bundled gems are installed into ._cache (cherry picked from commit 3b928d83c1b606b4598c6662528b20482762a14d)
-rw-r--r--lib/bundler/cli/install.rb2
-rw-r--r--spec/install/post_bundle_message_spec.rb14
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb
index dbe25977a4..a087ab4210 100644
--- a/lib/bundler/cli/install.rb
+++ b/lib/bundler/cli/install.rb
@@ -69,7 +69,7 @@ module Bundler
if Bundler.settings[:path]
absolute_path = File.expand_path(Bundler.settings[:path])
- relative_path = absolute_path.sub(File.expand_path("."), ".")
+ relative_path = absolute_path.sub(File.expand_path(".") + File::SEPARATOR, "." + File::SEPARATOR)
Bundler.ui.confirm "Bundled gems are installed into #{relative_path}."
else
Bundler.ui.confirm "Use `bundle show [gemname]` to see where a bundled gem is installed."
diff --git a/spec/install/post_bundle_message_spec.rb b/spec/install/post_bundle_message_spec.rb
index 11fb5bb0a2..10c71f0a51 100644
--- a/spec/install/post_bundle_message_spec.rb
+++ b/spec/install/post_bundle_message_spec.rb
@@ -81,6 +81,20 @@ describe "post bundle message" do
expect(out).to include("Gems in the groups emo, obama and test were not installed")
expect(out).to include(bundle_complete_message)
end
+
+ it "with an absolute --path inside the cwd" do
+ bundle "install --path #{bundled_app}/cache"
+ expect(out).to include("Bundled gems are installed into ./cache")
+ expect(out).to_not include("Gems in the group")
+ expect(out).to include(bundle_complete_message)
+ end
+
+ it "with an absolute --path outside the cwd" do
+ bundle "install --path #{bundled_app}_cache"
+ expect(out).to include("Bundled gems are installed into #{bundled_app}_cache")
+ expect(out).to_not include("Gems in the group")
+ expect(out).to include(bundle_complete_message)
+ end
end
describe "with misspelled or non-existent gem name" do