Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the 'export PATH' message in link for a keg-only formula #2438

Merged
merged 1 commit into from
Apr 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Library/Homebrew/cmd/link.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def puts_keg_only_path_message(keg)

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)
Expand Down
6 changes: 4 additions & 2 deletions Library/Homebrew/test/cmd/link_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@
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