From 42c2ed5e7f1aa8adc719a095a753c248c0ecbee0 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 5 Sep 2016 21:31:34 +0100 Subject: [PATCH 01/13] brew.sh: set HOMEBREW_DEVELOPER from Git config. --- Library/Homebrew/brew.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index 1651e82624..5e36ac54a3 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -191,6 +191,16 @@ case "$HOMEBREW_COMMAND" in --config) HOMEBREW_COMMAND="config" ;; esac +if [[ -z "$HOMEBREW_DEVELOPER" ]] +then + export HOMEBREW_GIT_CONFIG_FILE="$HOMEBREW_REPOSITORY/.git/config" + HOMEBREW_GIT_CONFIG_DEVELOPERMODE="$(git config --file="$HOMEBREW_GIT_CONFIG_FILE" --get homebrew.developermode)" + if [[ "$HOMEBREW_GIT_CONFIG_DEVELOPERMODE" = "true" ]] + then + export HOMEBREW_DEVELOPER="1" + fi +fi + if [[ -f "$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh" ]] then HOMEBREW_BASH_COMMAND="$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh" From dd7ed0180787a393bd115f935ddf90bc24863a02 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 5 Sep 2016 21:32:18 +0100 Subject: [PATCH 02/13] brew.sh: don't restrict dev-cmd/*.sh to Homebrew developers. --- Library/Homebrew/brew.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index 5e36ac54a3..70a23a39c3 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -194,18 +194,23 @@ esac if [[ -z "$HOMEBREW_DEVELOPER" ]] then export HOMEBREW_GIT_CONFIG_FILE="$HOMEBREW_REPOSITORY/.git/config" - HOMEBREW_GIT_CONFIG_DEVELOPERMODE="$(git config --file="$HOMEBREW_GIT_CONFIG_FILE" --get homebrew.developermode)" + HOMEBREW_GIT_CONFIG_DEVELOPERMODE="$(git config --file="$HOMEBREW_GIT_CONFIG_FILE" --get homebrew.devcmdrun)" if [[ "$HOMEBREW_GIT_CONFIG_DEVELOPERMODE" = "true" ]] then - export HOMEBREW_DEVELOPER="1" + export HOMEBREW_DEV_CMD_RUN="1" fi fi if [[ -f "$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh" ]] then HOMEBREW_BASH_COMMAND="$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh" -elif [[ -n "$HOMEBREW_DEVELOPER" && -f "$HOMEBREW_LIBRARY/Homebrew/dev-cmd/$HOMEBREW_COMMAND.sh" ]] +elif [[ -f "$HOMEBREW_LIBRARY/Homebrew/dev-cmd/$HOMEBREW_COMMAND.sh" ]] then + if [[ -z "$HOMEBREW_DEVELOPER" ]] + then + git config --file="$HOMEBREW_GIT_CONFIG_FILE" --replace-all homebrew.devcmdrun true + export HOMEBREW_DEV_CMD_RUN="1" + fi HOMEBREW_BASH_COMMAND="$HOMEBREW_LIBRARY/Homebrew/dev-cmd/$HOMEBREW_COMMAND.sh" fi From 60d3bf4eb9a9660be9515f784929cbbda2a1d5ff Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 5 Sep 2016 21:32:25 +0100 Subject: [PATCH 03/13] brew.rb: don't restrict dev-cmd/*.rb to Homebrew developers. --- Library/Homebrew/brew.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index 78c8ee5f5b..ee70350095 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -64,8 +64,13 @@ begin if cmd internal_cmd = require? HOMEBREW_LIBRARY_PATH.join("cmd", cmd) - if !internal_cmd && ARGV.homebrew_developer? + unless internal_cmd internal_cmd = require? HOMEBREW_LIBRARY_PATH.join("dev-cmd", cmd) + if internal_cmd && !ARGV.homebrew_developer? + safe_system "git", "config", "--file=#{HOMEBREW_REPOSITORY}/.git/config", + "--replace-all", "homebrew.devcmdrun", "true" + ENV["HOMEBREW_DEV_CMD_RUN"] = "1" + end end end From 691d57f59477a512df1a63a115be52bd09560d34 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 8 Sep 2016 20:44:18 +0100 Subject: [PATCH 04/13] update.sh: don't cleanup on update for developers. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We’re defining developers as people who have run a dev-cmd at least once. --- Library/Homebrew/cmd/update.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index ed51444c5c..c87c16a118 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -159,7 +159,7 @@ reset_on_interrupt() { git reset --hard "$INITIAL_REVISION" "${QUIET_ARGS[@]}" fi - if [[ -n "$HOMEBREW_DEVELOPER" ]] + if [[ -n "$HOMEBREW_NO_UPDATE_CLEANUP" ]] then pop_stash else @@ -243,7 +243,7 @@ EOS if [[ "$INITIAL_BRANCH" != "$UPSTREAM_BRANCH" && -n "$INITIAL_BRANCH" ]] then - if [[ -z "$HOMEBREW_DEVELOPER" ]] + if [[ -z "$HOMEBREW_NO_UPDATE_CLEANUP" ]] then echo "Checking out $UPSTREAM_BRANCH in $DIR..." echo "To checkout $INITIAL_BRANCH in $DIR run:" @@ -286,7 +286,7 @@ EOS trap '' SIGINT - if [[ -n "$HOMEBREW_DEVELOPER" ]] + if [[ -n "$HOMEBREW_NO_UPDATE_CLEANUP" ]] then if [[ "$INITIAL_BRANCH" != "$UPSTREAM_BRANCH" && -n "$INITIAL_BRANCH" ]] then @@ -335,6 +335,14 @@ EOS set -x fi + if [[ -z "$HOMEBREW_UPDATE_CLEANUP" ]] + then + if [[ -n "$HOMEBREW_DEVELOPER" || -n "$HOMEBREW_DEV_CMD_RUN" ]] + then + export HOMEBREW_NO_UPDATE_CLEANUP="1" + fi + fi + if [[ -z "$HOMEBREW_AUTO_UPDATE_SECS" ]] then HOMEBREW_AUTO_UPDATE_SECS="60" From 4f6bae46f9c0f7b713cdbb999318460135f423de Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 5 Sep 2016 21:32:58 +0100 Subject: [PATCH 05/13] cmd/*: don't restrict dev-cmd to Homebrew developers. --- Library/Homebrew/cmd/command.rb | 6 +----- Library/Homebrew/cmd/commands.rb | 2 +- Library/Homebrew/cmd/help.rb | 4 ++-- Library/Homebrew/test/test_commands.rb | 4 ---- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Library/Homebrew/cmd/command.rb b/Library/Homebrew/cmd/command.rb index 8c8a8c6990..bab0257c83 100644 --- a/Library/Homebrew/cmd/command.rb +++ b/Library/Homebrew/cmd/command.rb @@ -21,11 +21,7 @@ module Homebrew def internal_command_path(cmd) extensions = %w[rb sh] paths = extensions.map { |ext| HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.#{ext}" } - - if ARGV.homebrew_developer? - paths += extensions.map { |ext| HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.#{ext}" } - end - + paths += extensions.map { |ext| HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.#{ext}" } paths.find { |p| p.file? } end end diff --git a/Library/Homebrew/cmd/commands.rb b/Library/Homebrew/cmd/commands.rb index 52705c58a9..bb1e6fe4d0 100644 --- a/Library/Homebrew/cmd/commands.rb +++ b/Library/Homebrew/cmd/commands.rb @@ -8,7 +8,7 @@ module Homebrew def commands if ARGV.include? "--quiet" cmds = internal_commands + external_commands - cmds += internal_development_commands if ARGV.homebrew_developer? + cmds += internal_development_commands cmds += HOMEBREW_INTERNAL_COMMAND_ALIASES.keys if ARGV.include? "--include-aliases" puts_columns cmds.sort else diff --git a/Library/Homebrew/cmd/help.rb b/Library/Homebrew/cmd/help.rb index ac5fce5b75..eae08395da 100644 --- a/Library/Homebrew/cmd/help.rb +++ b/Library/Homebrew/cmd/help.rb @@ -72,11 +72,11 @@ module Homebrew def command_path(cmd) if File.exist?(HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.sh") HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.sh" - elsif ARGV.homebrew_developer? && File.exist?(HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.sh") + elsif File.exist?(HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.sh") HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.sh" elsif File.exist?(HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.rb") HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.rb" - elsif ARGV.homebrew_developer? && File.exist?(HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.rb") + elsif File.exist?(HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.rb") HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.rb" end end diff --git a/Library/Homebrew/test/test_commands.rb b/Library/Homebrew/test/test_commands.rb index b6dd5c2be9..4a24107a96 100644 --- a/Library/Homebrew/test/test_commands.rb +++ b/Library/Homebrew/test/test_commands.rb @@ -70,10 +70,6 @@ class CommandsTests < Homebrew::TestCase end def test_internal_dev_command_path - ARGV.stubs(:homebrew_developer?).returns false - assert_nil Homebrew.send(:internal_command_path, "rbdevcmd") - - ARGV.stubs(:homebrew_developer?).returns true assert_equal HOMEBREW_LIBRARY_PATH/"dev-cmd/rbdevcmd.rb", Homebrew.send(:internal_command_path, "rbdevcmd") assert_equal HOMEBREW_LIBRARY_PATH/"dev-cmd/shdevcmd.sh", From af8605ea4ba1d9856c055c8c76b447e030540e3f Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 5 Sep 2016 21:37:02 +0100 Subject: [PATCH 06/13] Move developer-focused commands to dev-cmd. --- Library/Homebrew/{cmd => dev-cmd}/audit.rb | 0 Library/Homebrew/{cmd => dev-cmd}/bottle.rb | 0 Library/Homebrew/{cmd => dev-cmd}/create.rb | 0 Library/Homebrew/{cmd => dev-cmd}/edit.rb | 0 Library/Homebrew/{cmd => dev-cmd}/man.rb | 0 Library/Homebrew/{cmd => dev-cmd}/pull.rb | 0 Library/Homebrew/{cmd => dev-cmd}/tap-readme.rb | 0 Library/Homebrew/{cmd => dev-cmd}/test.rb | 0 Library/Homebrew/{cmd => dev-cmd}/tests.rb | 0 Library/Homebrew/test/test_cmd_audit.rb | 2 +- 10 files changed, 1 insertion(+), 1 deletion(-) rename Library/Homebrew/{cmd => dev-cmd}/audit.rb (100%) rename Library/Homebrew/{cmd => dev-cmd}/bottle.rb (100%) rename Library/Homebrew/{cmd => dev-cmd}/create.rb (100%) rename Library/Homebrew/{cmd => dev-cmd}/edit.rb (100%) rename Library/Homebrew/{cmd => dev-cmd}/man.rb (100%) rename Library/Homebrew/{cmd => dev-cmd}/pull.rb (100%) rename Library/Homebrew/{cmd => dev-cmd}/tap-readme.rb (100%) rename Library/Homebrew/{cmd => dev-cmd}/test.rb (100%) rename Library/Homebrew/{cmd => dev-cmd}/tests.rb (100%) diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb similarity index 100% rename from Library/Homebrew/cmd/audit.rb rename to Library/Homebrew/dev-cmd/audit.rb diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb similarity index 100% rename from Library/Homebrew/cmd/bottle.rb rename to Library/Homebrew/dev-cmd/bottle.rb diff --git a/Library/Homebrew/cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb similarity index 100% rename from Library/Homebrew/cmd/create.rb rename to Library/Homebrew/dev-cmd/create.rb diff --git a/Library/Homebrew/cmd/edit.rb b/Library/Homebrew/dev-cmd/edit.rb similarity index 100% rename from Library/Homebrew/cmd/edit.rb rename to Library/Homebrew/dev-cmd/edit.rb diff --git a/Library/Homebrew/cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb similarity index 100% rename from Library/Homebrew/cmd/man.rb rename to Library/Homebrew/dev-cmd/man.rb diff --git a/Library/Homebrew/cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb similarity index 100% rename from Library/Homebrew/cmd/pull.rb rename to Library/Homebrew/dev-cmd/pull.rb diff --git a/Library/Homebrew/cmd/tap-readme.rb b/Library/Homebrew/dev-cmd/tap-readme.rb similarity index 100% rename from Library/Homebrew/cmd/tap-readme.rb rename to Library/Homebrew/dev-cmd/tap-readme.rb diff --git a/Library/Homebrew/cmd/test.rb b/Library/Homebrew/dev-cmd/test.rb similarity index 100% rename from Library/Homebrew/cmd/test.rb rename to Library/Homebrew/dev-cmd/test.rb diff --git a/Library/Homebrew/cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb similarity index 100% rename from Library/Homebrew/cmd/tests.rb rename to Library/Homebrew/dev-cmd/tests.rb diff --git a/Library/Homebrew/test/test_cmd_audit.rb b/Library/Homebrew/test/test_cmd_audit.rb index 1a52fa6283..57d4e754fd 100644 --- a/Library/Homebrew/test/test_cmd_audit.rb +++ b/Library/Homebrew/test/test_cmd_audit.rb @@ -2,7 +2,7 @@ require "testing_env" require "fileutils" require "pathname" require "formulary" -require "cmd/audit" +require "dev-cmd/audit" class FormulaTextTests < Homebrew::TestCase def setup From 86bfd36af27d4539ff4ac6247942856cb5015b2b Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 8 Sep 2016 20:46:18 +0100 Subject: [PATCH 07/13] Don't hide some (now) developer commands. --- Library/Homebrew/dev-cmd/bottle.rb | 1 - Library/Homebrew/dev-cmd/man.rb | 1 - Library/Homebrew/dev-cmd/pull.rb | 2 -- Library/Homebrew/dev-cmd/tap-readme.rb | 1 - Library/Homebrew/dev-cmd/tests.rb | 1 - Library/Homebrew/dev-cmd/update-test.rb | 1 - 6 files changed, 7 deletions(-) diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 1980fbe9d4..1ae44b7e67 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -1,4 +1,3 @@ -#: @hide_from_man_page #: * `bottle` [`--verbose`] [`--no-rebuild`] [`--keep-old`] [`--skip-relocation`] [`--root-url=`]: #: * `bottle` `--merge` [`--no-commit`] [`--keep-old`] [`--write`]: #: diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index 6754a15f26..9b2d601477 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -1,4 +1,3 @@ -#: @hide_from_man_page #: * `man`: #: Generate Homebrew's manpages. diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index 341eed34a8..e18bf1c2f5 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -1,10 +1,8 @@ -#: @hide_from_man_page #: `pull` [`--bottle`] [`--bump`] [`--clean`] [`--ignore-whitespace`] [`--resolve`] [`--branch-okay`] [`--no-pbcopy`] [`--no-publish`] [] #: #: Gets a patch from a GitHub commit or pull request and applies it to Homebrew. #: Optionally, installs the formulae changed by the patch. #: -#: #: Each may be one of: #: * The ID number of a PR (Pull Request) in the homebrew/core GitHub #: repository diff --git a/Library/Homebrew/dev-cmd/tap-readme.rb b/Library/Homebrew/dev-cmd/tap-readme.rb index ad115a53e9..f88d433894 100644 --- a/Library/Homebrew/dev-cmd/tap-readme.rb +++ b/Library/Homebrew/dev-cmd/tap-readme.rb @@ -1,4 +1,3 @@ -#: @hide_from_man_page #: * `tap_readme` [`-v`] : #: Generate the README.md file for a new tap. diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index be8f72aceb..bd845e4341 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -1,4 +1,3 @@ -#: @hide_from_man_page #: * `tests` [`-v`] [`--coverage`] [`--generic`] [`--no-compat`] [`--only=`] [`--seed` ] [`--trace`] [`--online`] [`--official-cmd-taps`]: #: Run Homebrew's unit and integration tests. diff --git a/Library/Homebrew/dev-cmd/update-test.rb b/Library/Homebrew/dev-cmd/update-test.rb index 1f8d0510ba..fe0b1bf4dd 100644 --- a/Library/Homebrew/dev-cmd/update-test.rb +++ b/Library/Homebrew/dev-cmd/update-test.rb @@ -1,4 +1,3 @@ -#: @hide_from_man_page #: * `update-test` [`--commit=`] [`--before=`] [`--keep-tmp`]: #: Runs a test of `brew update` with a new repository clone. #: From 71881fd7a66227738a654d98f04647d412c11980 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 5 Sep 2016 21:46:40 +0100 Subject: [PATCH 08/13] Add DEVELOPER COMMANDS to manpage. --- Library/Homebrew/dev-cmd/man.rb | 14 +- Library/Homebrew/manpages/brew.1.md.erb | 4 + share/doc/homebrew/brew.1.html | 208 ++++++++++++++------ share/man/man1/brew.1 | 244 +++++++++++++++++------- 4 files changed, 339 insertions(+), 131 deletions(-) diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index 9b2d601477..fdd4bf33de 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -33,11 +33,8 @@ module Homebrew convert_man_page(cask_markup, TARGET_MAN_PATH/"brew-cask.1") end - def build_man_page - template = (SOURCE_PATH/"brew.1.md.erb").read - variables = OpenStruct.new - - variables[:commands] = Pathname.glob("#{HOMEBREW_LIBRARY_PATH}/cmd/*.{rb,sh}"). + def path_glob_commands(glob) + Pathname.glob(glob). sort_by { |source_file| sort_key_for_path(source_file) }. map { |source_file| source_file.read.lines. @@ -46,7 +43,14 @@ module Homebrew join }. reject { |s| s.strip.empty? || s.include?("@hide_from_man_page") } + end + def build_man_page + template = (SOURCE_PATH/"brew.1.md.erb").read + variables = OpenStruct.new + + variables[:commands] = path_glob_commands("#{HOMEBREW_LIBRARY_PATH}/cmd/*.{rb,sh}") + variables[:developer_commands] = path_glob_commands("#{HOMEBREW_LIBRARY_PATH}/dev-cmd/*.{rb,sh}") variables[:maintainers] = (HOMEBREW_REPOSITORY/"README.md"). read[/Homebrew's current maintainers are (.*)\./, 1]. scan(/\[([^\]]*)\]/).flatten diff --git a/Library/Homebrew/manpages/brew.1.md.erb b/Library/Homebrew/manpages/brew.1.md.erb index 60557173de..d6828e9d03 100644 --- a/Library/Homebrew/manpages/brew.1.md.erb +++ b/Library/Homebrew/manpages/brew.1.md.erb @@ -50,6 +50,10 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note <%= commands.join("\n") %> +## DEVELOPER COMMANDS + +<%= developer_commands.join("\n") %> + ## EXTERNAL COMMANDS Homebrew, like `git`(1), supports external commands. These are executable diff --git a/share/doc/homebrew/brew.1.html b/share/doc/homebrew/brew.1.html index cd475a3132..25be33ef32 100644 --- a/share/doc/homebrew/brew.1.html +++ b/share/doc/homebrew/brew.1.html @@ -39,29 +39,6 @@ If no search term is given, all locally available formulae are listed.

Read more at https://git.io/brew-analytics.

analytics (on|off)

Turn on/off Homebrew's analytics.

analytics regenerate-uuid

Regenerate UUID used in Homebrew's analytics.

-
audit [--strict] [--online] [--new-formula] [--display-cop-names] [--display-filename] [formulae]

Check formulae for Homebrew coding style violations. This should be -run before submitting a new formula.

- -

If no formulae are provided, all of them are checked.

- -

If --strict is passed, additional checks are run, including RuboCop -style checks.

- -

If --online is passed, additional slower checks that require a network -connection are run.

- -

If --new-formula is passed, various additional checks are run that check -if a new formula is eligable for Homebrew. This should be used when creating -new formulae and implies --strict and --online.

- -

If --display-cop-names is passed, the RuboCop cop name for each violation -is included in the output.

- -

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.

- -

audit exits with a non-zero status if any errors are found. This is useful, -for instance, for implementing pre-commit hooks.

cat formula

Display the source to formula.

cleanup [--prune=days] [--dry-run] [-s] [formulae]

For all installed or specific formulae, remove any older versions from the cellar. In addition, old downloads from the Homebrew download-cache are deleted.

@@ -82,24 +59,6 @@ With --include-aliases, the aliases of internal commands will be in
config

Show Homebrew and system configuration useful for debugging. If you file a bug report, you will likely be asked for this information if you do not provide it.

-
create URL [--autotools|--cmake] [--no-fetch] [--set-name name] [--set-version version] [--tap user/repo]

Generate a formula for the downloadable file at URL and open it in the editor. -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 -formula serves as a simple example. For the complete API have a look at

- -

http://www.rubydoc.info/github/Homebrew/brew/master/Formula

- -

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 --no-fetch is passed, Homebrew will not download URL to the cache and -will thus not add the SHA256 to the formula for you.

- -

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.

- -

The option --tap takes a tap as its argument and generates the formula in -the specified tap.

deps [--1] [-n] [--union] [--full-name] [--installed] [--include-build] [--include-optional] [--skip-recommended] formulae

Show dependencies for formulae. When given multiple formula arguments, show the intersection of dependencies for formulae.

@@ -149,8 +108,6 @@ and allow you to explicitly set the name and version of the package you are installing.

doctor

Check your system for potential problems. Doctor exits with a non-zero status if any problems are found.

-
edit

Open all of Homebrew for editing.

-
edit formula

Open formula in the editor.

fetch [--force] [--retry] [-v] [--devel|--HEAD] [--deps] [--build-from-source|--force-bottle] formulae

Download the source packages for the given formulae. For tarballs, also print SHA-256 checksums.

@@ -395,21 +352,6 @@ for version is v1.

tap-pin tap

Pin tap, prioritizing its formulae over core when formula names are supplied by the user. See also tap-unpin.

tap-unpin tap

Unpin tap so its formulae are no longer prioritized. See also tap-pin.

-
test [--devel|--HEAD] [--debug] [--keep-tmp] formula

A few formulae provide a test method. brew test formula runs this -test method. There is no standard output or return code, but it should -generally indicate to the user if something is wrong with the installed -formula.

- -

To test the development or head version of a formula, use --devel or ---HEAD.

- -

If --debug is passed and the test fails, an interactive debugger will be -launched with access to IRB or a shell inside the temporary test directory.

- -

If --keep-tmp is passed, the temporary files created for the test are -not deleted.

- -

Example: brew install jruby && brew test jruby

uninstall, rm, remove [--force] formula

Uninstall formula.

If --force is passed, and there are multiple versions of formula @@ -494,6 +436,156 @@ the prefix and repository are the same directory.

< +

DEVELOPER COMMANDS

+ +
+
audit [--strict] [--online] [--new-formula] [--display-cop-names] [--display-filename] [formulae]

Check formulae for Homebrew coding style violations. This should be +run before submitting a new formula.

+ +

If no formulae are provided, all of them are checked.

+ +

If --strict is passed, additional checks are run, including RuboCop +style checks.

+ +

If --online is passed, additional slower checks that require a network +connection are run.

+ +

If --new-formula is passed, various additional checks are run that check +if a new formula is eligable for Homebrew. This should be used when creating +new formulae and implies --strict and --online.

+ +

If --display-cop-names is passed, the RuboCop cop name for each violation +is included in the output.

+ +

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.

+ +

audit exits with a non-zero status if any errors are found. This is useful, +for instance, for implementing pre-commit hooks.

+
bottle [--verbose] [--no-rebuild] [--keep-old] [--skip-relocation] [--root-url=<root_url>]:

+
bottle --merge [--no-commit] [--keep-old] [--write]:

+ +

Generate a bottle (binary package) from a formula installed with +--build-bottle.

+
bump-formula-pr [--devel] [--dry-run] [--audit|--strict] --url=url --sha256=sha-256 formula:

+
bump-formula-pr [--devel] [--dry-run] [--audit|--strict] --tag=tag --revision=revision formula

Creates a pull request to update the formula with a new url or a new tag.

+ +

If a url is specified, the sha-256 checksum of the new download must +also be specified.

+ +

If a tag is specified, the git commit revision corresponding to that +tag must also be specified.

+ +

If --devel is passed, bump the development rather than stable version. +The development spec must already exist.

+ +

If --dry-run is passed, print what would be done rather than doing it.

+ +

If --audit is passed, run brew audit before opening the PR.

+ +

If --strict is passed, run brew audit --strict before opening the PR.

+ +

Note that this command cannot be used to transition a formula from a +url-and-sha256 style specification into a tag-and-revision style +specification, nor vice versa. It must use whichever style specification +the preexisting formula already uses.

+
create URL [--autotools|--cmake] [--no-fetch] [--set-name name] [--set-version version] [--tap user/repo]

Generate a formula for the downloadable file at URL and open it in the editor. +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 +formula serves as a simple example. For the complete API have a look at

+ +

http://www.rubydoc.info/github/Homebrew/brew/master/Formula

+ +

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 --no-fetch is passed, Homebrew will not download URL to the cache and +will thus not add the SHA256 to the formula for you.

+ +

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.

+ +

The option --tap takes a tap as its argument and generates the formula in +the specified tap.

+
edit

Open all of Homebrew for editing.

+
edit formula

Open formula in the editor.

+
linkage [--test] [--reverse] formula-name

Checks the library links of an installed formula.

+ +

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 +non-zero exit code if any missing libraries were found.

+ +

If --reverse is passed, print the dylib followed by the binaries +which link to it for each library the keg references.

+
man

Generate Homebrew's manpages.

+
+ + +

pull [--bottle] [--bump] [--clean] [--ignore-whitespace] [--resolve] [--branch-okay] [--no-pbcopy] [--no-publish] patch-source [patch-source]

+ +
Gets a patch from a GitHub commit or pull request and applies it to Homebrew.
+Optionally, installs the formulae changed by the patch.
+
+Each <patch-source> may be one of:
+  * The ID number of a PR (Pull Request) in the homebrew/core GitHub
+    repository
+  * The URL of a PR on GitHub, using either the web page or API URL
+    formats. In this form, the PR may be on Homebrew/brew,
+    Homebrew/homebrew-core or any tap.
+  * The URL of a commit on GitHub
+  * A "http://bot.brew.sh/job/..." string specifying a testing job ID
+
+ +

If --bottle was passed, handle bottles, pulling the bottle-update + commit and publishing files on Bintray. + If --bump was passed, for one-formula PRs, automatically reword + commit message to our preferred format. + If --clean was passed, do not rewrite or otherwise modify the + commits found in the pulled PR. + If --ignore-whitespace was passed, silently ignore whitespace + discrepancies when applying diffs. + If --resolve was passed, when a patch fails to apply, leave in + progress and allow user to + resolve, instead of aborting. + If --branch-okay was passed, do not warn if pulling to a branch + besides master (useful for testing). + If --no-pbcopy was passed, do not copy anything to the system + If --no-publish was passed, do not publish bottles to Bintray.

+ +
+
tap_readme [-v] name

Generate the README.md file for a new tap.

+
test [--devel|--HEAD] [--debug] [--keep-tmp] formula

A few formulae provide a test method. brew test formula runs this +test method. There is no standard output or return code, but it should +generally indicate to the user if something is wrong with the installed +formula.

+ +

To test the development or head version of a formula, use --devel or +--HEAD.

+ +

If --debug is passed and the test fails, an interactive debugger will be +launched with access to IRB or a shell inside the temporary test directory.

+ +

If --keep-tmp is passed, the temporary files created for the test are +not deleted.

+ +

Example: brew install jruby && brew test jruby

+
tests [-v] [--coverage] [--generic] [--no-compat] [--only=] [--seed seed] [--trace] [--online] [--official-cmd-taps]

Run Homebrew's unit and integration tests.

+
update-test [--commit=<sha1>] [--before=<date>] [--keep-tmp]

Runs a test of brew update with a new repository clone.

+ +

If no arguments are passed, use origin/master as the start commit.

+ +

If --commit=<sha1> is passed, use <sha1> as the start commit.

+ +

If --before=<date> is passed, use the commit at <date> as the +start commit.

+ +

If --keep-tmp is passed, retain the temporary directory containing +the new repository clone.

+
+ +

EXTERNAL COMMANDS

Homebrew, like git(1), supports external commands. These are executable diff --git a/share/man/man1/brew.1 b/share/man/man1/brew.1 index 41ba07e6af..1877a39477 100644 --- a/share/man/man1/brew.1 +++ b/share/man/man1/brew.1 @@ -56,31 +56,6 @@ Turn on/off Homebrew\'s analytics\. Regenerate UUID used in Homebrew\'s analytics\. . .TP -\fBaudit\fR [\fB\-\-strict\fR] [\fB\-\-online\fR] [\fB\-\-new\-formula\fR] [\fB\-\-display\-cop\-names\fR] [\fB\-\-display\-filename\fR] [\fIformulae\fR] -Check \fIformulae\fR for Homebrew coding style violations\. This should be run before submitting a new formula\. -. -.IP -If no \fIformulae\fR are provided, all of them are checked\. -. -.IP -If \fB\-\-strict\fR is passed, additional checks are run, including RuboCop style checks\. -. -.IP -If \fB\-\-online\fR is passed, additional slower checks that require a network connection are run\. -. -.IP -If \fB\-\-new\-formula\fR is passed, various additional checks are run that check if a new formula is eligable for Homebrew\. This should be used when creating new formulae and implies \fB\-\-strict\fR and \fB\-\-online\fR\. -. -.IP -If \fB\-\-display\-cop\-names\fR is passed, the RuboCop cop name for each violation is included in the output\. -. -.IP -If \fB\-\-display\-filename\fR 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\. -. -.IP -\fBaudit\fR exits with a non\-zero status if any errors are found\. This is useful, for instance, for implementing pre\-commit hooks\. -. -.TP \fBcat\fR \fIformula\fR Display the source to \fIformula\fR\. . @@ -113,25 +88,6 @@ If \fB\-\-quiet\fR is passed, list only the names of commands without the header Show Homebrew and system configuration useful for debugging\. If you file a bug report, you will likely be asked for this information if you do not provide it\. . .TP -\fBcreate\fR \fIURL\fR [\fB\-\-autotools\fR|\fB\-\-cmake\fR] [\fB\-\-no\-fetch\fR] [\fB\-\-set\-name\fR \fIname\fR] [\fB\-\-set\-version\fR \fIversion\fR] [\fB\-\-tap\fR \fIuser\fR\fB/\fR\fIrepo\fR] -Generate a formula for the downloadable file at \fIURL\fR and open it in the editor\. Homebrew will attempt to automatically derive the formula name and version, but if it fails, you\'ll have to make your own template\. The \fBwget\fR formula serves as a simple example\. For the complete API have a look at -. -.IP -\fIhttp://www\.rubydoc\.info/github/Homebrew/brew/master/Formula\fR -. -.IP -If \fB\-\-autotools\fR is passed, create a basic template for an Autotools\-style build\. If \fB\-\-cmake\fR is passed, create a basic template for a CMake\-style build\. -. -.IP -If \fB\-\-no\-fetch\fR is passed, Homebrew will not download \fIURL\fR to the cache and will thus not add the SHA256 to the formula for you\. -. -.IP -The options \fB\-\-set\-name\fR and \fB\-\-set\-version\fR each take an argument and allow you to explicitly set the name and version of the package you are creating\. -. -.IP -The option \fB\-\-tap\fR takes a tap as its argument and generates the formula in the specified tap\. -. -.TP \fBdeps\fR [\fB\-\-1\fR] [\fB\-n\fR] [\fB\-\-union\fR] [\fB\-\-full\-name\fR] [\fB\-\-installed\fR] [\fB\-\-include\-build\fR] [\fB\-\-include\-optional\fR] [\fB\-\-skip\-recommended\fR] \fIformulae\fR Show dependencies for \fIformulae\fR\. When given multiple formula arguments, show the intersection of dependencies for \fIformulae\fR\. . @@ -193,14 +149,6 @@ The options \fB\-\-name=\fR\fIname\fR and \fB\-\-version=\fR\fIversion\fR each t Check your system for potential problems\. Doctor exits with a non\-zero status if any problems are found\. . .TP -\fBedit\fR -Open all of Homebrew for editing\. -. -.TP -\fBedit\fR \fIformula\fR -Open \fIformula\fR in the editor\. -. -.TP \fBfetch\fR [\fB\-\-force\fR] [\fB\-\-retry\fR] [\fB\-v\fR] [\fB\-\-devel\fR|\fB\-\-HEAD\fR] [\fB\-\-deps\fR] [\fB\-\-build\-from\-source\fR|\fB\-\-force\-bottle\fR] \fIformulae\fR Download the source packages for the given \fIformulae\fR\. For tarballs, also print SHA\-256 checksums\. . @@ -542,22 +490,6 @@ Pin \fItap\fR, prioritizing its formulae over core when formula names are suppli Unpin \fItap\fR so its formulae are no longer prioritized\. See also \fBtap\-pin\fR\. . .TP -\fBtest\fR [\fB\-\-devel\fR|\fB\-\-HEAD\fR] [\fB\-\-debug\fR] [\fB\-\-keep\-tmp\fR] \fIformula\fR -A few formulae provide a test method\. \fBbrew test\fR \fIformula\fR runs this test method\. There is no standard output or return code, but it should generally indicate to the user if something is wrong with the installed formula\. -. -.IP -To test the development or head version of a formula, use \fB\-\-devel\fR or \fB\-\-HEAD\fR\. -. -.IP -If \fB\-\-debug\fR is passed and the test fails, an interactive debugger will be launched with access to IRB or a shell inside the temporary test directory\. -. -.IP -If \fB\-\-keep\-tmp\fR is passed, the temporary files created for the test are not deleted\. -. -.IP -Example: \fBbrew install jruby && brew test jruby\fR -. -.TP \fBuninstall\fR, \fBrm\fR, \fBremove\fR [\fB\-\-force\fR] \fIformula\fR Uninstall \fIformula\fR\. . @@ -684,6 +616,182 @@ Display where tap \fIuser\fR\fB/\fR\fIrepo\fR\'s directory is located\. \fB\-\-version\fR Print the version number of Homebrew to standard output and exit\. . +.SH "DEVELOPER COMMANDS" +. +.TP +\fBaudit\fR [\fB\-\-strict\fR] [\fB\-\-online\fR] [\fB\-\-new\-formula\fR] [\fB\-\-display\-cop\-names\fR] [\fB\-\-display\-filename\fR] [\fIformulae\fR] +Check \fIformulae\fR for Homebrew coding style violations\. This should be run before submitting a new formula\. +. +.IP +If no \fIformulae\fR are provided, all of them are checked\. +. +.IP +If \fB\-\-strict\fR is passed, additional checks are run, including RuboCop style checks\. +. +.IP +If \fB\-\-online\fR is passed, additional slower checks that require a network connection are run\. +. +.IP +If \fB\-\-new\-formula\fR is passed, various additional checks are run that check if a new formula is eligable for Homebrew\. This should be used when creating new formulae and implies \fB\-\-strict\fR and \fB\-\-online\fR\. +. +.IP +If \fB\-\-display\-cop\-names\fR is passed, the RuboCop cop name for each violation is included in the output\. +. +.IP +If \fB\-\-display\-filename\fR 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\. +. +.IP +\fBaudit\fR exits with a non\-zero status if any errors are found\. This is useful, for instance, for implementing pre\-commit hooks\. +. +.TP +\fBbottle\fR [\fB\-\-verbose\fR] [\fB\-\-no\-rebuild\fR] [\fB\-\-keep\-old\fR] [\fB\-\-skip\-relocation\fR] [\fB\-\-root\-url=\fR]: + +. +.TP +\fBbottle\fR \fB\-\-merge\fR [\fB\-\-no\-commit\fR] [\fB\-\-keep\-old\fR] [\fB\-\-write\fR]: +. +.IP +Generate a bottle (binary package) from a formula installed with \fB\-\-build\-bottle\fR\. +. +.TP +\fBbump\-formula\-pr\fR [\fB\-\-devel\fR] [\fB\-\-dry\-run\fR] [\fB\-\-audit\fR|\fB\-\-strict\fR] \fB\-\-url=\fR\fIurl\fR \fB\-\-sha256=\fR\fIsha\-256\fR \fIformula\fR: + +. +.TP +\fBbump\-formula\-pr\fR [\fB\-\-devel\fR] [\fB\-\-dry\-run\fR] [\fB\-\-audit\fR|\fB\-\-strict\fR] \fB\-\-tag=\fR\fItag\fR \fB\-\-revision=\fR\fIrevision\fR \fIformula\fR +Creates a pull request to update the formula with a new url or a new tag\. +. +.IP +If a \fIurl\fR is specified, the \fIsha\-256\fR checksum of the new download must also be specified\. +. +.IP +If a \fItag\fR is specified, the git commit \fIrevision\fR corresponding to that tag must also be specified\. +. +.IP +If \fB\-\-devel\fR is passed, bump the development rather than stable version\. The development spec must already exist\. +. +.IP +If \fB\-\-dry\-run\fR is passed, print what would be done rather than doing it\. +. +.IP +If \fB\-\-audit\fR is passed, run \fBbrew audit\fR before opening the PR\. +. +.IP +If \fB\-\-strict\fR is passed, run \fBbrew audit \-\-strict\fR before opening the PR\. +. +.IP +Note that this command cannot be used to transition a formula from a url\-and\-sha256 style specification into a tag\-and\-revision style specification, nor vice versa\. It must use whichever style specification the preexisting formula already uses\. +. +.TP +\fBcreate\fR \fIURL\fR [\fB\-\-autotools\fR|\fB\-\-cmake\fR] [\fB\-\-no\-fetch\fR] [\fB\-\-set\-name\fR \fIname\fR] [\fB\-\-set\-version\fR \fIversion\fR] [\fB\-\-tap\fR \fIuser\fR\fB/\fR\fIrepo\fR] +Generate a formula for the downloadable file at \fIURL\fR and open it in the editor\. Homebrew will attempt to automatically derive the formula name and version, but if it fails, you\'ll have to make your own template\. The \fBwget\fR formula serves as a simple example\. For the complete API have a look at +. +.IP +\fIhttp://www\.rubydoc\.info/github/Homebrew/brew/master/Formula\fR +. +.IP +If \fB\-\-autotools\fR is passed, create a basic template for an Autotools\-style build\. If \fB\-\-cmake\fR is passed, create a basic template for a CMake\-style build\. +. +.IP +If \fB\-\-no\-fetch\fR is passed, Homebrew will not download \fIURL\fR to the cache and will thus not add the SHA256 to the formula for you\. +. +.IP +The options \fB\-\-set\-name\fR and \fB\-\-set\-version\fR each take an argument and allow you to explicitly set the name and version of the package you are creating\. +. +.IP +The option \fB\-\-tap\fR takes a tap as its argument and generates the formula in the specified tap\. +. +.TP +\fBedit\fR +Open all of Homebrew for editing\. +. +.TP +\fBedit\fR \fIformula\fR +Open \fIformula\fR in the editor\. +. +.TP +\fBlinkage\fR [\fB\-\-test\fR] [\fB\-\-reverse\fR] \fIformula\-name\fR +Checks the library links of an installed formula\. +. +.IP +Only works on installed formulae\. An error is raised if it is run on uninstalled formulae\. +. +.IP +If \fB\-\-test\fR is passed, only display missing libraries and exit with a non\-zero exit code if any missing libraries were found\. +. +.IP +If \fB\-\-reverse\fR is passed, print the dylib followed by the binaries which link to it for each library the keg references\. +. +.TP +\fBman\fR +Generate Homebrew\'s manpages\. +. +.P +\fBpull\fR [\fB\-\-bottle\fR] [\fB\-\-bump\fR] [\fB\-\-clean\fR] [\fB\-\-ignore\-whitespace\fR] [\fB\-\-resolve\fR] [\fB\-\-branch\-okay\fR] [\fB\-\-no\-pbcopy\fR] [\fB\-\-no\-publish\fR] \fIpatch\-source\fR [\fIpatch\-source\fR] +. +.IP "" 4 +. +.nf + +Gets a patch from a GitHub commit or pull request and applies it to Homebrew\. +Optionally, installs the formulae changed by the patch\. + +Each may be one of: + * The ID number of a PR (Pull Request) in the homebrew/core GitHub + repository + * The URL of a PR on GitHub, using either the web page or API URL + formats\. In this form, the PR may be on Homebrew/brew, + Homebrew/homebrew\-core or any tap\. + * The URL of a commit on GitHub + * A "http://bot\.brew\.sh/job/\.\.\." string specifying a testing job ID +. +.fi +. +.IP "" 0 +. +.P +If \fB\-\-bottle\fR was passed, handle bottles, pulling the bottle\-update commit and publishing files on Bintray\. If \fB\-\-bump\fR was passed, for one\-formula PRs, automatically reword commit message to our preferred format\. If \fB\-\-clean\fR was passed, do not rewrite or otherwise modify the commits found in the pulled PR\. If \fB\-\-ignore\-whitespace\fR was passed, silently ignore whitespace discrepancies when applying diffs\. If \fB\-\-resolve\fR was passed, when a patch fails to apply, leave in progress and allow user to resolve, instead of aborting\. If \fB\-\-branch\-okay\fR was passed, do not warn if pulling to a branch besides master (useful for testing)\. If \fB\-\-no\-pbcopy\fR was passed, do not copy anything to the system If \fB\-\-no\-publish\fR was passed, do not publish bottles to Bintray\. +. +.TP +\fBtap_readme\fR [\fB\-v\fR] \fIname\fR +Generate the README\.md file for a new tap\. +. +.TP +\fBtest\fR [\fB\-\-devel\fR|\fB\-\-HEAD\fR] [\fB\-\-debug\fR] [\fB\-\-keep\-tmp\fR] \fIformula\fR +A few formulae provide a test method\. \fBbrew test\fR \fIformula\fR runs this test method\. There is no standard output or return code, but it should generally indicate to the user if something is wrong with the installed formula\. +. +.IP +To test the development or head version of a formula, use \fB\-\-devel\fR or \fB\-\-HEAD\fR\. +. +.IP +If \fB\-\-debug\fR is passed and the test fails, an interactive debugger will be launched with access to IRB or a shell inside the temporary test directory\. +. +.IP +If \fB\-\-keep\-tmp\fR is passed, the temporary files created for the test are not deleted\. +. +.IP +Example: \fBbrew install jruby && brew test jruby\fR +. +.TP +\fBtests\fR [\fB\-v\fR] [\fB\-\-coverage\fR] [\fB\-\-generic\fR] [\fB\-\-no\-compat\fR] [\fB\-\-only=\fR] [\fB\-\-seed\fR \fIseed\fR] [\fB\-\-trace\fR] [\fB\-\-online\fR] [\fB\-\-official\-cmd\-taps\fR] +Run Homebrew\'s unit and integration tests\. +. +.TP +\fBupdate\-test\fR [\fB\-\-commit=\fR] [\fB\-\-before=\fR] [\fB\-\-keep\-tmp\fR] +Runs a test of \fBbrew update\fR with a new repository clone\. +. +.IP +If no arguments are passed, use \fBorigin/master\fR as the start commit\. +. +.IP +If \fB\-\-commit=\fR is passed, use \fB\fR as the start commit\. +. +.IP +If \fB\-\-before=\fR is passed, use the commit at \fB\fR as the start commit\. +. +.IP +If \fB\-\-keep\-tmp\fR is passed, retain the temporary directory containing the new repository clone\. +. .SH "EXTERNAL COMMANDS" Homebrew, like \fBgit\fR(1), supports external commands\. These are executable scripts that reside somewhere in the \fBPATH\fR, named \fBbrew\-\fR\fIcmdname\fR or \fBbrew\-\fR\fIcmdname\fR\fB\.rb\fR, which can be invoked like \fBbrew\fR \fIcmdname\fR\. This allows you to create your own commands without modifying Homebrew\'s internals\. . From 9514d1f8f522057a336eb1c3c5a48fb4206ebd84 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 7 Sep 2016 20:08:51 +0100 Subject: [PATCH 09/13] commands: developer not development commands. --- Library/Homebrew/cmd/commands.rb | 8 ++++---- Library/Homebrew/test/test_commands.rb | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/cmd/commands.rb b/Library/Homebrew/cmd/commands.rb index bb1e6fe4d0..b8407d6689 100644 --- a/Library/Homebrew/cmd/commands.rb +++ b/Library/Homebrew/cmd/commands.rb @@ -8,7 +8,7 @@ module Homebrew def commands if ARGV.include? "--quiet" cmds = internal_commands + external_commands - cmds += internal_development_commands + cmds += internal_developer_commands cmds += HOMEBREW_INTERNAL_COMMAND_ALIASES.keys if ARGV.include? "--include-aliases" puts_columns cmds.sort else @@ -19,8 +19,8 @@ module Homebrew # Find commands in Homebrew/dev-cmd if ARGV.homebrew_developer? puts - puts "Built-in development commands" - puts_columns internal_development_commands + puts "Built-in developer commands" + puts_columns internal_developer_commands end # Find commands in the path @@ -36,7 +36,7 @@ module Homebrew find_internal_commands HOMEBREW_LIBRARY_PATH/"cmd" end - def internal_development_commands + def internal_developer_commands find_internal_commands HOMEBREW_LIBRARY_PATH/"dev-cmd" end diff --git a/Library/Homebrew/test/test_commands.rb b/Library/Homebrew/test/test_commands.rb index 4a24107a96..88e35f416f 100644 --- a/Library/Homebrew/test/test_commands.rb +++ b/Library/Homebrew/test/test_commands.rb @@ -29,8 +29,8 @@ class CommandsTests < Homebrew::TestCase refute cmds.include?("rbdevcmd"), "Dev commands shouldn't be included" end - def test_internal_development_commands - cmds = Homebrew.internal_development_commands + def test_internal_developer_commands + cmds = Homebrew.internal_developer_commands assert cmds.include?("rbdevcmd"), "Ruby commands files should be recognized" assert cmds.include?("shdevcmd"), "Shell commands files should be recognized" refute cmds.include?("rbcmd"), "Non-dev commands shouldn't be included" From 0bb7fda143f3a609fdfed27e84422ff55f85db02 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 7 Sep 2016 20:09:08 +0100 Subject: [PATCH 10/13] commands: add commands module for path lookup. --- Library/Homebrew/commands.rb | 13 +++++++++++++ Library/Homebrew/test/test_commands.rb | 10 +++++----- 2 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 Library/Homebrew/commands.rb diff --git a/Library/Homebrew/commands.rb b/Library/Homebrew/commands.rb new file mode 100644 index 0000000000..caf356b438 --- /dev/null +++ b/Library/Homebrew/commands.rb @@ -0,0 +1,13 @@ +module Commands + def self.path(cmd) + if File.exist?(HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.sh") + HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.sh" + elsif File.exist?(HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.sh") + HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.sh" + elsif File.exist?(HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.rb") + HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.rb" + elsif File.exist?(HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.rb") + HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.rb" + end + end +end diff --git a/Library/Homebrew/test/test_commands.rb b/Library/Homebrew/test/test_commands.rb index 88e35f416f..c51e815590 100644 --- a/Library/Homebrew/test/test_commands.rb +++ b/Library/Homebrew/test/test_commands.rb @@ -63,16 +63,16 @@ class CommandsTests < Homebrew::TestCase def test_internal_command_path assert_equal HOMEBREW_LIBRARY_PATH/"cmd/rbcmd.rb", - Homebrew.send(:internal_command_path, "rbcmd") + Commands.path("rbcmd") assert_equal HOMEBREW_LIBRARY_PATH/"cmd/shcmd.sh", - Homebrew.send(:internal_command_path, "shcmd") - assert_nil Homebrew.send(:internal_command_path, "idontexist1234") + Commands.path("shcmd") + assert_nil Commands.path("idontexist1234") end def test_internal_dev_command_path assert_equal HOMEBREW_LIBRARY_PATH/"dev-cmd/rbdevcmd.rb", - Homebrew.send(:internal_command_path, "rbdevcmd") + Commands.path("rbdevcmd") assert_equal HOMEBREW_LIBRARY_PATH/"dev-cmd/shdevcmd.sh", - Homebrew.send(:internal_command_path, "shdevcmd") + Commands.path("shdevcmd") end end From 49dcbee99c46d92d65e9132a555ed3fc2865c1e6 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 7 Sep 2016 20:09:22 +0100 Subject: [PATCH 11/13] command: use Commands module. --- Library/Homebrew/cmd/command.rb | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Library/Homebrew/cmd/command.rb b/Library/Homebrew/cmd/command.rb index bab0257c83..b76468f621 100644 --- a/Library/Homebrew/cmd/command.rb +++ b/Library/Homebrew/cmd/command.rb @@ -1,13 +1,15 @@ #: * `command` : #: Display the path to the file which is used when invoking `brew` . +require "commands" + module Homebrew def command abort "This command requires a command argument" if ARGV.empty? cmd = ARGV.first cmd = HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(cmd, cmd) - if (path = internal_command_path cmd) + if (path = Commands.path(cmd)) puts path elsif (path = which("brew-#{cmd}") || which("brew-#{cmd}.rb")) puts path @@ -15,13 +17,4 @@ module Homebrew odie "Unknown command: #{cmd}" end end - - private - - def internal_command_path(cmd) - extensions = %w[rb sh] - paths = extensions.map { |ext| HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.#{ext}" } - paths += extensions.map { |ext| HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.#{ext}" } - paths.find { |p| p.file? } - end end From ae57057afae0a714143de090a62ea772b097569c Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 7 Sep 2016 20:09:29 +0100 Subject: [PATCH 12/13] help: use Commands module. --- Library/Homebrew/cmd/help.rb | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/Library/Homebrew/cmd/help.rb b/Library/Homebrew/cmd/help.rb index eae08395da..a6681c0b3d 100644 --- a/Library/Homebrew/cmd/help.rb +++ b/Library/Homebrew/cmd/help.rb @@ -31,12 +31,14 @@ EOS # NOTE Keep lines less than 80 characters! Wrapping is just not cricket. # NOTE The reason the string is at the top is so 25 lines is easy to measure! +require "commands" + module Homebrew def help(cmd = nil, flags = {}) # Resolve command aliases and find file containing the implementation. if cmd cmd = HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(cmd, cmd) - path = command_path(cmd) + path = Commands.path(cmd) end # Display command-specific (or generic) help in response to `UsageError`. @@ -69,18 +71,6 @@ module Homebrew private - def command_path(cmd) - if File.exist?(HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.sh") - HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.sh" - elsif File.exist?(HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.sh") - HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.sh" - elsif File.exist?(HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.rb") - HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.rb" - elsif File.exist?(HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.rb") - HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.rb" - end - end - def command_help(path) help_lines = path.read.lines.grep(/^#:/) if help_lines.empty? From 027086d67386a58b06f3df92b9168dcb0319ef0e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 8 Sep 2016 20:48:38 +0100 Subject: [PATCH 13/13] help: rename help section for developers. --- Library/Homebrew/cmd/help.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/help.rb b/Library/Homebrew/cmd/help.rb index a6681c0b3d..1456becb2d 100644 --- a/Library/Homebrew/cmd/help.rb +++ b/Library/Homebrew/cmd/help.rb @@ -13,7 +13,7 @@ Troubleshooting: brew doctor brew install -vd FORMULA -Brewing: +Developers: brew create [URL [--no-fetch]] brew edit [FORMULA...] https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Formula-Cookbook.md