brew

https://github.com/homebrew/brew

Ruby

🍺 The missing package manager for macOS

Utils::Inreplace#inreplace

Sometimes we have to change a bit before we install. Mostly we
prefer a patch but if you need the `prefix` of this formula in the
patch you have to resort to `inreplace`, because in the patch
you don't have access to any var defined by the formula. Only
HOMEBREW_PREFIX is available in the embedded patch.
inreplace supports regular expressions.
<pre>inreplace "somefile.cfg", /look[for]what?/, "replace by #{bin}/tool"</pre>

Source | Google | Stack overflow

Edit

git clone [email protected]:homebrew/brew.git

cd brew

open Library/Homebrew/utils/inreplace.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Utils--Inreplace-inreplace-for-pr


# Commit to git

git add Library/Homebrew/utils/inreplace.rbgit commit -m "better docs for Utils::Inreplace#inreplace"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Utils--Inreplace-inreplace-for-pr

hub pull-request


# Celebrate!