aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2017-04-02 09:50:39 +0100
committerGitHub2017-04-02 09:50:39 +0100
commit1d5e906e65aaa13cfa8ddb2f0c8003f87ef84586 (patch)
treec53e8df2774ba3774d76a0190637f644bba6f626
parent974b5e2fa26a162d29f97e996eb687b12a46a952 (diff)
parentedd9a9717cf08eabb54001679653e37732d5ce2d (diff)
downloadbrew-1d5e906e65aaa13cfa8ddb2f0c8003f87ef84586.tar.bz2
Merge pull request #2438 from eunikolsky/fix/link_PATH_message
Fix the 'export PATH' message in `link` for a keg-only formula
-rw-r--r--Library/Homebrew/cmd/link.rb4
-rw-r--r--Library/Homebrew/test/cmd/link_spec.rb6
2 files changed, 6 insertions, 4 deletions
diff --git a/Library/Homebrew/cmd/link.rb b/Library/Homebrew/cmd/link.rb
index 293f09eef..a1d1397da 100644
--- a/Library/Homebrew/cmd/link.rb
+++ b/Library/Homebrew/cmd/link.rb
@@ -86,8 +86,8 @@ module Homebrew
opt = HOMEBREW_PREFIX/"opt/#{keg.name}"
puts "\nIf you need to have this software first in your PATH instead consider running:"
- puts " #{Utils::Shell.prepend_path_in_shell_profile(opt)}/bin" if bin.directory?
- puts " #{Utils::Shell.prepend_path_in_shell_profile(opt)}/sbin" if sbin.directory?
+ puts " #{Utils::Shell.prepend_path_in_shell_profile(opt/"bin")}" if bin.directory?
+ puts " #{Utils::Shell.prepend_path_in_shell_profile(opt/"sbin")}" if sbin.directory?
end
def keg_only?(rack)
diff --git a/Library/Homebrew/test/cmd/link_spec.rb b/Library/Homebrew/test/cmd/link_spec.rb
index 7b85c96dc..59ab86cc4 100644
--- a/Library/Homebrew/test/cmd/link_spec.rb
+++ b/Library/Homebrew/test/cmd/link_spec.rb
@@ -48,9 +48,11 @@ describe "brew link", :integration_test do
expect { brew "install", "testball1" }.to be_a_success
end
- expect { brew "link", "testball1" }
+ expect { brew "link", "testball1", "SHELL" => "/bin/zsh" }
.to output(/testball1 is keg-only/).to_stderr
- .and output(/Note that doing so can interfere with building software\./).to_stdout
+ .and output(a_string_matching(/Note that doing so can interfere with building software\./)
+ .and(matching("If you need to have this software first in your PATH instead consider running:")
+ .and(including("echo 'export PATH=\"#{HOMEBREW_PREFIX}/opt/testball1/bin:$PATH\"' >> ~/.zshrc")))).to_stdout
.and be_a_success
end
end