dev-cmd/: edit help text and descriptions.

This commit is contained in:
EricFromCanada 2018-10-08 22:49:03 -04:00
parent 4a0e97d85a
commit ddf057f3dd
17 changed files with 186 additions and 187 deletions

View File

@ -1,6 +1,7 @@
#: * `audit` [`--strict`] [`--fix`] [`--online`] [`--new-formula`] [`--display-cop-names`] [`--display-filename`] [`--only=`<method>|`--except=`<method>] [`--only-cops=`<cops>|`--except-cops=`<cops>] [<formulae>]: #: * `audit` [`--strict`] [`--fix`] [`--online`] [`--new-formula`] [`--display-cop-names`] [`--display-filename`] [`--only=`<method>|`--except=`<method>] [`--only-cops=`<cops>|`--except-cops=`<cops>] [<formulae>]:
#: Check <formulae> for Homebrew coding style violations. This should be #: Check <formulae> for Homebrew coding style violations. This should be run
#: run before submitting a new formula. #: before submitting a new formula. Will exit with a non-zero status if any errors
#: are found, which can be useful for implementing pre-commit hooks.
#: #:
#: If no <formulae> are provided, all of them are checked. #: If no <formulae> are provided, all of them are checked.
#: #:
@ -23,16 +24,13 @@
#: If `--display-filename` is passed, every line of output is prefixed with the #: If `--display-filename` is passed, every line of output is prefixed with the
#: name of the file or formula being audited, to make the output easy to grep. #: name of the file or formula being audited, to make the output easy to grep.
#: #:
#: Passing `--only=`<method> will run only the methods named `audit_<method>`, #: Specifying `--only=`<method> will run only the methods named `audit_`<method>,
#: while `--except=`<method> will skip the methods named `audit_<method>`. #: while `--except=`<method> will skip the methods named `audit_`<method>.
#: For either option <method> should be a comma-separated list. #: For either option <method> should be a comma-separated list.
#: #:
#: Passing `--only-cops=`<cops> will check for violations of only the listed #: Specifying `--only-cops=`<cops> will check for violations of only the listed
#: RuboCop <cops>, while `--except-cops=`<cops> will skip checking the listed #: RuboCop <cops>, while `--except-cops=`<cops> will skip checking the listed
#: <cops>. For either option <cops> should be a comma-separated list of cop names. #: <cops>. For either option <cops> should be a comma-separated list of cop names.
#:
#: `audit` exits with a non-zero status if any errors are found. This is useful,
#: for instance, for implementing pre-commit hooks.
# Undocumented options: # Undocumented options:
# `-D` activates debugging and profiling of the audit methods (not the same as `--debug`) # `-D` activates debugging and profiling of the audit methods (not the same as `--debug`)
@ -57,12 +55,13 @@ module Homebrew
usage_banner <<~EOS usage_banner <<~EOS
`audit` [<options>] <formulae>: `audit` [<options>] <formulae>:
Check <formulae> for Homebrew coding style violations. This should be Check <formulae> for Homebrew coding style violations. This should be run before
run before submitting a new formula. submitting a new formula. Will exit with a non-zero status if any errors are
found, which can be useful for implementing pre-commit hooks.
If no <formulae> are provided, all of them are checked. If no <formulae> are provided, all of them are checked.
EOS EOS
switch "--strict", switch "--strict",
description: "Run additional style checks, including Rubocop style checks." description: "Run additional style checks, including RuboCop style checks."
switch "--online", switch "--online",
description: "Run additional slower style checks that require a network connection." description: "Run additional slower style checks that require a network connection."
switch "--new-formula", switch "--new-formula",
@ -77,21 +76,23 @@ module Homebrew
description: "Prefix every line of output with name of the file or formula being audited, to "\ description: "Prefix every line of output with name of the file or formula being audited, to "\
"make output easy to grep." "make output easy to grep."
switch "-D", "--audit-debug", switch "-D", "--audit-debug",
description: "Activates debugging and profiling" description: "Enable debugging and profiling of audit methods."
comma_array "--only", comma_array "--only",
description: "Passing `--only=`<method> will run only the methods named audit_<method>. "\ description: "Specify a comma-separated <method> list to only run the methods named "\
"<method> should be a comma-separated list." "`audit_`<method>."
comma_array "--except", comma_array "--except",
description: "Passing `--except=`<method> will run only the methods named audit_<method>, "\ description: "Specify a comma-separated <method> list to skip running the methods named "\
"<method> should be a comma-separated list." "`audit_`<method>."
comma_array "--only-cops", comma_array "--only-cops",
description: "Passing `--only-cops=`<cops> will check for violations of only the listed "\ description: "Specify a comma-separated <cops> list to check for violations of only the listed "\
"RuboCop cops. <cops> should be a comma-separated list of cop names." "RuboCop cops."
comma_array "--except-cops", comma_array "--except-cops",
description: "Passing `--except-cops=`<cops> will skip checking the listed RuboCop cops "\ description: "Specify a comma-separated <cops> list to skip checking for violations of the listed "\
"violations. <cops> should be a comma-separated list of cop names." "RuboCop cops."
switch :verbose switch :verbose
switch :debug switch :debug
conflicts "--only", "--except"
conflicts "--only-cops", "--except-cops"
end end
end end
@ -126,7 +127,7 @@ module Homebrew
if only_cops && except_cops if only_cops && except_cops
odie "--only-cops and --except-cops cannot be used simultaneously!" odie "--only-cops and --except-cops cannot be used simultaneously!"
elsif (only_cops || except_cops) && (strict || args.only) elsif (only_cops || except_cops) && (strict || args.only)
odie "--only-cops/--except-cops and --strict/--only cannot be used simultaneously" odie "--only-cops/--except-cops and --strict/--only cannot be used simultaneously!"
end end
options = { fix: args.fix?, realpath: true } options = { fix: args.fix?, realpath: true }

View File

@ -1,10 +1,10 @@
#: * `bottle` [`--verbose`] [`--no-rebuild`|`--keep-old`] [`--skip-relocation`] [`--or-later`] [`--root-url=`<URL>] [`--force-core-tap`] [`--json`] <formulae>: #: * `bottle` [`--verbose`] [`--no-rebuild`|`--keep-old`] [`--skip-relocation`] [`--or-later`] [`--root-url=`<URL>] [`--force-core-tap`] [`--json`] <formulae>:
#: Generate a bottle (binary package) from a formula installed with #: Generate a bottle (binary package) from a formula that was installed with
#: `--build-bottle`. #: `--build-bottle`.
#: #:
#: If the formula specifies a rebuild version, it will be incremented in the #: If the formula specifies a rebuild version, it will be incremented in the
#: generated DSL. Passing `--keep-old` will attempt to keep it at its #: generated DSL. Passing `--keep-old` will attempt to keep it at its original
#: original value, while `--no-rebuild` will remove it. #: value, while `--no-rebuild` will remove it.
#: #:
#: If `--verbose` (or `-v`) is passed, print the bottling commands and any warnings #: If `--verbose` (or `-v`) is passed, print the bottling commands and any warnings
#: encountered. #: encountered.
@ -15,7 +15,7 @@
#: If `--root-url` is passed, use the specified <URL> as the root of the #: If `--root-url` is passed, use the specified <URL> as the root of the
#: bottle's URL instead of Homebrew's default. #: bottle's URL instead of Homebrew's default.
#: #:
#: If `--or-later` is passed, append _or_later to the bottle tag. #: If `--or-later` is passed, append `_or_later` to the bottle tag.
#: #:
#: If `--force-core-tap` is passed, build a bottle even if <formula> is not #: If `--force-core-tap` is passed, build a bottle even if <formula> is not
#: in homebrew/core or any installed taps. #: in homebrew/core or any installed taps.
@ -74,11 +74,11 @@ module Homebrew
usage_banner <<~EOS usage_banner <<~EOS
`bottle` [<options>] <formulae>: `bottle` [<options>] <formulae>:
Generate a bottle (binary package) from a formula installed with Generate a bottle (binary package) from a formula that was installed with
`--build-bottle`. `--build-bottle`.
If the formula specifies a rebuild version, it will be incremented in the If the formula specifies a rebuild version, it will be incremented in the
generated DSL. Passing `--keep-old` will attempt to keep it at its generated DSL. Passing `--keep-old` will attempt to keep it at its original
original value, while `--no-rebuild` will remove it. value, while `--no-rebuild` will remove it.
EOS EOS
switch "--skip-relocation", switch "--skip-relocation",
description: "Do not check if the bottle can be marked as relocatable." description: "Do not check if the bottle can be marked as relocatable."
@ -87,28 +87,30 @@ module Homebrew
switch "--force-core-tap", switch "--force-core-tap",
description: "Build a bottle even if <formula> is not in homebrew/core or any installed taps." description: "Build a bottle even if <formula> is not in homebrew/core or any installed taps."
switch "--no-rebuild", switch "--no-rebuild",
description: "If the formula specifies a rebuild version, it will be removed in the generated DSL." description: "If the formula specifies a rebuild version, remove it from the generated DSL."
switch "--keep-old", switch "--keep-old",
description: "If the formula specifies a rebuild version, it will attempted to be kept in the "\ description: "If the formula specifies a rebuild version, attempt to preserve its value in the "\
"generated DSL." "generated DSL."
switch "--merge",
description: "Generate a bottle from a formula and print the new DSL merged into the "\
"existing formula."
switch "--write",
description: "Changes will be written to the formula file. A new commit will be generated unless "\
"`--no-commit` is passed."
switch "--no-commit",
description: "When passed with `--write`, a new commit will not generated while writing changes "\
"to the formula file.",
depends_on: "--write"
switch "--json", switch "--json",
description: "Write bottle information to a JSON file, which can be used as the argument for "\ description: "Write bottle information to a JSON file, which can be used as the argument for "\
"`--merge`." "`--merge`."
switch "--merge",
description: "Generate an updated bottle block for a formula and optionally merge it into the "\
"formula file. Instead of a formula name, requires a JSON file generated with "\
"`brew bottle --json` <formula>."
switch "--write",
depends_on: "--merge",
description: "Write the changes to the formula file. A new commit will be generated unless "\
"`--no-commit` is passed."
switch "--no-commit",
depends_on: "--write",
description: "When passed with `--write`, a new commit will not generated after writing changes "\
"to the formula file."
flag "--root-url", flag "--root-url",
description: "Use the specified <URL> as the root of the bottle's URL instead of Homebrew's "\ description: "Use the specified <URL> as the root of the bottle's URL instead of Homebrew's default."
"default."
switch :verbose switch :verbose
switch :debug switch :debug
conflicts "--no-rebuild", "--keep-old"
end end
end end
@ -228,7 +230,7 @@ module Homebrew
unless tap = f.tap unless tap = f.tap
unless args.force_core_tap? unless args.force_core_tap?
return ofail "Formula not from core or any taps: #{f.full_name}" return ofail "Formula not from core or any installed taps: #{f.full_name}"
end end
tap = CoreTap.instance tap = CoreTap.instance

View File

@ -1,11 +1,11 @@
#: * `bump-formula-pr` [`--devel`] [`--dry-run` [`--write`]] [`--audit`|`--strict`] [`--mirror=`<URL>] [`--version=`<version>] [`--message=`<message>] (`--url=`<URL> `--sha256=`<sha-256>|`--tag=`<tag> `--revision=`<revision>) <formula>: #: * `bump-formula-pr` [`--devel`] [`--dry-run` [`--write`]] [`--audit`|`--strict`] [`--no-browse] [`--mirror=`<URL>] [`--version=`<version>] [`--message=`<message>] (`--url=`<URL> `--sha256=`<SHA-256>|`--tag=`<tag> `--revision=`<revision>) [<formula>]:
#: Creates a pull request to update the formula with a new URL or a new tag. #: Create a pull request to update a formula with a new URL or a new tag.
#: #:
#: If a <URL> is specified, the <sha-256> checksum of the new download must #: If a <URL> is specified, the <SHA-256> checksum of the new download should
#: also be specified. A best effort to determine the <sha-256> and <formula> #: also be specified. A best effort to determine the <SHA-256> and <formula>
#: name will be made if either or both values are not supplied by the user. #: name will be made if either or both values are not supplied by the user.
#: #:
#: If a <tag> is specified, the git commit <revision> corresponding to that #: If a <tag> is specified, the Git commit <revision> corresponding to that
#: tag must also be specified. #: tag must also be specified.
#: #:
#: If `--devel` is passed, bump the development rather than stable version. #: If `--devel` is passed, bump the development rather than stable version.
@ -13,8 +13,8 @@
#: #:
#: If `--dry-run` is passed, print what would be done rather than doing it. #: If `--dry-run` is passed, print what would be done rather than doing it.
#: #:
#: If `--write` is passed along with `--dry-run`, perform a not-so-dry run #: If `--write` is passed along with `--dry-run`, perform a not-so-dry run by
#: making the expected file modifications but not taking any git actions. #: making the expected file modifications but not taking any Git actions.
#: #:
#: If `--audit` is passed, run `brew audit` before opening the PR. #: If `--audit` is passed, run `brew audit` before opening the PR.
#: #:
@ -24,7 +24,7 @@
#: #:
#: If `--version=`<version> is passed, use the value to override the value #: If `--version=`<version> is passed, use the value to override the value
#: parsed from the URL or tag. Note that `--version=0` can be used to delete #: parsed from the URL or tag. Note that `--version=0` can be used to delete
#: an existing `version` override from a formula if it has become redundant. #: an existing version override from a formula if it has become redundant.
#: #:
#: If `--message=`<message> is passed, append <message> to the default PR #: If `--message=`<message> is passed, append <message> to the default PR
#: message. #: message.
@ -36,8 +36,8 @@
#: If `--quiet` is passed, don't output replacement messages or warn about #: If `--quiet` is passed, don't output replacement messages or warn about
#: duplicate pull requests. #: duplicate pull requests.
#: #:
#: Note that this command cannot be used to transition a formula from a #: *Note:* this command cannot be used to transition a formula from a
#: URL-and-sha256 style specification into a tag-and-revision style #: URL-and-SHA-256 style specification into a tag-and-revision style
#: specification, nor vice versa. It must use whichever style specification #: specification, nor vice versa. It must use whichever style specification
#: the preexisting formula already uses. #: the preexisting formula already uses.
@ -50,57 +50,58 @@ module Homebrew
def bump_formula_pr_args def bump_formula_pr_args
Homebrew::CLI::Parser.new do Homebrew::CLI::Parser.new do
usage_banner <<~EOS usage_banner <<~EOS
`bump-formula-pr` [<options>] <formula>: `bump-formula-pr` [<options>] [<formula>]:
Creates a pull request to update the formula with a new URL or a new tag. Create a pull request to update a formula with a new URL or a new tag.
If a <URL> is specified, the <sha-256> checksum of the new download must If a <URL> is specified, the <SHA-256> checksum of the new download should also
also be specified. A best effort to determine the <sha-256> and <formula> be specified. A best effort to determine the <SHA-256> and <formula> name will
name will be made if either or both values are not supplied by the user. be made if either or both values are not supplied by the user.
If a <tag> is specified, the git commit <revision> corresponding to that If a <tag> is specified, the Git commit <revision> corresponding to that tag
tag must also be specified. must also be specified.
Note that this command cannot be used to transition a formula from a *Note:* this command cannot be used to transition a formula from a
URL-and-sha256 style specification into a tag-and-revision style URL-and-SHA-256 style specification into a tag-and-revision style specification,
specification, nor vice versa. It must use whichever style specification nor vice versa. It must use whichever style specification the preexisting
the preexisting formula already uses. formula already uses.
EOS EOS
switch "--devel", switch "--devel",
description: "Bump the development rather than stable version. The development spec must already exist." description: "Bump the development rather than stable version. The development spec must already exist."
switch "-n", "--dry-run", switch "-n", "--dry-run",
description: "Print what would be done rather than doing it." description: "Print what would be done rather than doing it."
switch "--write", switch "--write",
description: "When passed along with `--dry-run`, perform a not-so-dry run making the expected "\ depends_on: "--dry-run",
"file modifications but not taking any git actions." description: "When passed along with `--dry-run`, perform a not-so-dry run by making the expected "\
"file modifications but not taking any Git actions."
switch "--audit", switch "--audit",
description: "Run `brew audit` before opening the PR." description: "Run `brew audit` before opening the PR."
switch "--strict", switch "--strict",
description: "Run `brew audit --strict` before opening the PR." description: "Run `brew audit --strict` before opening the PR."
switch "--no-browse", switch "--no-browse",
description: "Output the pull request URL instead of opening in a browser" description: "Print the pull request URL instead of opening in a browser."
flag "--url=",
description: "Provide new <URL> for the formula. If a <URL> is specified, the <sha-256> "\
"checksum of the new download must also be specified."
flag "--revision=",
description: "Specify the new git commit <revision> corresponding to a specified <tag>."
flag "--tag=",
required_for: "--revision=",
description: "Specify the new git commit <tag> for the formula."
flag "--sha256=",
depends_on: "--url=",
description: "Specify the <sha-256> checksum of new download."
flag "--mirror=", flag "--mirror=",
description: "Use the provided <URL> as a mirror URL." description: "Use the provided <URL> as a mirror URL."
flag "--version=", flag "--version=",
description: "Use the provided <version> to override the value parsed from the URL or tag. Note "\ description: "Use the provided <version> to override the value parsed from the URL or tag. Note "\
"that `--version=0` can be used to delete an existing `version` override from a "\ "that `--version=0` can be used to delete an existing version override from a "\
"formula if it has become redundant." "formula if it has become redundant."
flag "--message=", flag "--message=",
description: "Append provided <message> to the default PR message." description: "Append the provided <message> to the default PR message."
flag "--url=",
description: "Specify the <URL> for the new download. If a <URL> is specified, the <SHA-256> "\
"checksum of the new download should also be specified."
flag "--sha256=",
depends_on: "--url=",
description: "Specify the <SHA-256> checksum of the new download."
flag "--tag=",
description: "Specify the new git commit <tag> for the formula."
flag "--revision=",
required_for: "--tag=",
description: "Specify the new git commit <revision> corresponding to a specified <tag>."
switch :quiet
switch :force switch :force
switch :quiet
switch :verbose switch :verbose
switch :debug switch :debug
conflicts "--url", "--tag" conflicts "--url", "--tag"
@ -352,7 +353,7 @@ module Homebrew
"#{new_formula_version}#{devel_message}' -- #{formula.path}" "#{new_formula_version}#{devel_message}' -- #{formula.path}"
ohai "git push --set-upstream $HUB_REMOTE #{branch}:#{branch}" ohai "git push --set-upstream $HUB_REMOTE #{branch}:#{branch}"
ohai "create pull request with GitHub API" ohai "create pull request with GitHub API"
ohai "git checkout -" ohai "git checkout --quiet -"
else else
begin begin

View File

@ -1,17 +1,17 @@
#: * `create` <URL> [`--autotools`|`--cmake`|`--meson`] [`--no-fetch`] [`--set-name` <name>] [`--set-version` <version>] [`--tap` <user>`/`<repo>]: #: * `create` [`--autotools`|`--cmake`|`--meson`] [`--no-fetch`] [`--set-name` <name>] [`--set-version` <version>] [`--tap` <user>`/`<repo>] <URL>:
#: Generate a formula for the downloadable file at <URL> and open it in the editor. #: Generate a formula for the downloadable file at <URL> and open it in the editor.
#: Homebrew will attempt to automatically derive the formula name #: Homebrew will attempt to automatically derive the formula name
#: and version, but if it fails, you'll have to make your own template. The `wget` #: and version, but if it fails, you'll have to make your own template. The `wget`
#: formula serves as a simple example. For the complete API have a look at #: formula serves as a simple example. For the complete API, see:
#: <https://www.rubydoc.info/github/Homebrew/brew/master/Formula>. #: <https://www.rubydoc.info/github/Homebrew/brew/master/Formula>
#: #:
#: If `--autotools` is passed, create a basic template for an Autotools-style build. #: If `--autotools` is passed, create a basic template for an Autotools-style build.
#: If `--cmake` is passed, create a basic template for a CMake-style build. #: If `--cmake` is passed, create a basic template for a CMake-style build.
#: If `--meson` is passed, create a basic template for a Meson-style build. #: If `--meson` is passed, create a basic template for a Meson-style build.
#: #:
#: If `--no-fetch` is passed, Homebrew will not download <URL> to the cache and #: If `--no-fetch` is passed, Homebrew will not download <URL> to the cache and
#: will thus not add the SHA256 to the formula for you. It will also not check #: will thus not add the SHA-256 to the formula for you, nor will it check
#: the GitHub API for GitHub projects (to fill out the description and homepage). #: the GitHub API for GitHub projects (to fill out its description and homepage).
#: #:
#: The options `--set-name` and `--set-version` each take an argument and allow #: The options `--set-name` and `--set-version` each take an argument and allow
#: you to explicitly set the name and version of the package you are creating. #: you to explicitly set the name and version of the package you are creating.
@ -30,13 +30,13 @@ module Homebrew
def create_args def create_args
Homebrew::CLI::Parser.new do Homebrew::CLI::Parser.new do
usage_banner <<~EOS usage_banner <<~EOS
`create` <URL> [<options>]: `create` [<options>] <URL>:
Generate a formula for the downloadable file at <URL> and open it in the editor. Generate a formula for the downloadable file at <URL> and open it in the editor.
Homebrew will attempt to automatically derive the formula name Homebrew will attempt to automatically derive the formula name and version, but
and version, but if it fails, you'll have to make your own template. The `wget` if it fails, you'll have to make your own template. The `wget` formula serves as
formula serves as a simple example. For the complete API have a look at a simple example. For the complete API, see:
<http://www.rubydoc.info/github/Homebrew/brew/master/Formula>. <http://www.rubydoc.info/github/Homebrew/brew/master/Formula>
EOS EOS
switch "--autotools", switch "--autotools",
description: "Create a basic template for an Autotools-style build." description: "Create a basic template for an Autotools-style build."
@ -45,17 +45,17 @@ module Homebrew
switch "--meson", switch "--meson",
description: "Create a basic template for a Meson-style build." description: "Create a basic template for a Meson-style build."
switch "--no-fetch", switch "--no-fetch",
description: "Homebrew will not download <URL> to the cache and will thus not add the SHA256 to "\ description: "Homebrew will not download <URL> to the cache and will thus not add the SHA-256 "\
"the formula for you. It will also not check the GitHub API for GitHub projects "\ "to the formula for you, nor will it check the GitHub API for GitHub projects "\
"(to fill out the description and homepage)." "(to fill out its description and homepage)."
switch "--HEAD" switch "--HEAD",
description: "Indicate that <URL> points to the package's repository rather than a file."
flag "--set-name=", flag "--set-name=",
description: "Set the provided name of the package you are creating." description: "Set the name of the new formula to the provided <name>."
flag "--set-version=", flag "--set-version=",
description: "Set the provided version of the package you are creating." description: "Set the version of the new formula to the provided <version>."
flag "--tap=", flag "--tap=",
description: "Takes a tap [<user>`/`<repo>] as argument and generates the formula in the "\ description: "Generate the new formula in the provided tap, specified as <user>`/`<repo>."
"specified tap."
switch :force switch :force
switch :verbose switch :verbose
switch :debug switch :debug

View File

@ -1,8 +1,8 @@
#: * `edit`: #: * `edit`:
#: Open all of Homebrew for editing. #: Open the Homebrew repository for editing.
#: #:
#: * `edit` <formula>: #: * `edit` <formula>:
#: Open <formula> in the editor. #: Open <formula> in the editor set by `EDITOR` or `HOMEBREW_EDITOR`.
require "formula" require "formula"
require "cli_parser" require "cli_parser"
@ -13,9 +13,10 @@ module Homebrew
def edit_args def edit_args
Homebrew::CLI::Parser.new do Homebrew::CLI::Parser.new do
usage_banner <<~EOS usage_banner <<~EOS
`edit` <formula>: `edit` [<formulae>]:
Open <formula> in the editor. Open all of Homebrew for editing if
no <formula> is provided. Open a formula in the editor set by `EDITOR` or `HOMEBREW_EDITOR`, or open the
Homebrew repository for editing if no <formula> is provided.
EOS EOS
switch :force switch :force
switch :verbose switch :verbose
@ -29,7 +30,7 @@ module Homebrew
unless (HOMEBREW_REPOSITORY/".git").directory? unless (HOMEBREW_REPOSITORY/".git").directory?
raise <<~EOS raise <<~EOS
Changes will be lost! Changes will be lost!
The first time you `brew update', all local changes will be lost, you should The first time you `brew update', all local changes will be lost; you should
thus `brew update' before you `brew edit'! thus `brew update' before you `brew edit'!
EOS EOS
end end

View File

@ -1,7 +1,7 @@
#: * `extract` [`--force`] <formula> <tap> [`--version=`<version>]: #: * `extract` [`--force`] <formula> <tap> [`--version=`<version>]:
#: Looks through repository history to find the <version> of <formula> and #: Look through repository history to find the most recent version of <formula> and
#: creates a copy in <tap>/Formula/<formula>@<version>.rb. If the tap is #: create a copy in <tap>`/Formula/`<formula>`@`<version>`.rb`. If the tap is
#: not installed yet, attempts to install/clone the tap before continuing. #: not installed yet, attempt to install/clone the tap before continuing.
#: #:
#: If `--force` is passed, the file at the destination will be overwritten #: If `--force` is passed, the file at the destination will be overwritten
#: if it already exists. Otherwise, existing files will be preserved. #: if it already exists. Otherwise, existing files will be preserved.
@ -101,16 +101,15 @@ module Homebrew
usage_banner <<~EOS usage_banner <<~EOS
`extract` [<options>] <formula> <tap>: `extract` [<options>] <formula> <tap>:
Looks through repository history to find the <version> of <formula> and Look through repository history to find the most recent version of <formula> and
creates a copy in <tap>/Formula/<formula>@<version>.rb. If the tap is create a copy in <tap>`/Formula/`<formula>`@`<version>`.rb`. If the tap is not
not installed yet, attempts to install/clone the tap before continuing. installed yet, attempt to install/clone the tap before continuing.
EOS EOS
flag "--version=", flag "--version=",
description: "Provided <version> of <formula> will be extracted and placed in the destination "\ description: "Extract the provided <version> of <formula> instead of the most recent."
"tap. Otherwise, the most recent version that can be found will be used."
switch :debug
switch :force switch :force
switch :debug
end end
end end
@ -128,7 +127,7 @@ module Homebrew
repo = CoreTap.instance.path repo = CoreTap.instance.path
# Formulae can technically live in "<repo>/<formula>.rb" or # Formulae can technically live in "<repo>/<formula>.rb" or
# "<repo>/Formula/<formula>.rb", but explicitly use the latter for now # "<repo>/Formula/<formula>.rb", but explicitly use the latter for now
# since that is now core tap is structured. # since that is how the core tap is structured.
file = repo/"Formula/#{name}.rb" file = repo/"Formula/#{name}.rb"
if args.version if args.version
@ -175,7 +174,7 @@ module Homebrew
odie <<~EOS odie <<~EOS
Destination formula already exists: #{path} Destination formula already exists: #{path}
To overwrite it and continue anyways, run: To overwrite it and continue anyways, run:
`brew extract #{name} --version=#{version} --tap=#{destination_tap.name} --force` brew extract --force --version=#{version} #{name} #{destination_tap.name}
EOS EOS
end end
ohai "Overwriting existing formula at #{path}" if ARGV.debug? ohai "Overwriting existing formula at #{path}" if ARGV.debug?

View File

@ -1,5 +1,5 @@
#: * `formula` <formula>: #: * `formula` <formulae>:
#: Display the path where <formula> is located. #: Display the path where a formula is located.
require "formula" require "formula"
require "cli_parser" require "cli_parser"
@ -10,12 +10,12 @@ module Homebrew
def formula_args def formula_args
Homebrew::CLI::Parser.new do Homebrew::CLI::Parser.new do
usage_banner <<~EOS usage_banner <<~EOS
`formula` <formula>: `formula` <formulae>:
Display the path where <formula> is located. Display the path where a formula is located.
EOS EOS
switch :debug
switch :verbose switch :verbose
switch :debug
end end
end end

View File

@ -2,8 +2,9 @@
#: Enter the interactive Homebrew Ruby shell. #: Enter the interactive Homebrew Ruby shell.
#: #:
#: If `--examples` is passed, several examples will be shown. #: If `--examples` is passed, several examples will be shown.
#: If `--pry` is passed or HOMEBREW_PRY is set, pry will be #:
#: used instead of irb. #: If `--pry` is passed or `HOMEBREW_PRY` is set, Pry will be
#: used instead of IRB.
require "cli_parser" require "cli_parser"
@ -33,7 +34,7 @@ module Homebrew
description: "Show several examples." description: "Show several examples."
switch "--pry", switch "--pry",
env: :pry, env: :pry,
description: "Pry will be used instead of irb if `--pry` is passed or HOMEBREW_PRY is set." description: "Use Pry instead of IRB. Implied if `HOMEBREW_PRY` is set."
end end
end end

View File

@ -1,14 +1,12 @@
#: * `linkage` [`--test`] [`--reverse`] [<formulae>]: #: * `linkage` [`--test`] [`--reverse`] [<formulae>]:
#: Checks the library links of installed formulae. #: Check the library links for kegs of installed formulae.
#: #: Raises an error if run on uninstalled formulae.
#: Only works on installed formulae. An error is raised if it is run on
#: uninstalled formulae.
#: #:
#: If `--test` is passed, only display missing libraries and exit with a #: If `--test` is passed, only display missing libraries and exit with a
#: non-zero exit code if any missing libraries were found. #: non-zero status if any missing libraries are found.
#: #:
#: If `--reverse` is passed, print the dylib followed by the binaries #: If `--reverse` is passed, for every library that a keg references,
#: which link to it for each library the keg references. #: print its dylib path followed by the binaries that link to it.
#: #:
#: If <formulae> are given, check linkage for only the specified brews. #: If <formulae> are given, check linkage for only the specified brews.
@ -22,21 +20,19 @@ module Homebrew
def linkage_args def linkage_args
Homebrew::CLI::Parser.new do Homebrew::CLI::Parser.new do
usage_banner <<~EOS usage_banner <<~EOS
`linkage` [<options>] <formula>: `linkage` [<options>] [<formulae>]:
Checks the library links of an installed formula. Check the library links for kegs of installed formulae.
Raises an error if run on uninstalled formulae.
Only works on installed formulae. An error is raised if it is run on
uninstalled formulae.
EOS EOS
switch "--test", switch "--test",
description: "Display only missing libraries and exit with a non-zero exit code if any missing "\ description: "Display only missing libraries and exit with a non-zero status if any missing "\
"libraries were found." "libraries are found."
switch "--reverse", switch "--reverse",
description: "Print the dylib followed by the binaries which link to it for each library the keg "\ description: "For every library that a keg references, print its dylib path followed by the "\
"references." "binaries that link to it."
switch "--cached", switch "--cached",
description: "Print the cached linkage values stored in HOMEBREW_CACHE, set from a previous "\ description: "Print the cached linkage values stored in `HOMEBREW_CACHE`, set by a previous "\
"`brew linkage` run." "`brew linkage` run."
switch :verbose switch :verbose
switch :debug switch :debug

View File

@ -47,7 +47,7 @@ module Homebrew
"the date used in new manpages will match those in the existing manpages (to allow "\ "the date used in new manpages will match those in the existing manpages (to allow "\
"comparison without factoring in the date)." "comparison without factoring in the date)."
switch "--link", switch "--link",
description: "It is now done automatically by `brew update`." description: "This is now done automatically by `brew update`."
end end
end end

View File

@ -14,15 +14,15 @@ module Homebrew
Reuploads the stable URL for a formula to Bintray to use it as a mirror. Reuploads the stable URL for a formula to Bintray to use it as a mirror.
EOS EOS
switch :debug
switch :verbose switch :verbose
switch :debug
end end
end end
def mirror def mirror
mirror_args.parse mirror_args.parse
odie "This command requires at least formula argument!" if ARGV.named.empty? odie "This command requires at least one formula argument!" if ARGV.named.empty?
bintray_user = ENV["HOMEBREW_BINTRAY_USER"] bintray_user = ENV["HOMEBREW_BINTRAY_USER"]
bintray_key = ENV["HOMEBREW_BINTRAY_KEY"] bintray_key = ENV["HOMEBREW_BINTRAY_KEY"]

View File

@ -1,6 +1,6 @@
#: * `pull` [`--bottle`] [`--bump`] [`--clean`] [`--ignore-whitespace`] [`--resolve`] [`--branch-okay`] [`--no-pbcopy`] [`--no-publish`] [`--warn-on-publish-failure`] [`--bintray-org=`<bintray-org>] [`--test-bot-user=`<test-bot-user>] <patch-source> [<patch-source>]: #: * `pull` [`--bottle`] [`--bump`] [`--clean`] [`--ignore-whitespace`] [`--resolve`] [`--branch-okay`] [`--no-pbcopy`] [`--no-publish`] [`--warn-on-publish-failure`] [`--bintray-org=`<bintray-org>] [`--test-bot-user=`<test-bot-user>] <patch-source> [<patch-source>]:
#: Gets a patch from a GitHub commit or pull request and applies it to Homebrew. #: Get a patch from a GitHub commit or pull request and apply it to Homebrew.
#: Optionally, installs the formulae changed by the patch. #: Optionally, publish updated bottles for the formulae changed by the patch.
#: #:
#: Each <patch-source> may be one of: #: Each <patch-source> may be one of:
#: #:
@ -41,11 +41,11 @@
#: If `--warn-on-publish-failure` was passed, do not exit if there's a #: If `--warn-on-publish-failure` was passed, do not exit if there's a
#: failure publishing bottles on Bintray. #: failure publishing bottles on Bintray.
#: #:
#: If `--bintray-org=`<bintray-org> is passed, publish at the given Bintray #: If `--bintray-org=`<bintray-org> is passed, publish at the provided Bintray
#: organisation. #: organisation.
#: #:
#: If `--test-bot-user=`<test-bot-user> is passed, pull the bottle block #: If `--test-bot-user=`<test-bot-user> is passed, pull the bottle block
#: commit from the specified user on GitHub. #: commit from the provided user on GitHub.
require "net/http" require "net/http"
require "net/https" require "net/https"
@ -74,12 +74,12 @@ module Homebrew
def pull_args def pull_args
Homebrew::CLI::Parser.new do Homebrew::CLI::Parser.new do
usage_banner <<~EOS usage_banner <<~EOS
`pull` [<options>] <formula>: `pull` [<options>] <patch sources>:
Gets a patch from a GitHub commit or pull request and applies it to Homebrew. Get a patch from a GitHub commit or pull request and apply it to Homebrew.
Optionally, installs the formulae changed by the patch. Optionally, publish updated bottles for the formulae changed by the patch.
Each <patch-source> may be one of: Each <patch source> may be one of:
~ The ID number of a PR (pull request) in the homebrew/core GitHub ~ The ID number of a PR (pull request) in the homebrew/core GitHub
repository repository
@ -112,9 +112,9 @@ module Homebrew
switch "--warn-on-publish-failure", switch "--warn-on-publish-failure",
description: "Do not exit if there's a failure publishing bottles on Bintray." description: "Do not exit if there's a failure publishing bottles on Bintray."
flag "--bintray-org=", flag "--bintray-org=",
description: "Publish at the given Bintray organisation." description: "Publish bottles at the provided Bintray <organisation>."
flag "--test-bot-user=", flag "--test-bot-user=",
description: "Pull the bottle block commit from the specified user on GitHub." description: "Pull the bottle block commit from the provided <user> on GitHub."
switch :verbose switch :verbose
switch :debug switch :debug
end end

View File

@ -1,9 +1,9 @@
#: * `release-notes` [`--markdown`] [<previous_tag>] [<end_ref>]: #: * `release-notes` [`--markdown`] [<previous_tag>] [<end_ref>]:
#: Output the merged pull requests on Homebrew/brew between two Git refs. #: Print the merged pull requests on Homebrew/brew between two Git refs.
#: If no <previous_tag> is provided it defaults to the latest tag. #: If no <previous_tag> is provided it defaults to the latest tag.
#: If no <end_ref> is provided it defaults to `origin/master`. #: If no <end_ref> is provided it defaults to `origin/master`.
#: #:
#: If `--markdown` is passed, output as a Markdown list. #: If `--markdown` is passed, print as a Markdown list.
require "cli_parser" require "cli_parser"
@ -15,12 +15,12 @@ module Homebrew
usage_banner <<~EOS usage_banner <<~EOS
`release-notes` [<options>] [<previous_tag>] [<end_ref>]: `release-notes` [<options>] [<previous_tag>] [<end_ref>]:
Output the merged pull requests on Homebrew/brew between two Git refs. Print the merged pull requests on Homebrew/brew between two Git refs.
If no <previous_tag> is provided it defaults to the latest tag. If no <previous_tag> is provided it defaults to the latest tag.
If no <end_ref> is provided it defaults to `origin/master`. If no <end_ref> is provided it defaults to `origin/master`.
EOS EOS
switch "--markdown", switch "--markdown",
description: "Output as a Markdown list." description: "Print as a Markdown list."
end end
end end

View File

@ -7,23 +7,15 @@ require "cli_parser"
module Homebrew module Homebrew
module_function module_function
def write_path(tap, filename, content)
path = tap.path/filename
tap.path.mkpath
raise "#{path} already exists" if path.exist?
path.write content
end
def tap_new_args def tap_new_args
Homebrew::CLI::Parser.new do Homebrew::CLI::Parser.new do
usage_banner <<~EOS usage_banner <<~EOS
`tap-new` <user>/<repo>: `tap-new` <user>`/`<repo>:
Generate the template files for a new tap. Generate the template files for a new tap.
EOS EOS
switch :debug
switch :verbose switch :verbose
switch :debug
end end
end end
@ -84,4 +76,12 @@ module Homebrew
YAML YAML
write_path(tap, ".travis.yml", travis) write_path(tap, ".travis.yml", travis)
end end
def write_path(tap, filename, content)
path = tap.path/filename
tap.path.mkpath
raise "#{path} already exists" if path.exist?
path.write content
end
end end

View File

@ -1,6 +1,6 @@
#: * `tests` [`--verbose`] [`--coverage`] [`--generic`] [`--no-compat`] [`--only=`<test_script>[`:`<line_number>]] [`--seed=`<seed>] [`--online`] [`--official-cmd-taps`]: #: * `tests` [`--verbose`] [`--coverage`] [`--generic`] [`--no-compat`] [`--only=`<test_script>[`:`<line_number>]] [`--seed=`<seed>] [`--online`]:
#: Run Homebrew's unit and integration tests. If provided, #: Run Homebrew's unit and integration tests. If provided,
#: `--only=`<test_script> runs only <test_script>_spec.rb, and `--seed` #: `--only=`<test_script> runs only <test_script>`_spec.rb`, and `--seed`
#: randomizes tests with the provided value instead of a random seed. #: randomizes tests with the provided value instead of a random seed.
#: #:
#: If `--verbose` (or `-v`) is passed, print the command that runs the tests. #: If `--verbose` (or `-v`) is passed, print the command that runs the tests.
@ -26,9 +26,7 @@ module Homebrew
usage_banner <<~EOS usage_banner <<~EOS
`tests` [<options>]: `tests` [<options>]:
Run Homebrew's unit and integration tests. If provided, Run Homebrew's unit and integration tests.
`--only=`<test_script> runs only <test_script>_spec.rb, and `--seed`
randomizes tests with the provided value instead of a random seed.
EOS EOS
switch "--coverage", switch "--coverage",
description: "Generate code coverage reports." description: "Generate code coverage reports."
@ -40,9 +38,10 @@ module Homebrew
description: "Include tests that use the GitHub API and tests that use any of the taps for "\ description: "Include tests that use the GitHub API and tests that use any of the taps for "\
"official external commands." "official external commands."
flag "--only=", flag "--only=",
description: "Run only <test_script>_spec.rb" description: "Run only <test_script>`_spec.rb`. Appending `:`<line_number> will start at a "\
"specific line."
flag "--seed=", flag "--seed=",
description: "Randomizes tests with the provided value instead of a random seed." description: "Randomize tests with the provided <value> instead of a random seed."
switch :verbose switch :verbose
switch :debug switch :debug
end end

View File

@ -1,5 +1,5 @@
#: * `update-test` [`--commit=`<commit>] [`--before=`<date>] [`--to-tag`] [`--keep-tmp`]: #: * `update-test` [`--commit=`<commit>] [`--before=`<date>] [`--to-tag`] [`--keep-tmp`]:
#: Runs a test of `brew update` with a new repository clone. #: Run a test of `brew update` with a new repository clone.
#: #:
#: If no arguments are passed, use `origin/master` as the start commit. #: If no arguments are passed, use `origin/master` as the start commit.
#: #:
@ -24,8 +24,7 @@ module Homebrew
usage_banner <<~EOS usage_banner <<~EOS
`update-test` [<options>]: `update-test` [<options>]:
Runs a test of `brew update` with a new repository clone. Run a test of `brew update` with a new repository clone.
If no arguments are passed, use `origin/master` as the start commit. If no arguments are passed, use `origin/master` as the start commit.
EOS EOS
switch "--to-tag", switch "--to-tag",

View File

@ -8,7 +8,7 @@ describe "brew bottle", :integration_test do
(HOMEBREW_CELLAR/"patchelf/1.0/bin").mkpath (HOMEBREW_CELLAR/"patchelf/1.0/bin").mkpath
expect { brew "bottle", "--no-rebuild", testball } expect { brew "bottle", "--no-rebuild", testball }
.to output(/Formula not from core or any taps/).to_stderr .to output(/Formula not from core or any installed taps/).to_stderr
.and not_to_output.to_stdout .and not_to_output.to_stdout
.and be_a_failure .and be_a_failure