diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index 349b5b5041..f16246e9d5 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -287,6 +287,7 @@ module Formulary def caveats self.class.instance_variable_get(:@caveats_string) &.gsub(HOMEBREW_PREFIX_PLACEHOLDER, HOMEBREW_PREFIX) + &.gsub(HOMEBREW_HOME_PLACEHOLDER, Dir.home) end @tap_git_head_string = json_formula["tap_git_head"] diff --git a/Library/Homebrew/test/formulary_spec.rb b/Library/Homebrew/test/formulary_spec.rb index d8f3fb0400..5e3ac4950d 100644 --- a/Library/Homebrew/test/formulary_spec.rb +++ b/Library/Homebrew/test/formulary_spec.rb @@ -270,7 +270,7 @@ describe Formulary do "conflicts_with" => ["conflicting_formula"], "conflicts_with_reasons" => ["it does"], "link_overwrite" => ["bin/abc"], - "caveats" => "example caveat string", + "caveats" => "example caveat string\n/$HOME\n$HOMEBREW_PREFIX", "service" => { "run" => ["$HOMEBREW_PREFIX/opt/formula_name/bin/beanstalkd", "test"], "run_type" => "immediate", @@ -356,7 +356,7 @@ describe Formulary do expect(formula.conflicts.map(&:reason)).to include "it does" expect(formula.class.link_overwrite_paths).to include "bin/abc" - expect(formula.caveats).to eq "example caveat string" + expect(formula.caveats).to eq "example caveat string\n#{Dir.home}\n#{HOMEBREW_PREFIX}" expect(formula).to be_a_service expect(formula.service.command).to eq(["#{HOMEBREW_PREFIX}/opt/formula_name/bin/beanstalkd", "test"])