From 040d93a0060d277c684470165ab170df64f2d1a8 Mon Sep 17 00:00:00 2001 From: Sean Molenaar Date: Sun, 7 Aug 2022 15:55:37 +0200 Subject: [PATCH] formula: add back docstring --- Library/Homebrew/formula.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index cd67b45278..c4ae6330a4 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -2166,6 +2166,24 @@ class Formula # end def install; end + # Sometimes we have to change a bit before we install. Mostly we + # prefer a patch, but if you need the {Formula#prefix prefix} of + # this formula in the patch you have to resort to `inreplace`, + # because in the patch you don't have access to any variables + # defined by the formula, as only `HOMEBREW_PREFIX` is available + # in the {DATAPatch embedded patch}. + # + # `inreplace` supports regular expressions: + #
inreplace "somefile.cfg", /look[for]what?/, "replace by #{bin}/tool"
+ # + # `inreplace` supports blocks: + #
inreplace "Makefile" do |s|
+  #   s.gsub! "/usr/local", HOMEBREW_PREFIX.to_s
+  # end
+  # 
+ # + # @see Utils::Inreplace.inreplace + # @api public def inreplace(paths, before = nil, after = nil, audit_result = true) # rubocop:disable Style/OptionalBooleanParameter super(paths, before, after, audit_result) rescue Utils::Inreplace::Error