Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Auto merge of #4715 - jenseng:fix_absolute_path_message, r=segiddins
Browse files Browse the repository at this point in the history
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
  • Loading branch information
homu committed Jun 25, 2016
2 parents bacb0e7 + 2410d93 commit 3b928d8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/bundler/cli/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def run

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."
Expand Down
14 changes: 14 additions & 0 deletions spec/install/post_bundle_message_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,20 @@
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
Expand Down

0 comments on commit 3b928d8

Please sign in to comment.