aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorMike McQuaid2016-12-31 16:38:05 +0000
committerMike McQuaid2016-12-31 16:38:05 +0000
commita571965df9d5dc84d1a32630a111768fbac71b3b (patch)
treecd11f14a245c60e6f6de13ebd97bf9e11341c793 /Library/Homebrew/cmd
parentb1e27d689d8eadb267fb9890ec2e0a2a87e46b4e (diff)
downloadbrew-a571965df9d5dc84d1a32630a111768fbac71b3b.tar.bz2
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.
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/--prefix.rb2
1 files changed, 1 insertions, 1 deletions
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