Add sigs to Formula pathname methods

This commit is contained in:
Douglas Eichelberger 2023-07-23 18:42:06 -07:00
parent c7369b7ea9
commit 09885cad3a

View File

@ -708,6 +708,7 @@ class Formula
# #
# No `make install` available? # No `make install` available?
# <pre>bin.install "binary1"</pre> # <pre>bin.install "binary1"</pre>
sig { returns(Pathname) }
def bin def bin
prefix/"bin" prefix/"bin"
end end
@ -715,6 +716,7 @@ class Formula
# The directory where the formula's documentation should be installed. # The directory where the formula's documentation should be installed.
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
sig { returns(Pathname) }
def doc def doc
share/"doc"/name share/"doc"/name
end end
@ -725,6 +727,7 @@ class Formula
# #
# No `make install` available? # No `make install` available?
# <pre>include.install "example.h"</pre> # <pre>include.install "example.h"</pre>
sig { returns(Pathname) }
def include def include
prefix/"include" prefix/"include"
end end
@ -732,6 +735,7 @@ class Formula
# The directory where the formula's info files should be installed. # The directory where the formula's info files should be installed.
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
sig { returns(Pathname) }
def info def info
share/"info" share/"info"
end end
@ -742,6 +746,7 @@ class Formula
# #
# No `make install` available? # No `make install` available?
# <pre>lib.install "example.dylib"</pre> # <pre>lib.install "example.dylib"</pre>
sig { returns(Pathname) }
def lib def lib
prefix/"lib" prefix/"lib"
end end
@ -754,6 +759,7 @@ class Formula
# <pre>libexec.install "foo.jar" # <pre>libexec.install "foo.jar"
# bin.write_jar_script libexec/"foo.jar", "foo" # bin.write_jar_script libexec/"foo.jar", "foo"
# </pre> # </pre>
sig { returns(Pathname) }
def libexec def libexec
prefix/"libexec" prefix/"libexec"
end end
@ -763,6 +769,7 @@ class Formula
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
# Often one of the more specific `man` functions should be used instead, # Often one of the more specific `man` functions should be used instead,
# e.g. {#man1}. # e.g. {#man1}.
sig { returns(Pathname) }
def man def man
share/"man" share/"man"
end end
@ -773,6 +780,7 @@ class Formula
# #
# No `make install` available? # No `make install` available?
# <pre>man1.install "example.1"</pre> # <pre>man1.install "example.1"</pre>
sig { returns(Pathname) }
def man1 def man1
man/"man1" man/"man1"
end end
@ -780,6 +788,7 @@ class Formula
# The directory where the formula's man2 pages should be installed. # The directory where the formula's man2 pages should be installed.
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
sig { returns(Pathname) }
def man2 def man2
man/"man2" man/"man2"
end end
@ -790,6 +799,7 @@ class Formula
# #
# No `make install` available? # No `make install` available?
# <pre>man3.install "man.3"</pre> # <pre>man3.install "man.3"</pre>
sig { returns(Pathname) }
def man3 def man3
man/"man3" man/"man3"
end end
@ -797,6 +807,7 @@ class Formula
# The directory where the formula's man4 pages should be installed. # The directory where the formula's man4 pages should be installed.
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
sig { returns(Pathname) }
def man4 def man4
man/"man4" man/"man4"
end end
@ -804,6 +815,7 @@ class Formula
# The directory where the formula's man5 pages should be installed. # The directory where the formula's man5 pages should be installed.
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
sig { returns(Pathname) }
def man5 def man5
man/"man5" man/"man5"
end end
@ -811,6 +823,7 @@ class Formula
# The directory where the formula's man6 pages should be installed. # The directory where the formula's man6 pages should be installed.
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
sig { returns(Pathname) }
def man6 def man6
man/"man6" man/"man6"
end end
@ -818,6 +831,7 @@ class Formula
# The directory where the formula's man7 pages should be installed. # The directory where the formula's man7 pages should be installed.
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
sig { returns(Pathname) }
def man7 def man7
man/"man7" man/"man7"
end end
@ -825,6 +839,7 @@ class Formula
# The directory where the formula's man8 pages should be installed. # The directory where the formula's man8 pages should be installed.
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
sig { returns(Pathname) }
def man8 def man8
man/"man8" man/"man8"
end end
@ -833,6 +848,7 @@ class Formula
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
# Generally we try to migrate these to {#bin} instead. # Generally we try to migrate these to {#bin} instead.
sig { returns(Pathname) }
def sbin def sbin
prefix/"sbin" prefix/"sbin"
end end
@ -852,6 +868,7 @@ class Formula
# #
# Install `./example_code/simple/ones` to `share/demos/examples`: # Install `./example_code/simple/ones` to `share/demos/examples`:
# <pre>(share/"demos").install "example_code/simple/ones" => "examples"</pre> # <pre>(share/"demos").install "example_code/simple/ones" => "examples"</pre>
sig { returns(Pathname) }
def share def share
prefix/"share" prefix/"share"
end end
@ -863,6 +880,7 @@ class Formula
# #
# No `make install` available? # No `make install` available?
# <pre>pkgshare.install "examples"</pre> # <pre>pkgshare.install "examples"</pre>
sig { returns(Pathname) }
def pkgshare def pkgshare
prefix/"share"/name prefix/"share"/name
end end
@ -872,6 +890,7 @@ class Formula
# #
# To install an Emacs mode included with a software package: # To install an Emacs mode included with a software package:
# <pre>elisp.install "contrib/emacs/example-mode.el"</pre> # <pre>elisp.install "contrib/emacs/example-mode.el"</pre>
sig { returns(Pathname) }
def elisp def elisp
prefix/"share/emacs/site-lisp"/name prefix/"share/emacs/site-lisp"/name
end end
@ -880,6 +899,7 @@ class Formula
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
# This is not symlinked into `HOMEBREW_PREFIX`. # This is not symlinked into `HOMEBREW_PREFIX`.
sig { returns(Pathname) }
def frameworks def frameworks
prefix/"Frameworks" prefix/"Frameworks"
end end
@ -888,6 +908,7 @@ class Formula
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
# This is not symlinked into `HOMEBREW_PREFIX`. # This is not symlinked into `HOMEBREW_PREFIX`.
sig { returns(Pathname) }
def kext_prefix def kext_prefix
prefix/"Library/Extensions" prefix/"Library/Extensions"
end end
@ -897,6 +918,7 @@ class Formula
# but will write a new file named `*.default`. # but will write a new file named `*.default`.
# This directory is not inside the `HOMEBREW_CELLAR` so it persists # This directory is not inside the `HOMEBREW_CELLAR` so it persists
# across upgrades. # across upgrades.
sig { returns(Pathname) }
def etc def etc
(HOMEBREW_PREFIX/"etc").extend(InstallRenamed) (HOMEBREW_PREFIX/"etc").extend(InstallRenamed)
end end
@ -905,6 +927,7 @@ class Formula
# e.g. `$HOMEBREW_PREFIX/etc/openssl@1.1` # e.g. `$HOMEBREW_PREFIX/etc/openssl@1.1`
# Anything using `pkgetc.install` will not overwrite other files on # Anything using `pkgetc.install` will not overwrite other files on
# e.g. upgrades but will write a new file named `*.default`. # e.g. upgrades but will write a new file named `*.default`.
sig { returns(Pathname) }
def pkgetc def pkgetc
(HOMEBREW_PREFIX/"etc"/name).extend(InstallRenamed) (HOMEBREW_PREFIX/"etc"/name).extend(InstallRenamed)
end end
@ -912,6 +935,7 @@ class Formula
# The directory where the formula's variable files should be installed. # The directory where the formula's variable files should be installed.
# This directory is not inside the `HOMEBREW_CELLAR` so it persists # This directory is not inside the `HOMEBREW_CELLAR` so it persists
# across upgrades. # across upgrades.
sig { returns(Pathname) }
def var def var
HOMEBREW_PREFIX/"var" HOMEBREW_PREFIX/"var"
end end
@ -920,6 +944,7 @@ class Formula
# installed. # installed.
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
sig { returns(Pathname) }
def zsh_function def zsh_function
share/"zsh/site-functions" share/"zsh/site-functions"
end end
@ -928,6 +953,7 @@ class Formula
# installed. # installed.
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
sig { returns(Pathname) }
def fish_function def fish_function
share/"fish/vendor_functions.d" share/"fish/vendor_functions.d"
end end
@ -936,6 +962,7 @@ class Formula
# installed. # installed.
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
sig { returns(Pathname) }
def bash_completion def bash_completion
prefix/"etc/bash_completion.d" prefix/"etc/bash_completion.d"
end end
@ -944,6 +971,7 @@ class Formula
# installed. # installed.
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
sig { returns(Pathname) }
def zsh_completion def zsh_completion
share/"zsh/site-functions" share/"zsh/site-functions"
end end
@ -952,6 +980,7 @@ class Formula
# installed. # installed.
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
sig { returns(Pathname) }
def fish_completion def fish_completion
share/"fish/vendor_completions.d" share/"fish/vendor_completions.d"
end end
@ -960,12 +989,14 @@ class Formula
# installation so, despite not being in `HOMEBREW_CELLAR`, they are installed # installation so, despite not being in `HOMEBREW_CELLAR`, they are installed
# there after pouring a bottle. # there after pouring a bottle.
# @private # @private
sig { returns(Pathname) }
def bottle_prefix def bottle_prefix
prefix/".bottle" prefix/".bottle"
end end
# The directory where the formula's installation or test logs will be written. # The directory where the formula's installation or test logs will be written.
# @private # @private
sig { returns(Pathname) }
def logs def logs
HOMEBREW_LOGS + name HOMEBREW_LOGS + name
end end