From a571965df9d5dc84d1a32630a111768fbac71b3b Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 31 Dec 2016 16:38:05 +0000 Subject: formula: make prefix usually return opt_prefix. Return `opt_prefix` if it exists and `prefix` is not called from within the same formula's `install` or `post_install` methods. Otherwise, fall back to the existing functionality. This avoids the need to use `opt_prefix` etc. everywhere and generally means we don't expose an implementation detail (i.e. the full Cellar path) to dependents that have a habit of hard-coding it. --- Library/Homebrew/cmd/--prefix.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library/Homebrew/cmd') diff --git a/Library/Homebrew/cmd/--prefix.rb b/Library/Homebrew/cmd/--prefix.rb index c59830833..f6e7d2ee2 100644 --- a/Library/Homebrew/cmd/--prefix.rb +++ b/Library/Homebrew/cmd/--prefix.rb @@ -11,7 +11,7 @@ module Homebrew if ARGV.named.empty? puts HOMEBREW_PREFIX else - puts ARGV.resolved_formulae.map { |f| f.opt_prefix.exist? ? f.opt_prefix : f.installed_prefix } + puts ARGV.resolved_formulae.map(&:installed_prefix) end end end -- cgit v1.2.3