From e63eff22014d1a8ede20312f715fe062702abe2c Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Tue, 8 Jan 2019 00:26:22 -0800 Subject: [PATCH 001/199] Treat future SDKs as "latest" Some SDKs return a number higher than the hard-coded `latest_version` in this file. With the current `==` check, those higher version numbers are treated as "not the latest". This prevents machines with higher-versioned SDKs from being able to use Homebrew. To resolve that problem, this PR changes the check to `>=`, which allows machines with higher-versioned SDKs to also use Homebrew to install packages. --- Library/Homebrew/os/mac/xcode.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb index b479da3745..0f8e62db7b 100644 --- a/Library/Homebrew/os/mac/xcode.rb +++ b/Library/Homebrew/os/mac/xcode.rb @@ -44,7 +44,7 @@ module OS end def latest_sdk_version? - OS::Mac.version == OS::Mac.latest_sdk_version + OS::Mac.version >= OS::Mac.latest_sdk_version end def needs_clt_installed? From e89cdf3681544a8a42fd704a8fb501e1afea1b60 Mon Sep 17 00:00:00 2001 From: Maxim Belkin Date: Mon, 14 Jan 2019 16:29:42 -0600 Subject: [PATCH 002/199] Fiks HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK description This change fixes a syntax error introduced in b278165da --- Library/Homebrew/manpages/brew.1.md.erb | 2 +- docs/Manpage.md | 2 +- manpages/brew.1 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/manpages/brew.1.md.erb b/Library/Homebrew/manpages/brew.1.md.erb index 3fbdb885bf..7191f20cb6 100644 --- a/Library/Homebrew/manpages/brew.1.md.erb +++ b/Library/Homebrew/manpages/brew.1.md.erb @@ -219,7 +219,7 @@ Note that environment variables must have a value set to be detected. For exampl `brew upgrade` or `brew tap`. * `HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK`: - If set, Homebrew will fail if on the failure of installation from a bottle + If set, Homebrew will fail on the failure of installation from a bottle rather than falling back to building from source. * `HOMEBREW_NO_COLOR`: diff --git a/docs/Manpage.md b/docs/Manpage.md index 6f7ed538e1..5076d1957f 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1212,7 +1212,7 @@ Note that environment variables must have a value set to be detected. For exampl `brew upgrade` or `brew tap`. * `HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK`: - If set, Homebrew will fail if on the failure of installation from a bottle + If set, Homebrew will fail on the failure of installation from a bottle rather than falling back to building from source. * `HOMEBREW_NO_COLOR`: diff --git a/manpages/brew.1 b/manpages/brew.1 index 150a0e80b2..bf59b91d7c 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1342,7 +1342,7 @@ If set, Homebrew will not auto\-update before running \fBbrew install\fR, \fBbre . .TP \fBHOMEBREW_NO_BOTTLE_SOURCE_FALLBACK\fR -If set, Homebrew will fail if on the failure of installation from a bottle rather than falling back to building from source\. +If set, Homebrew will fail on the failure of installation from a bottle rather than falling back to building from source\. . .TP \fBHOMEBREW_NO_COLOR\fR From ad799cbc4cc8fe4b51eb46f59c5b52fc2040c35a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Wed, 16 Jan 2019 00:26:16 +0000 Subject: [PATCH 003/199] Bump html-proofer from 3.10.0 to 3.10.1 in /docs Bumps [html-proofer](https://github.com/gjtorikian/html-proofer) from 3.10.0 to 3.10.1. - [Release notes](https://github.com/gjtorikian/html-proofer/releases) - [Commits](https://github.com/gjtorikian/html-proofer/compare/v3.10.0...v3.10.1) Signed-off-by: dependabot[bot] --- docs/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 36ecd1d04b..d14b6aa8f7 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -85,7 +85,7 @@ GEM html-pipeline (2.10.0) activesupport (>= 2) nokogiri (>= 1.4) - html-proofer (3.10.0) + html-proofer (3.10.1) activesupport (>= 4.2, < 6.0) addressable (~> 2.3) colorize (~> 0.8) From 946d6dc2a9f1428930ba0a425772eb7ea3b4f1f4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Wed, 16 Jan 2019 16:15:52 +0000 Subject: [PATCH 004/199] Bump parser from 2.5.3.0 to 2.6.0.0 in /Library/Homebrew/test Bumps [parser](https://github.com/whitequark/parser) from 2.5.3.0 to 2.6.0.0. - [Release notes](https://github.com/whitequark/parser/releases) - [Changelog](https://github.com/whitequark/parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/whitequark/parser/commits) Signed-off-by: dependabot[bot] --- Library/Homebrew/test/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/test/Gemfile.lock b/Library/Homebrew/test/Gemfile.lock index 7c1bcbe00e..4e622c0df4 100644 --- a/Library/Homebrew/test/Gemfile.lock +++ b/Library/Homebrew/test/Gemfile.lock @@ -17,7 +17,7 @@ GEM parallel (1.12.1) parallel_tests (2.27.1) parallel - parser (2.5.3.0) + parser (2.6.0.0) ast (~> 2.4.0) powerpack (0.1.2) rainbow (3.0.0) From bb838f8ce2bdfa5ca329757a87f43710a9cb0542 Mon Sep 17 00:00:00 2001 From: Yvo Mulder <7681555+ytbmulder@users.noreply.github.com> Date: Thu, 17 Jan 2019 06:01:31 +0100 Subject: [PATCH 005/199] Fix docs/FAQ.md typo --- docs/FAQ.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/FAQ.md b/docs/FAQ.md index f767f63b95..658cf93725 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -141,7 +141,7 @@ You should only ever sudo a tool you trust. Of course, you can trust Homebrew 😉 But do you trust the multi-megabyte Makefile that Homebrew runs? Developers often understand C++ far better than they understand make syntax. It’s too high a risk to sudo such stuff. It could modify (or upload) any files on your -system.And indeed, we’ve seen some build scripts try to modify `/usr` even when +system. And indeed, we’ve seen some build scripts try to modify `/usr` even when the prefix was specified as something else entirely. We use the macOS sandbox to stop this but this doesn't work when run as the `root` user (which also has read and write access to almost everything on the system). From 3d3d3b9e0dfdb42ebf198023ef91097f88585736 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Thu, 17 Jan 2019 06:44:34 +0000 Subject: [PATCH 006/199] Bump rubocop from 0.61.1 to 0.63.0 in /Library/Homebrew/vendor Bumps [rubocop](https://github.com/rubocop-hq/rubocop) from 0.61.1 to 0.63.0. - [Release notes](https://github.com/rubocop-hq/rubocop/releases) - [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.61.1...v0.63.0) Signed-off-by: dependabot[bot] --- Library/Homebrew/vendor/Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/vendor/Gemfile.lock b/Library/Homebrew/vendor/Gemfile.lock index 1271504eef..004c2b48ff 100644 --- a/Library/Homebrew/vendor/Gemfile.lock +++ b/Library/Homebrew/vendor/Gemfile.lock @@ -14,12 +14,12 @@ GEM jaro_winkler (1.5.2) minitest (5.11.3) parallel (1.12.1) - parser (2.5.3.0) + parser (2.6.0.0) ast (~> 2.4.0) plist (3.5.0) powerpack (0.1.2) rainbow (3.0.0) - rubocop (0.61.1) + rubocop (0.63.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.5, != 2.5.1.1) From 410463b94cffe9620d69b74993cdd58003640f31 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Thu, 17 Jan 2019 09:06:03 +0000 Subject: [PATCH 007/199] Bump parallel from 1.12.1 to 1.13.0 in /docs Bumps [parallel](https://github.com/grosser/parallel) from 1.12.1 to 1.13.0. - [Release notes](https://github.com/grosser/parallel/releases) - [Commits](https://github.com/grosser/parallel/compare/v1.12.1...v1.13.0) Signed-off-by: dependabot[bot] --- docs/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index d14b6aa8f7..1cbcbc5572 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -219,7 +219,7 @@ GEM mini_portile2 (~> 2.4.0) octokit (4.13.0) sawyer (~> 0.8.0, >= 0.5.3) - parallel (1.12.1) + parallel (1.13.0) pathutil (0.16.2) forwardable-extended (~> 2.6) public_suffix (2.0.5) From 4db95edbcdc5f184bb416da45cf87c1a3789c382 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Thu, 17 Jan 2019 09:06:25 +0000 Subject: [PATCH 008/199] Bump parallel from 1.12.1 to 1.13.0 in /Library/Homebrew/test Bumps [parallel](https://github.com/grosser/parallel) from 1.12.1 to 1.13.0. - [Release notes](https://github.com/grosser/parallel/releases) - [Commits](https://github.com/grosser/parallel/compare/v1.12.1...v1.13.0) Signed-off-by: dependabot[bot] --- Library/Homebrew/test/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/test/Gemfile.lock b/Library/Homebrew/test/Gemfile.lock index 4e622c0df4..489e6417da 100644 --- a/Library/Homebrew/test/Gemfile.lock +++ b/Library/Homebrew/test/Gemfile.lock @@ -14,7 +14,7 @@ GEM jaro_winkler (1.5.2) json (2.1.0) mustache (1.1.0) - parallel (1.12.1) + parallel (1.13.0) parallel_tests (2.27.1) parallel parser (2.6.0.0) From e5b893689348ef3a878fcf3ef3bdfba49b44fe9e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 17 Jan 2019 09:22:50 +0000 Subject: [PATCH 009/199] bin/brew: set CI variable. It's currently unset on Azure Pipelines and Jenkins so let's set it here for consistency across our ecosystem. --- bin/brew | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/brew b/bin/brew index 0c0b2f61c0..9406a5d374 100755 --- a/bin/brew +++ b/bin/brew @@ -65,6 +65,12 @@ do export "$VAR_NEW"="${!VAR}" done +# Set CI variable for Azure Pipelines, Jenkins. +if [[ -n "$TF_BUILD" || -n "$JENKINS_HOME" ]] +then + export CI="1" +fi + # test-bot does environment filtering itself if [[ -z "$HOMEBREW_NO_ENV_FILTERING" && "$1" != "test-bot" ]] then From a75f979eec0717495c4f1559fecc635fbbb146af Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 17 Jan 2019 09:29:21 +0000 Subject: [PATCH 010/199] utils: re-add install_gem! version argument. This is needed for `compat/download_strategy` for now. --- Library/Homebrew/utils.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index b0ddf7e972..98677b1976 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -219,18 +219,21 @@ module Homebrew ENV["PATH"] = path end - def install_gem!(name) + # TODO: version can be removed when compat/download_strategy is deleted in 2.0 + def install_gem!(name, version = nil) setup_gem_environment! - return unless Gem::Specification.find_all_by_name(name).empty? + return unless Gem::Specification.find_all_by_name(name, version).empty? ohai "Installing or updating '#{name}' gem" + install_args = %W[--no-document #{name}] + install_args << "--version" << version if version # Do `gem install [...]` without having to spawn a separate process or # having to find the right `gem` binary for the running Ruby interpreter. require "rubygems/commands/install_command" install_cmd = Gem::Commands::InstallCommand.new - install_cmd.handle_options(["--no-document", name]) + install_cmd.handle_options(install_args) exit_code = 1 # Should not matter as `install_cmd.execute` always throws. begin install_cmd.execute From c57c20af08788646b23baefc07dc7b1b5144f2ec Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Thu, 17 Jan 2019 09:47:33 +0000 Subject: [PATCH 011/199] Bump rubocop from 0.61.1 to 0.63.0 in /Library/Homebrew/test Bumps [rubocop](https://github.com/rubocop-hq/rubocop) from 0.61.1 to 0.63.0. - [Release notes](https://github.com/rubocop-hq/rubocop/releases) - [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.61.1...v0.63.0) Signed-off-by: dependabot[bot] --- Library/Homebrew/test/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/test/Gemfile.lock b/Library/Homebrew/test/Gemfile.lock index 489e6417da..0f755e6564 100644 --- a/Library/Homebrew/test/Gemfile.lock +++ b/Library/Homebrew/test/Gemfile.lock @@ -46,7 +46,7 @@ GEM rspec-support (3.8.0) rspec-wait (0.0.9) rspec (>= 3, < 4) - rubocop (0.61.1) + rubocop (0.63.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.5, != 2.5.1.1) From 6c3ab9437539e09e4ef9d5b4a5d24629a5c8c1aa Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 17 Jan 2019 09:49:56 +0000 Subject: [PATCH 012/199] brew vendor-gems: commit updates. --- Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb b/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb index eec9752405..6c86ad5daf 100644 --- a/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb @@ -15,12 +15,12 @@ $:.unshift "#{path}/" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-18/2.3.0/jaro_winkler-1.5.2" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/jaro_winkler-1.5.2/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel-1.12.1/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parser-2.5.3.0/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parser-2.6.0.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/plist-3.5.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/powerpack-0.1.2/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rainbow-3.0.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.10.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.4.1/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.61.1/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.63.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.31.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.1.0/lib" From ad1acdc1adfe5cc58590069fa604f884e729d89e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 17 Jan 2019 09:57:50 +0000 Subject: [PATCH 013/199] requirement: fix new RuboCop failures. --- Library/Homebrew/requirement.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/requirement.rb b/Library/Homebrew/requirement.rb index 97c6fe6cb5..cdff3f254e 100644 --- a/Library/Homebrew/requirement.rb +++ b/Library/Homebrew/requirement.rb @@ -12,8 +12,8 @@ class Requirement attr_reader :tags, :name, :cask, :download def initialize(tags = []) - @cask ||= self.class.cask - @download ||= self.class.download + @cask = self.class.cask + @download = self.class.download tags.each do |tag| next unless tag.is_a? Hash From 341c0ffd44a460ff282e6334612305c9a4c71122 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Fri, 18 Jan 2019 06:09:14 +0000 Subject: [PATCH 014/199] Bump parallel from 1.12.1 to 1.13.0 in /Library/Homebrew/vendor Bumps [parallel](https://github.com/grosser/parallel) from 1.12.1 to 1.13.0. - [Release notes](https://github.com/grosser/parallel/releases) - [Commits](https://github.com/grosser/parallel/compare/v1.12.1...v1.13.0) Signed-off-by: dependabot[bot] --- Library/Homebrew/vendor/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/vendor/Gemfile.lock b/Library/Homebrew/vendor/Gemfile.lock index 004c2b48ff..7dba7589fb 100644 --- a/Library/Homebrew/vendor/Gemfile.lock +++ b/Library/Homebrew/vendor/Gemfile.lock @@ -13,7 +13,7 @@ GEM concurrent-ruby (~> 1.0) jaro_winkler (1.5.2) minitest (5.11.3) - parallel (1.12.1) + parallel (1.13.0) parser (2.6.0.0) ast (~> 2.4.0) plist (3.5.0) From ae9d4d3465a88fb6eb241fd74a9bf8840ebc495c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Fri, 18 Jan 2019 09:08:20 +0000 Subject: [PATCH 015/199] Bump term-ansicolor from 1.7.0 to 1.7.1 in /Library/Homebrew/test Bumps [term-ansicolor](https://github.com/flori/term-ansicolor) from 1.7.0 to 1.7.1. - [Release notes](https://github.com/flori/term-ansicolor/releases) - [Changelog](https://github.com/flori/term-ansicolor/blob/master/CHANGES) - [Commits](https://github.com/flori/term-ansicolor/compare/v1.7.0...v1.7.1) Signed-off-by: dependabot[bot] --- Library/Homebrew/test/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/test/Gemfile.lock b/Library/Homebrew/test/Gemfile.lock index 0f755e6564..a8f8662482 100644 --- a/Library/Homebrew/test/Gemfile.lock +++ b/Library/Homebrew/test/Gemfile.lock @@ -62,7 +62,7 @@ GEM simplecov-cobertura (1.3.0) simplecov (~> 0.8) simplecov-html (0.10.2) - term-ansicolor (1.7.0) + term-ansicolor (1.7.1) tins (~> 1.0) thor (0.19.4) tins (1.20.2) From 91ef2babddd81e0f381e39b33a8587690dd65c2f Mon Sep 17 00:00:00 2001 From: Chongyu Zhu Date: Fri, 18 Jan 2019 20:27:10 +0800 Subject: [PATCH 016/199] gitignore: ignore pinned taps --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2723b40b9a..c464927386 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ /Library/Homebrew/test/fs_leak_log /Library/Homebrew/vendor/portable-ruby /Library/Taps +/Library/PinnedTaps # Ignore Bundler files **/.bundle/bin From 1748b66615a9bae93303d10c1224ee76d9931cf3 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Fri, 18 Jan 2019 22:03:07 +0530 Subject: [PATCH 017/199] Add alias for `switch` method in CLI::Parser --- Library/Homebrew/cli_parser.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/Library/Homebrew/cli_parser.rb b/Library/Homebrew/cli_parser.rb index 01310d42e3..da63133dfb 100644 --- a/Library/Homebrew/cli_parser.rb +++ b/Library/Homebrew/cli_parser.rb @@ -59,6 +59,7 @@ module Homebrew enable_switch(*names) if !env.nil? && !ENV["HOMEBREW_#{env.to_s.upcase}"].nil? end + alias switch_option switch def usage_banner(text) @parser.banner = "#{text}\n" From f7689b381efd84d19f8ea741e2629b2cb95988d0 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Fri, 18 Jan 2019 22:03:30 +0530 Subject: [PATCH 018/199] switch: Use CLI::Parser to parse args --- Library/Homebrew/cmd/switch.rb | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/cmd/switch.rb b/Library/Homebrew/cmd/switch.rb index bf22f484a5..7bcc295a4d 100644 --- a/Library/Homebrew/cmd/switch.rb +++ b/Library/Homebrew/cmd/switch.rb @@ -3,12 +3,26 @@ require "formula" require "keg" +require "cli_parser" module Homebrew module_function + def switch_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `switch` + + Symlink all of the specific of 's install to Homebrew prefix. + EOS + switch_option :verbose + switch_option :debug + end + end + def switch - name = ARGV.first + switch_args.parse + name = args.remaining.first usage = "Usage: brew switch " @@ -28,9 +42,9 @@ module Homebrew .map { |d| Keg.new(d).version } .sort .join(", ") - version = ARGV.second + version = args.remaining.second - if !version || ARGV.named.length > 2 + if !version || args.remaining.length > 2 onoe usage puts "#{name} installed versions: #{versions}" exit 1 From 14453748c9b69d33e10e7a082027601923c04a3e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 18 Jan 2019 19:20:55 +0000 Subject: [PATCH 019/199] brew vendor-gems: commit updates. --- Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb b/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb index 6c86ad5daf..7db420ea56 100644 --- a/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb @@ -14,7 +14,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/backports-3.11.4/lib" $:.unshift "#{path}/" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-18/2.3.0/jaro_winkler-1.5.2" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/jaro_winkler-1.5.2/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel-1.12.1/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel-1.13.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parser-2.6.0.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/plist-3.5.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/powerpack-0.1.2/lib" From 9d287483b77c112b40fe0546d4d65cdd27c23cb0 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Fri, 18 Jan 2019 22:17:46 +0530 Subject: [PATCH 020/199] cat: Use CLI::Parser to parse args --- Library/Homebrew/cmd/cat.rb | 15 ++++++++++++++- Library/Homebrew/test/cmd/help_spec.rb | 4 ++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/cmd/cat.rb b/Library/Homebrew/cmd/cat.rb index 7439869d30..5cf7077cc9 100644 --- a/Library/Homebrew/cmd/cat.rb +++ b/Library/Homebrew/cmd/cat.rb @@ -1,16 +1,29 @@ #: * `cat` : #: Display the source to . +require "cli_parser" + module Homebrew module_function + def cat_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `cat` + + Display the source to . + EOS + end + end + def cat + cat_args.parse # do not "fix" this to support multiple arguments, the output would be # unparsable, if the user wants to cat multiple formula they can call # brew cat multiple times. formulae = ARGV.formulae raise FormulaUnspecifiedError if formulae.empty? - raise "`brew cat` doesn't support multiple arguments" if formulae.size > 1 + raise "`brew cat` doesn't support multiple arguments" if args.remaining.size > 1 cd HOMEBREW_REPOSITORY exec "cat", formulae.first.path, *ARGV.options_only diff --git a/Library/Homebrew/test/cmd/help_spec.rb b/Library/Homebrew/test/cmd/help_spec.rb index e3460dec0f..ab80b69f01 100644 --- a/Library/Homebrew/test/cmd/help_spec.rb +++ b/Library/Homebrew/test/cmd/help_spec.rb @@ -14,7 +14,7 @@ describe "brew", :integration_test do it "prints help for a documented Ruby command" do expect { brew "help", "cat" } - .to output(/^brew cat/).to_stdout + .to output(/^Usage: brew cat/).to_stdout .and be_a_success end @@ -40,7 +40,7 @@ describe "brew", :integration_test do describe "cat" do it "prints help when no argument is given" do expect { brew "cat" } - .to output(/^brew cat/).to_stderr + .to output(/^Usage: brew cat/).to_stderr .and be_a_failure end end From ec5ce4b1800cccae72e6d211e8636c0b3e046edb Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 19 Jan 2019 17:17:21 +0000 Subject: [PATCH 021/199] utils/github: display max 20 closed PRs. Closes #5553. --- Library/Homebrew/utils/github.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index fe10623b40..0446569797 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -279,7 +279,7 @@ module GitHub open_prs else puts "Closed pull requests:" unless open_or_closed_prs.empty? - open_or_closed_prs + open_or_closed_prs.take(20) end prs.each { |i| puts "#{i["title"]} (#{i["html_url"]})" } From 41898270b677ddceae1ab00edb595236dee617b2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Sat, 19 Jan 2019 20:05:22 +0000 Subject: [PATCH 022/199] Bump html-proofer from 3.10.1 to 3.10.2 in /docs Bumps [html-proofer](https://github.com/gjtorikian/html-proofer) from 3.10.1 to 3.10.2. - [Release notes](https://github.com/gjtorikian/html-proofer/releases) - [Commits](https://github.com/gjtorikian/html-proofer/compare/v3.10.1...v3.10.2) Signed-off-by: dependabot[bot] --- docs/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 1cbcbc5572..1d6932b8e5 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -85,7 +85,7 @@ GEM html-pipeline (2.10.0) activesupport (>= 2) nokogiri (>= 1.4) - html-proofer (3.10.1) + html-proofer (3.10.2) activesupport (>= 4.2, < 6.0) addressable (~> 2.3) colorize (~> 0.8) From fb31ff89423f3c89c8d85100c87e60c4a8fef3d4 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Sun, 20 Jan 2019 20:04:19 +0530 Subject: [PATCH 023/199] analytics: Use CLI::Parser to parse args --- Library/Homebrew/cmd/analytics.rb | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/cmd/analytics.rb b/Library/Homebrew/cmd/analytics.rb index 60ebb03da9..9aeb179d0e 100644 --- a/Library/Homebrew/cmd/analytics.rb +++ b/Library/Homebrew/cmd/analytics.rb @@ -8,15 +8,35 @@ #: * `analytics` `regenerate-uuid`: #: Regenerate UUID used in Homebrew's analytics. +require "cli_parser" + module Homebrew module_function + def analytics_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `analytics` (`on`|`off`) [`state`] [`regenerate-uuid`] + + If `on`|`off` is passed, turn Homebrew's analytics on or off respectively. + + If `state` is passed, display anonymous user behaviour analytics state. + Read more at . + + If `regenerate-uuid` is passed, regenerate UUID used in Homebrew's analytics. + EOS + switch :verbose + switch :debug + end + end + def analytics + analytics_args.parse config_file = HOMEBREW_REPOSITORY/".git/config" - raise UsageError if ARGV.named.size > 1 + raise UsageError if args.remaining.size > 1 - case ARGV.named.first + case args.remaining.first when nil, "state" analyticsdisabled = Utils.popen_read("git config --file=#{config_file} --get homebrew.analyticsdisabled").chomp From b1a36a13e210bb45a66e82ae8c5a240bad602ada Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Sun, 20 Jan 2019 20:08:14 +0530 Subject: [PATCH 024/199] command: Use CLI::Parser to parse args --- Library/Homebrew/cmd/command.rb | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/cmd/command.rb b/Library/Homebrew/cmd/command.rb index d964fa1a9b..9d468ee582 100644 --- a/Library/Homebrew/cmd/command.rb +++ b/Library/Homebrew/cmd/command.rb @@ -2,14 +2,28 @@ #: Display the path to the file which is used when invoking `brew` . require "commands" +require "cli_parser" module Homebrew module_function - def command - abort "This command requires a command argument" if ARGV.empty? + def command_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `command` - cmd = HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(ARGV.first, ARGV.first) + Display the path to the file which is used when invoking `brew` . + EOS + switch :verbose + switch :debug + end + end + + def command + command_args.parse + abort "This command requires a command argument" if args.remaining.empty? + + cmd = HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(args.remaining.first, args.remaining.first) path = Commands.path(cmd) From c5f01f203a6ad117c3eb2e60548d75e2c65fc304 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Sun, 20 Jan 2019 20:42:15 +0530 Subject: [PATCH 025/199] commands: Use CLI::Parser to parse args --- Library/Homebrew/cmd/commands.rb | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/cmd/commands.rb b/Library/Homebrew/cmd/commands.rb index 9644a1dee2..adb29038a1 100644 --- a/Library/Homebrew/cmd/commands.rb +++ b/Library/Homebrew/cmd/commands.rb @@ -4,15 +4,36 @@ #: If `--quiet` is passed, list only the names of commands without the header. #: With `--include-aliases`, the aliases of internal commands will be included. +require "cli_parser" + module Homebrew module_function + def commands_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `commands` [] + + Show a list of built-in and external commands. + EOS + switch "--quiet", + description: "List only the names of commands without the header." + switch "--include-aliases", + depends_on: "--quiet", + description: "Include the aliases of internal commands." + switch :verbose + switch :debug + end + end + def commands - if ARGV.include? "--quiet" + commands_args.parse + + if args.quiet? cmds = internal_commands cmds += external_commands cmds += internal_developer_commands - cmds += HOMEBREW_INTERNAL_COMMAND_ALIASES.keys if ARGV.include? "--include-aliases" + cmds += HOMEBREW_INTERNAL_COMMAND_ALIASES.keys if args.include_aliases? puts Formatter.columns(cmds.sort) return end From 0eecbb21fa5df8c52078c55702f134f27ea2ec1f Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Sun, 20 Jan 2019 21:29:19 +0530 Subject: [PATCH 026/199] config: Use CLI::Parser to parse args --- Library/Homebrew/cmd/config.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Library/Homebrew/cmd/config.rb b/Library/Homebrew/cmd/config.rb index daaa51f32b..44b6ec6198 100644 --- a/Library/Homebrew/cmd/config.rb +++ b/Library/Homebrew/cmd/config.rb @@ -4,11 +4,28 @@ #: provide it. require "system_config" +require "cli_parser" module Homebrew module_function + def config_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `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. + EOS + switch :verbose + switch :debug + end + end + def config + config_args.parse + raise UsageError unless args.remaining.empty? SystemConfig.dump_verbose_config end end From 699d543ecddeb399c3d1640bad692e48c66be6ad Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 21 Jan 2019 12:37:42 +0000 Subject: [PATCH 027/199] Use Homebrew.default_prefix? in more places. --- Library/Homebrew/diagnostic.rb | 2 +- Library/Homebrew/utils/analytics.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 5555a3ca71..c42bf31623 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -802,7 +802,7 @@ module Homebrew end def check_homebrew_prefix - return if HOMEBREW_PREFIX.to_s == Homebrew::DEFAULT_PREFIX + return if Homebrew.default_prefix? <<~EOS Your Homebrew's prefix is not #{Homebrew::DEFAULT_PREFIX}. diff --git a/Library/Homebrew/utils/analytics.rb b/Library/Homebrew/utils/analytics.rb index 30b7c606b8..7283b5aece 100644 --- a/Library/Homebrew/utils/analytics.rb +++ b/Library/Homebrew/utils/analytics.rb @@ -16,7 +16,7 @@ module Utils def os_prefix_ci @os_prefix_ci ||= begin os = OS_VERSION - prefix = ", #{custom_prefix_label}" if HOMEBREW_PREFIX.to_s != Homebrew::DEFAULT_PREFIX + prefix = ", #{custom_prefix_label}" if Homebrew.default_prefix? ci = ", CI" if ENV["CI"] "#{os}#{prefix}#{ci}" end From c3a46bc57046a11e3f95dffc11ac57842c887f38 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 21 Jan 2019 12:38:28 +0000 Subject: [PATCH 028/199] os/mac/diagnostic: remove some old/unneeded checks. --- Library/Homebrew/extend/os/mac/diagnostic.rb | 41 ------------------- .../Homebrew/test/os/mac/diagnostic_spec.rb | 13 ------ 2 files changed, 54 deletions(-) diff --git a/Library/Homebrew/extend/os/mac/diagnostic.rb b/Library/Homebrew/extend/os/mac/diagnostic.rb index 0ab30c6563..d433127500 100644 --- a/Library/Homebrew/extend/os/mac/diagnostic.rb +++ b/Library/Homebrew/extend/os/mac/diagnostic.rb @@ -11,7 +11,6 @@ module Homebrew check_xcode_license_approved check_xcode_up_to_date check_clt_up_to_date - check_for_other_package_managers ].freeze end @@ -136,21 +135,6 @@ module Homebrew EOS end - def check_for_other_package_managers - ponk = MacOS.macports_or_fink - return if ponk.empty? - - <<~EOS - You have MacPorts or Fink installed: - #{ponk.join(", ")} - - This can cause trouble. You don't have to uninstall them, but you may want to - temporarily move them out of the way, e.g. - - sudo mv /opt/local ~/macports - EOS - end - def check_ruby_version ruby_version = "2.3.7" return if RUBY_VERSION == ruby_version @@ -200,19 +184,6 @@ module Homebrew EOS end - def check_for_bad_curl - return unless MacOS.version <= "10.8" - return if Formula["curl"].installed? - - <<~EOS - The system curl on 10.8 and below is often incapable of supporting - modern secure connections & will fail on fetching formulae. - - We recommend you: - brew install curl - EOS - end - def check_xcode_license_approved # If the user installs Xcode-only, they have to approve the # license or no "xc*" tool will work. @@ -236,18 +207,6 @@ module Homebrew EOS end - def check_for_beta_xquartz - return unless MacOS::XQuartz.version.to_s.include?("beta") - - <<~EOS - The following beta release of XQuartz is installed: #{MacOS::XQuartz.version} - - XQuartz beta releases include address sanitization, and do not work with - all software; notably, wine will not work with beta releases of XQuartz. - We recommend only installing stable releases of XQuartz. - EOS - end - def check_filesystem_case_sensitive dirs_to_check = [ HOMEBREW_PREFIX, diff --git a/Library/Homebrew/test/os/mac/diagnostic_spec.rb b/Library/Homebrew/test/os/mac/diagnostic_spec.rb index b4a7ecc1bd..91a94eb892 100644 --- a/Library/Homebrew/test/os/mac/diagnostic_spec.rb +++ b/Library/Homebrew/test/os/mac/diagnostic_spec.rb @@ -1,12 +1,6 @@ require "diagnostic" describe Homebrew::Diagnostic::Checks do - specify "#check_for_other_package_managers" do - allow(MacOS).to receive(:macports_or_fink).and_return(["fink"]) - expect(subject.check_for_other_package_managers) - .to match("You have MacPorts or Fink installed:") - end - specify "#check_for_unsupported_macos" do ENV.delete("HOMEBREW_DEVELOPER") allow(OS::Mac).to receive(:prerelease?).and_return(true) @@ -15,13 +9,6 @@ describe Homebrew::Diagnostic::Checks do .to match("We do not provide support for this pre-release version.") end - specify "#check_for_beta_xquartz" do - allow(MacOS::XQuartz).to receive(:version).and_return("2.7.10_beta2") - - expect(subject.check_for_beta_xquartz) - .to match("The following beta release of XQuartz is installed: 2.7.10_beta2") - end - specify "#check_if_xcode_needs_clt_installed" do allow(MacOS).to receive(:version).and_return(OS::Mac::Version.new("10.11")) allow(MacOS::Xcode).to receive(:installed?).and_return(true) From 5c7fbaf25981345d4a2508d2e41e89fa6419ead2 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 21 Jan 2019 13:39:11 +0000 Subject: [PATCH 029/199] Update RuboCop RSpec rules Create a new, seperate RuboCop file that uses our RSpec rule configuration if a specified tap has a `spec` directory. Also, while we're here, fix up the various rules so that we don't have any outdated TODOs, disable some rules for good and fix `brew style` for Homebrew/bundle. --- Library/.rubocop.yml | 5 +- Library/.rubocop_rspec.yml | 22 +++++ Library/Homebrew/.rubocop.yml | 2 +- Library/Homebrew/style.rb | 9 +- Library/Homebrew/test/.rubocop_todo.yml | 82 +++---------------- .../artifact/shared_examples/uninstall_zap.rb | 1 - Library/Homebrew/test/spec_helper.rb | 2 +- .../helper/cask/fake_system_command.rb | 2 +- 8 files changed, 49 insertions(+), 76 deletions(-) create mode 100644 Library/.rubocop_rspec.yml diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index 4ef9d38704..351a9f71b7 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -110,7 +110,10 @@ Style/GuardClause: Style/HashSyntax: EnforcedStyle: hash_rockets Exclude: - - '**/cmd/*.rb' + - '**/Guardfile' + - '**/cmd/**/*.rb' + - '**/lib/**/*.rb' + - '**/spec/**/*.rb' # ruby style guide favorite Style/StringLiterals: diff --git a/Library/.rubocop_rspec.yml b/Library/.rubocop_rspec.yml new file mode 100644 index 0000000000..28ff7872e2 --- /dev/null +++ b/Library/.rubocop_rspec.yml @@ -0,0 +1,22 @@ +inherit_from: ./.rubocop.yml + +NewFormulaAudit: + Enabled: true + +# TODO: try to enable these +RSpec/AnyInstance: + Enabled: false +RSpec/ContextWording: + Enabled: false +RSpec/DescribeClass: + Enabled: false +RSpec/ExampleLength: + Enabled: false +RSpec/MessageSpies: + Enabled: false + +# TODO: try to reduce these +RSpec/MultipleExpectations: + Max: 26 +RSpec/NestedGroups: + Max: 5 diff --git a/Library/Homebrew/.rubocop.yml b/Library/Homebrew/.rubocop.yml index b2350c3b94..ebfcf6ca3b 100644 --- a/Library/Homebrew/.rubocop.yml +++ b/Library/Homebrew/.rubocop.yml @@ -1,4 +1,4 @@ -inherit_from: ../.rubocop.yml +inherit_from: ../.rubocop_rspec.yml AllCops: Include: diff --git a/Library/Homebrew/style.rb b/Library/Homebrew/style.rb index 8e6e7378c5..ca47f72043 100644 --- a/Library/Homebrew/style.rb +++ b/Library/Homebrew/style.rb @@ -60,8 +60,13 @@ module Homebrew File.expand_path(file).start_with? HOMEBREW_LIBRARY_PATH end - unless files.nil? || has_non_formula - args << "--config" << HOMEBREW_LIBRARY/".rubocop_audit.yml" + if files && !has_non_formula + config = if (files.first/"spec").exist? + HOMEBREW_LIBRARY/".rubocop_rspec.yml" + else + HOMEBREW_LIBRARY/".rubocop_audit.yml" + end + args << "--config" << config end if files.nil? diff --git a/Library/Homebrew/test/.rubocop_todo.yml b/Library/Homebrew/test/.rubocop_todo.yml index 6b7dcd94a9..ada16c8734 100644 --- a/Library/Homebrew/test/.rubocop_todo.yml +++ b/Library/Homebrew/test/.rubocop_todo.yml @@ -1,41 +1,16 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2018-10-08 06:47:14 +0200 using RuboCop version 0.59.2. +# on 2019-01-21 13:27:20 +0000 using RuboCop version 0.63.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 28 -RSpec/AnyInstance: +# Offense count: 1 +# Cop supports --auto-correct. +Lint/UnneededCopEnableDirective: Exclude: - - 'cask/artifact/uninstall_zap_shared_examples.rb' - - 'cask/cmd/create_spec.rb' - - 'cask/cmd/edit_spec.rb' - - 'cask/cmd/outdated_spec.rb' - - 'cask/cmd/upgrade_spec.rb' - - 'caveats_spec.rb' - - 'cleanup_spec.rb' - - 'download_strategies_spec.rb' - - 'formatter_spec.rb' - - 'os/linux/dependency_collector_spec.rb' - - 'utils/analytics_spec.rb' - - 'utils/git_spec.rb' - -# Offense count: 146 -# Configuration parameters: Prefixes. -# Prefixes: when, with, without -RSpec/ContextWording: - Enabled: false - -# Offense count: 69 -RSpec/DescribeClass: - Enabled: false - -# Offense count: 581 -# Configuration parameters: Max. -RSpec/ExampleLength: - Enabled: false + - 'cask/artifact/shared_examples/uninstall_zap.rb' # Offense count: 16 RSpec/ExpectActual: @@ -43,32 +18,21 @@ RSpec/ExpectActual: - 'spec/routing/**/*' - 'missing_formula_spec.rb' -# Offense count: 21 +# Offense count: 20 RSpec/ExpectInHook: Exclude: - 'cache_store_spec.rb' - 'cask/audit_spec.rb' - 'cmd/reinstall_spec.rb' - - 'download_strategies_spec.rb' - 'linkage_cache_store_spec.rb' - 'migrator_spec.rb' - 'os/mac/java_requirement_spec.rb' -# Offense count: 31 +# Offense count: 37 # Configuration parameters: CustomTransform, IgnoreMethods. RSpec/FilePath: Enabled: false -# Offense count: 6 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. -# SupportedStyles: implicit, each, example -RSpec/HookArgument: - Exclude: - - 'cask/artifact/uninstall_zap_shared_examples.rb' - - 'spec_helper.rb' - - 'support/helper/cask/fake_system_command.rb' - # Offense count: 6 # Configuration parameters: AssignmentOnly. RSpec/InstanceVariable: @@ -78,18 +42,6 @@ RSpec/InstanceVariable: - 'utils/git_spec.rb' - 'version_spec.rb' -# Offense count: 1 -# Cop supports --auto-correct. -RSpec/LeadingSubject: - Exclude: - - 'cask/artifact/uninstall_zap_shared_examples.rb' - -# Offense count: 122 -# Configuration parameters: EnforcedStyle. -# SupportedStyles: have_received, receive -RSpec/MessageSpies: - Enabled: false - # Offense count: 1 RSpec/MissingExampleGroupArgument: Exclude: @@ -99,27 +51,19 @@ RSpec/MissingExampleGroupArgument: RSpec/MultipleDescribes: Enabled: false -# Offense count: 548 -# Configuration parameters: AggregateFailuresByDefault. -RSpec/MultipleExpectations: - Max: 26 - -# Offense count: 946 +# Offense count: 825 +# Configuration parameters: IgnoreSharedExamples. RSpec/NamedSubject: Enabled: false -# Offense count: 99 -RSpec/NestedGroups: - Max: 5 - -# Offense count: 11 +# Offense count: 7 RSpec/RepeatedDescription: Exclude: - 'inreplace_spec.rb' - 'migrator_spec.rb' - 'tab_spec.rb' -# Offense count: 31 +# Offense count: 25 RSpec/SubjectStub: Exclude: - 'cache_store_spec.rb' @@ -130,7 +74,7 @@ RSpec/SubjectStub: - 'language/python_spec.rb' - 'os/mac/java_requirement_spec.rb' -# Offense count: 65 -# Configuration parameters: IgnoreSymbolicNames. +# Offense count: 67 +# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames. RSpec/VerifiedDoubles: Enabled: false diff --git a/Library/Homebrew/test/cask/artifact/shared_examples/uninstall_zap.rb b/Library/Homebrew/test/cask/artifact/shared_examples/uninstall_zap.rb index 6a6a54a9eb..dd034e041e 100644 --- a/Library/Homebrew/test/cask/artifact/shared_examples/uninstall_zap.rb +++ b/Library/Homebrew/test/cask/artifact/shared_examples/uninstall_zap.rb @@ -197,7 +197,6 @@ shared_examples "#uninstall_phase or #zap_phase" do end before do - # rubocop:disable RSpec/AnyInstance allow_any_instance_of(Cask::Artifact::AbstractUninstall).to receive(:trash_paths) .and_wrap_original do |method, *args| method.call(*args).tap do |result| diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index 79365e1997..67e6f6cb87 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -137,7 +137,7 @@ RSpec.configure do |config| skip "unzip not installed." unless which("unzip") end - config.around(:each) do |example| + config.around do |example| def find_files Find.find(TEST_TMPDIR) .reject { |f| File.basename(f) == ".DS_Store" } diff --git a/Library/Homebrew/test/support/helper/cask/fake_system_command.rb b/Library/Homebrew/test/support/helper/cask/fake_system_command.rb index 457b64de61..dafb8a6473 100644 --- a/Library/Homebrew/test/support/helper/cask/fake_system_command.rb +++ b/Library/Homebrew/test/support/helper/cask/fake_system_command.rb @@ -63,7 +63,7 @@ class FakeSystemCommand end RSpec.configure do |config| - config.after(:each) do + config.after do begin FakeSystemCommand.verify_expectations! ensure From 8258ecc3cae14b8f5f9a180fab118510f91cf5c7 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 21 Jan 2019 12:39:08 +0000 Subject: [PATCH 030/199] =?UTF-8?q?os:=20no=20=E2=80=9CREAD=20THIS?= =?UTF-8?q?=E2=80=9D=20in=20unsupported=20configurations.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Library/Homebrew/os.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/os.rb b/Library/Homebrew/os.rb index 24796f0a1e..7daa73051f 100644 --- a/Library/Homebrew/os.rb +++ b/Library/Homebrew/os.rb @@ -15,8 +15,12 @@ module OS if OS.mac? require "os/mac" - # Don't tell people to report issues on unsupported versions of macOS. - if !OS::Mac.prerelease? && !OS::Mac.outdated_release? + # Don't tell people to report issues on unsupported configurations. + if !OS::Mac.prerelease? && + !OS::Mac.outdated_release? && + !ENV["HOMEBREW_BUILD_FROM_SOURCE"] && + ARGV.none? { |v| v.start_with?("--cc=") } && + ENV["HOMEBREW_PREFIX"] == "/usr/local" ISSUES_URL = "https://docs.brew.sh/Troubleshooting".freeze end PATH_OPEN = "/usr/bin/open".freeze From 3a0e0dca36aad66f61a082812c0b7b41e0737ffc Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 21 Jan 2019 12:39:44 +0000 Subject: [PATCH 031/199] Output more warnings on unsupported configurations --- Library/Homebrew/diagnostic.rb | 25 ++++++++-------- .../Homebrew/extend/os/linux/diagnostic.rb | 7 +++++ Library/Homebrew/extend/os/linux/install.rb | 4 +-- Library/Homebrew/extend/os/mac/diagnostic.rb | 13 ++++++-- Library/Homebrew/install.rb | 30 ++++++++++++++----- 5 files changed, 55 insertions(+), 24 deletions(-) diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index c42bf31623..6d4db3f638 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -79,6 +79,10 @@ module Homebrew ].freeze end + def supported_configuration_checks + [].freeze + end + def development_tools_checks %w[ check_for_installed_developer_tools @@ -97,11 +101,10 @@ module Homebrew def please_create_pull_requests(what = "unsupported configuration") <<~EOS - You may encounter build failures and other breakages. - Please create pull requests instead of asking for help on - Homebrew's GitHub, Discourse, Twitter or IRC. You are - responsible for resolving any issues you experience, as - you are running this #{what}. + You will encounter build failures with some formulae. + Please create pull requests instead of asking for help on Homebrew's GitHub, + Discourse, Twitter or IRC. You are responsible for resolving any issues you + experience, as you are running this #{what}. EOS end @@ -118,10 +121,8 @@ module Homebrew return unless ENV["HOMEBREW_BUILD_FROM_SOURCE"] <<~EOS - You have HOMEBREW_BUILD_FROM_SOURCE set. This environment variable is - intended for use by Homebrew developers. If you are encountering errors, - please try unsetting this. Please do not file issues if you encounter - errors when using this environment variable. + You have HOMEBREW_BUILD_FROM_SOURCE set. + #{please_create_pull_requests} EOS end @@ -806,9 +807,9 @@ module Homebrew <<~EOS Your Homebrew's prefix is not #{Homebrew::DEFAULT_PREFIX}. - You can install Homebrew anywhere you want but some bottles (binary packages) - can only be used with a standard prefix and some formulae (packages) - may not build correctly with a non-standard prefix. + Some of Homebrew's bottles (binary packages) can only be used with the default + prefix (#{Homebrew::DEFAULT_PREFIX}). + #{please_create_pull_requests} EOS end diff --git a/Library/Homebrew/extend/os/linux/diagnostic.rb b/Library/Homebrew/extend/os/linux/diagnostic.rb index 1a89f9d956..061fe64bfb 100644 --- a/Library/Homebrew/extend/os/linux/diagnostic.rb +++ b/Library/Homebrew/extend/os/linux/diagnostic.rb @@ -7,6 +7,13 @@ require "os/linux/kernel" module Homebrew module Diagnostic class Checks + def supported_configuration_checks + %w[ + check_glibc_minimum_version + check_kernel_minimum_version + ].freeze + end + def check_tmpdir_sticky_bit message = generic_check_tmpdir_sticky_bit return if message.nil? diff --git a/Library/Homebrew/extend/os/linux/install.rb b/Library/Homebrew/extend/os/linux/install.rb index 91f043ac25..84b96ac060 100644 --- a/Library/Homebrew/extend/os/linux/install.rb +++ b/Library/Homebrew/extend/os/linux/install.rb @@ -26,8 +26,8 @@ module Homebrew FileUtils.ln_sf ld_so, brew_ld_so end - def perform_preinstall_checks - generic_perform_preinstall_checks + def perform_preinstall_checks(all_fatal: false) + generic_perform_preinstall_checks(all_fatal: all_fatal) symlink_ld_so end end diff --git a/Library/Homebrew/extend/os/mac/diagnostic.rb b/Library/Homebrew/extend/os/mac/diagnostic.rb index d433127500..6bbd51e551 100644 --- a/Library/Homebrew/extend/os/mac/diagnostic.rb +++ b/Library/Homebrew/extend/os/mac/diagnostic.rb @@ -1,12 +1,19 @@ module Homebrew module Diagnostic class Checks - undef development_tools_checks, fatal_development_tools_checks, - build_error_checks + undef supported_configuration_checks, development_tools_checks, + fatal_development_tools_checks, build_error_checks + + def supported_configuration_checks + %w[ + check_build_from_source + check_homebrew_prefix + check_for_unsupported_macos + ].freeze + end def development_tools_checks %w[ - check_for_unsupported_macos check_for_installed_developer_tools check_xcode_license_approved check_xcode_up_to_date diff --git a/Library/Homebrew/install.rb b/Library/Homebrew/install.rb index 7b7fb88042..e5bd6e8459 100644 --- a/Library/Homebrew/install.rb +++ b/Library/Homebrew/install.rb @@ -17,6 +17,16 @@ module Homebrew end end + def check_cc_argv + return unless ARGV.cc + + @checks ||= Diagnostic::Checks.new + opoo <<~EOS + You passed `--cc=#{ARGV.cc}`. + #{@checks.please_create_pull_requests} + EOS + end + def attempt_directory_creation Keg::MUST_EXIST_DIRECTORIES.each do |dir| begin @@ -28,28 +38,34 @@ module Homebrew end def perform_development_tools_checks - fatal_checks(:fatal_development_tools_checks) + diagnostic_checks(:fatal_development_tools_checks) end - def perform_preinstall_checks + def perform_preinstall_checks(all_fatal: false) check_cpu attempt_directory_creation - fatal_checks(:fatal_install_checks) + check_cc_argv + diagnostic_checks(:supported_configuration_checks, fatal: all_fatal) + diagnostic_checks(:fatal_install_checks) end alias generic_perform_preinstall_checks perform_preinstall_checks module_function :generic_perform_preinstall_checks - def fatal_checks(type) + def diagnostic_checks(type, fatal: true) @checks ||= Diagnostic::Checks.new failed = false @checks.public_send(type).each do |check| out = @checks.public_send(check) next if out.nil? - failed ||= true - ofail out + if fatal + failed ||= true + ofail out + else + opoo out + end end - exit 1 if failed + exit 1 if failed && fatal end end end From 4ff0ecd44352d9297e510506d58b85dea8e5fc80 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 21 Jan 2019 12:39:54 +0000 Subject: [PATCH 032/199] =?UTF-8?q?gist-logs:=20don=E2=80=99t=20upload=20o?= =?UTF-8?q?n=20unsupported=20configurations.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Library/Homebrew/cmd/gist-logs.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/Library/Homebrew/cmd/gist-logs.rb b/Library/Homebrew/cmd/gist-logs.rb index 975acbd65d..a3f259d44c 100644 --- a/Library/Homebrew/cmd/gist-logs.rb +++ b/Library/Homebrew/cmd/gist-logs.rb @@ -134,6 +134,7 @@ module Homebrew def gist_logs raise FormulaUnspecifiedError if ARGV.resolved_formulae.length != 1 + Install.perform_preinstall_checks(all_fatal: true) gistify_logs(ARGV.resolved_formulae.first) end end From 5363e0d4ce1449ff5a69f5360acd22e54d68a67a Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 21 Jan 2019 14:31:41 +0000 Subject: [PATCH 033/199] docs: update some legacy-homebrew commit URLs. Use the nice homebrew-core ones instead. --- docs/Common-Issues-for-Core-Contributors.md | 2 +- docs/Formula-Cookbook.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Common-Issues-for-Core-Contributors.md b/docs/Common-Issues-for-Core-Contributors.md index b0bea8c39c..a06052faba 100644 --- a/docs/Common-Issues-for-Core-Contributors.md +++ b/docs/Common-Issues-for-Core-Contributors.md @@ -11,4 +11,4 @@ This is a page for maintainers to diagnose certain build errors. The exact atom may be different. This can be caused by passing the obsolete `-s` flag to the linker and can be -fixed like [this](https://github.com/Homebrew/legacy-homebrew/commit/7c9a9334631dc84d59131ca57419e8c828b1574b). +fixed like [this](https://github.com/Homebrew/homebrew-core/commit/c4ad981d788b21a406a6efe7748f2922986919a8). diff --git a/docs/Formula-Cookbook.md b/docs/Formula-Cookbook.md index 3a618b6dcb..3923323613 100644 --- a/docs/Formula-Cookbook.md +++ b/docs/Formula-Cookbook.md @@ -187,7 +187,7 @@ Occasionally, these updates require a forced-recompile of the formula itself or When a dependent of a formula fails against a new version of that dependency it must receive a [`revision`](https://www.rubydoc.info/github/Homebrew/brew/master/Formula#revision%3D-class_method). An example of such failure can be seen [here](https://github.com/Homebrew/legacy-homebrew/issues/31195) and the fix [here](https://github.com/Homebrew/legacy-homebrew/pull/31207). -[`revision`](https://www.rubydoc.info/github/Homebrew/brew/master/Formula#revision%3D-class_method)s are also used for formulae that move from the system OpenSSL to the Homebrew-shipped OpenSSL without any other changes to that formula. This ensures users aren’t left exposed to the potential security issues of the outdated OpenSSL. An example of this can be seen in [this commit](https://github.com/Homebrew/legacy-homebrew/commit/6b9d60d474d72b1848304297d91adc6120ea6f96). +[`revision`](https://www.rubydoc.info/github/Homebrew/brew/master/Formula#revision%3D-class_method)s are also used for formulae that move from the system OpenSSL to the Homebrew-shipped OpenSSL without any other changes to that formula. This ensures users aren’t left exposed to the potential security issues of the outdated OpenSSL. An example of this can be seen in [this commit](https://github.com/Homebrew/homebrew-core/commit/0d4453a91923e6118983961e18d0609e9828a1a4). ### Version scheme changes From 234e4aec96297145e1760bc3d8ff6cc9f6f64713 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 21 Jan 2019 14:33:56 +0000 Subject: [PATCH 034/199] Improve use of default_prefix? in tests. --- Library/Homebrew/os/linux/global.rb | 2 +- Library/Homebrew/test/diagnostic_checks_spec.rb | 2 +- Library/Homebrew/test/support/lib/config.rb | 5 +++++ Library/Homebrew/test/utils/analytics_spec.rb | 11 +++++------ Library/Homebrew/utils/analytics.rb | 2 +- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Library/Homebrew/os/linux/global.rb b/Library/Homebrew/os/linux/global.rb index 67d80e4560..39114fab57 100644 --- a/Library/Homebrew/os/linux/global.rb +++ b/Library/Homebrew/os/linux/global.rb @@ -1,5 +1,5 @@ module Homebrew - DEFAULT_PREFIX = if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"] + DEFAULT_PREFIX ||= if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"] "/usr/local".freeze else "/home/linuxbrew/.linuxbrew".freeze diff --git a/Library/Homebrew/test/diagnostic_checks_spec.rb b/Library/Homebrew/test/diagnostic_checks_spec.rb index 74f0b57ab0..06be59c5c4 100644 --- a/Library/Homebrew/test/diagnostic_checks_spec.rb +++ b/Library/Homebrew/test/diagnostic_checks_spec.rb @@ -164,7 +164,7 @@ describe Homebrew::Diagnostic::Checks do end specify "#check_homebrew_prefix" do - # the integration tests are run in a special prefix + allow(Homebrew).to receive(:default_prefix?).and_return(false) expect(subject.check_homebrew_prefix) .to match("Your Homebrew's prefix is not #{Homebrew::DEFAULT_PREFIX}") end diff --git a/Library/Homebrew/test/support/lib/config.rb b/Library/Homebrew/test/support/lib/config.rb index a5ad271801..6d6de3368e 100644 --- a/Library/Homebrew/test/support/lib/config.rb +++ b/Library/Homebrew/test/support/lib/config.rb @@ -41,3 +41,8 @@ PATCH_B_SHA256 = "57958271bb802a59452d0816e0670d16c8b70bdf6530bcf6f78726489ad89b TEST_SHA1 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef".freeze TEST_SHA256 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef".freeze + +# For testing's sake always assume the default prefix +module Homebrew + DEFAULT_PREFIX = HOMEBREW_PREFIX.to_s.freeze +end diff --git a/Library/Homebrew/test/utils/analytics_spec.rb b/Library/Homebrew/test/utils/analytics_spec.rb index 3ec68224b4..29bdd04387 100644 --- a/Library/Homebrew/test/utils/analytics_spec.rb +++ b/Library/Homebrew/test/utils/analytics_spec.rb @@ -9,19 +9,18 @@ describe Utils::Analytics do end it "returns OS_VERSION and prefix when HOMEBREW_PREFIX is a custom prefix" do - stub_const("HOMEBREW_PREFIX", "blah") + allow(Homebrew).to receive(:default_prefix?).and_return(false) expect(described_class.os_prefix_ci).to include("#{OS_VERSION}, #{described_class.custom_prefix_label}") end + it "does not include prefix when HOMEBREW_PREFIX is the default prefix" do + expect(described_class.os_prefix_ci).not_to include(described_class.custom_prefix_label) + end + it "includes CI when ENV['CI'] is set" do ENV["CI"] = "true" expect(described_class.os_prefix_ci).to include("CI") end - - it "does not include prefix when HOMEBREW_PREFIX is the default prefix" do - stub_const("HOMEBREW_PREFIX", Homebrew::DEFAULT_PREFIX) - expect(described_class.os_prefix_ci).not_to include(described_class.custom_prefix_label) - end end end diff --git a/Library/Homebrew/utils/analytics.rb b/Library/Homebrew/utils/analytics.rb index 7283b5aece..31174451e1 100644 --- a/Library/Homebrew/utils/analytics.rb +++ b/Library/Homebrew/utils/analytics.rb @@ -16,7 +16,7 @@ module Utils def os_prefix_ci @os_prefix_ci ||= begin os = OS_VERSION - prefix = ", #{custom_prefix_label}" if Homebrew.default_prefix? + prefix = ", #{custom_prefix_label}" unless Homebrew.default_prefix? ci = ", CI" if ENV["CI"] "#{os}#{prefix}#{ci}" end From 589ed8e17c0720c3e78ce173be98129703c81e5a Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 21 Jan 2019 19:23:31 +0000 Subject: [PATCH 035/199] Tweak diagnostic checks - Make `gist-logs` perform more checks - Don't complain about a non-/usr/local install at install time unless actually building from source. - Show more checks output on a build error - Improve naming of checks methods --- Library/Homebrew/cmd/gist-logs.rb | 1 + Library/Homebrew/diagnostic.rb | 22 +++++------ Library/Homebrew/extend/os/mac/diagnostic.rb | 39 ++++++++------------ Library/Homebrew/formula_installer.rb | 2 +- Library/Homebrew/install.rb | 27 +++++++------- 5 files changed, 42 insertions(+), 49 deletions(-) diff --git a/Library/Homebrew/cmd/gist-logs.rb b/Library/Homebrew/cmd/gist-logs.rb index a3f259d44c..e606014b5c 100644 --- a/Library/Homebrew/cmd/gist-logs.rb +++ b/Library/Homebrew/cmd/gist-logs.rb @@ -135,6 +135,7 @@ module Homebrew raise FormulaUnspecifiedError if ARGV.resolved_formulae.length != 1 Install.perform_preinstall_checks(all_fatal: true) + Install.perform_build_from_source_checks(all_fatal: true) gistify_logs(ARGV.resolved_formulae.first) end end diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 6d4db3f638..7eff0334c0 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -73,30 +73,28 @@ module Homebrew end ############# END HELPERS - def fatal_install_checks + def fatal_preinstall_checks %w[ check_access_directories ].freeze end + def fatal_build_from_source_checks + %w[ + check_for_installed_developer_tools + ].freeze + end + def supported_configuration_checks [].freeze end - def development_tools_checks - %w[ - check_for_installed_developer_tools - ].freeze - end - - def fatal_development_tools_checks - %w[ - ].freeze + def build_from_source_checks + [].freeze end def build_error_checks - (development_tools_checks + %w[ - ]).freeze + supported_configuration_checks + build_from_source_checks end def please_create_pull_requests(what = "unsupported configuration") diff --git a/Library/Homebrew/extend/os/mac/diagnostic.rb b/Library/Homebrew/extend/os/mac/diagnostic.rb index 6bbd51e551..c4669c9baa 100644 --- a/Library/Homebrew/extend/os/mac/diagnostic.rb +++ b/Library/Homebrew/extend/os/mac/diagnostic.rb @@ -1,38 +1,31 @@ module Homebrew module Diagnostic class Checks - undef supported_configuration_checks, development_tools_checks, - fatal_development_tools_checks, build_error_checks + undef fatal_build_from_source_checks, supported_configuration_checks, + build_from_source_checks - def supported_configuration_checks + def fatal_build_from_source_checks %w[ - check_build_from_source - check_homebrew_prefix - check_for_unsupported_macos - ].freeze - end - - def development_tools_checks - %w[ - check_for_installed_developer_tools check_xcode_license_approved - check_xcode_up_to_date - check_clt_up_to_date - ].freeze - end - - def fatal_development_tools_checks - %w[ check_xcode_minimum_version check_clt_minimum_version check_if_xcode_needs_clt_installed ].freeze end - def build_error_checks - (development_tools_checks + %w[ + def supported_configuration_checks + %w[ + check_build_from_source check_for_unsupported_macos - ]).freeze + ].freeze + end + + def build_from_source_checks + %w[ + check_for_installed_developer_tools + check_xcode_up_to_date + check_clt_up_to_date + ].freeze end def check_for_non_prefixed_findutils @@ -198,7 +191,7 @@ module Homebrew <<~EOS You have not agreed to the Xcode license. - Builds will fail! Agree to the license by opening Xcode.app or running: + Agree to the license by opening Xcode.app or running: sudo xcodebuild -license EOS end diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 6db812a434..fd8c233b52 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -209,7 +209,7 @@ class FormulaInstaller def install start_time = Time.now if !formula.bottle_unneeded? && !pour_bottle? && DevelopmentTools.installed? - Homebrew::Install.perform_development_tools_checks + Homebrew::Install.perform_build_from_source_checks end # not in initialize so upgrade can unlink the active keg before calling this diff --git a/Library/Homebrew/install.rb b/Library/Homebrew/install.rb index e5bd6e8459..1f14f2c4cf 100644 --- a/Library/Homebrew/install.rb +++ b/Library/Homebrew/install.rb @@ -17,16 +17,6 @@ module Homebrew end end - def check_cc_argv - return unless ARGV.cc - - @checks ||= Diagnostic::Checks.new - opoo <<~EOS - You passed `--cc=#{ARGV.cc}`. - #{@checks.please_create_pull_requests} - EOS - end - def attempt_directory_creation Keg::MUST_EXIST_DIRECTORIES.each do |dir| begin @@ -37,8 +27,14 @@ module Homebrew end end - def perform_development_tools_checks - diagnostic_checks(:fatal_development_tools_checks) + def check_cc_argv + return unless ARGV.cc + + @checks ||= Diagnostic::Checks.new + opoo <<~EOS + You passed `--cc=#{ARGV.cc}`. + #{@checks.please_create_pull_requests} + EOS end def perform_preinstall_checks(all_fatal: false) @@ -46,11 +42,16 @@ module Homebrew attempt_directory_creation check_cc_argv diagnostic_checks(:supported_configuration_checks, fatal: all_fatal) - diagnostic_checks(:fatal_install_checks) + diagnostic_checks(:fatal_preinstall_checks) end alias generic_perform_preinstall_checks perform_preinstall_checks module_function :generic_perform_preinstall_checks + def perform_build_from_source_checks(all_fatal: false) + diagnostic_checks(:fatal_build_from_source_checks) + diagnostic_checks(:build_from_source_checks, fatal: all_fatal) + end + def diagnostic_checks(type, fatal: true) @checks ||= Diagnostic::Checks.new failed = false From 114d5b091b0575f8926fb32e69ebe87c9a717cae Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Tue, 22 Jan 2019 01:41:45 +0530 Subject: [PATCH 036/199] sh: Use CLI::Parser to parse args --- Library/Homebrew/cmd/sh.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Library/Homebrew/cmd/sh.rb b/Library/Homebrew/cmd/sh.rb index 73bf72044a..071f098917 100644 --- a/Library/Homebrew/cmd/sh.rb +++ b/Library/Homebrew/cmd/sh.rb @@ -9,11 +9,31 @@ require "extend/ENV" require "formula" +require "cli_parser" module Homebrew module_function + def sh_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `sh` [] + + Start a Homebrew build environment shell. Uses our years-battle-hardened + Homebrew build logic to help your `./configure && make && make install` + or even your `gem install` succeed. Especially handy if you run Homebrew + in an Xcode-only configuration since it adds tools like `make` to your `PATH` + which otherwise build systems would not find. + EOS + flag "--env=", + description: "Use the standard `PATH` instead of superenv's, when is passed" + switch :verbose + switch :debug + end + end + def sh + sh_args.parse ENV.activate_extensions! if superenv? From 88b98969a57bce0359d1e57d3282754ca906e4b5 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 21 Jan 2019 20:17:59 +0000 Subject: [PATCH 037/199] bottle: detect vim's lack of relocatableness. References https://github.com/Homebrew/homebrew-core/issues/35236. --- Library/Homebrew/dev-cmd/bottle.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 3c7cdf3368..66ae74b278 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -365,6 +365,7 @@ module Homebrew relocatable = false if keg_contain_absolute_symlink_starting_with?(prefix, keg) relocatable = false if keg_contain?("#{prefix}/etc", keg, ignores) relocatable = false if keg_contain?("#{prefix}/var", keg, ignores) + relocatable = false if keg_contain?("#{prefix}/share/vim", keg, ignores) end skip_relocation = relocatable && !keg.require_relocation? end From 79f3ff0a4e5ecf97f6c9fb093e549d04755a09f6 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 21 Jan 2019 21:35:24 +0000 Subject: [PATCH 038/199] cleanup: also consider ctime on prunes. If this is an old tarball then we may end up removing it otherwise if we've respected the `mtime` from the server on download. --- Library/Homebrew/cleanup.rb | 7 +++++-- Library/Homebrew/test/cleanup_spec.rb | 11 ++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/cleanup.rb b/Library/Homebrew/cleanup.rb index 8851b30855..e11dc893ec 100644 --- a/Library/Homebrew/cleanup.rb +++ b/Library/Homebrew/cleanup.rb @@ -52,7 +52,7 @@ module CleanupRefinement return true if symlink? && !exist? - mtime < days.days.ago + mtime < days.days.ago && ctime < days.days.ago end def stale?(scrub = false) @@ -124,7 +124,10 @@ module CleanupRefinement return true if scrub && !cask.versions.include?(cask.version) - return mtime < CLEANUP_DEFAULT_DAYS.days.ago if cask.version.latest? + if cask.version.latest? + return mtime < CLEANUP_DEFAULT_DAYS.days.ago && + ctime < CLEANUP_DEFAULT_DAYS.days.ago + end false end diff --git a/Library/Homebrew/test/cleanup_spec.rb b/Library/Homebrew/test/cleanup_spec.rb index 36b8eafd4c..9b3df12c8c 100644 --- a/Library/Homebrew/test/cleanup_spec.rb +++ b/Library/Homebrew/test/cleanup_spec.rb @@ -15,12 +15,13 @@ describe CleanupRefinement do path.mkpath end - it "returns true when path_modified_time < days_default" do + it "returns true when ctime and mtime < days_default" do + allow_any_instance_of(Pathname).to receive(:ctime).and_return(2.days.ago) allow_any_instance_of(Pathname).to receive(:mtime).and_return(2.days.ago) expect(path.prune?(1)).to be true end - it "returns false when path_modified_time >= days_default" do + it "returns false when ctime and mtime >= days_default" do expect(path.prune?(2)).to be false end end @@ -181,7 +182,8 @@ describe Homebrew::Cleanup do it "removes the download for the latest version after 30 days" do download = Cask::Cache.path/"#{cask.token}--#{cask.version}" - FileUtils.touch download, mtime: 30.days.ago - 1.hour + allow(download).to receive(:ctime).and_return(30.days.ago - 1.hour) + allow(download).to receive(:mtime).and_return(30.days.ago - 1.hour) subject.cleanup_cask(cask) @@ -203,12 +205,14 @@ describe Homebrew::Cleanup do end it "cleans up logs if older than 30 days" do + allow_any_instance_of(Pathname).to receive(:ctime).and_return(31.days.ago) allow_any_instance_of(Pathname).to receive(:mtime).and_return(31.days.ago) subject.cleanup_logs expect(path).not_to exist end it "does not clean up logs less than 30 days old" do + allow_any_instance_of(Pathname).to receive(:ctime).and_return(15.days.ago) allow_any_instance_of(Pathname).to receive(:mtime).and_return(15.days.ago) subject.cleanup_logs expect(path).to exist @@ -307,6 +311,7 @@ describe Homebrew::Cleanup do it "cleans up VCS checkout directories with modified time < prune time" do foo = (HOMEBREW_CACHE/"--foo") foo.mkpath + allow_any_instance_of(Pathname).to receive(:ctime).and_return(Time.now - 2 * 60 * 60 * 24) allow_any_instance_of(Pathname).to receive(:mtime).and_return(Time.now - 2 * 60 * 60 * 24) described_class.new(days: 1).cleanup_cache expect(foo).not_to exist From 21036e1d58d7ac49c5598b7f52ca8edd8907881c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Tue, 22 Jan 2019 03:04:15 +0000 Subject: [PATCH 039/199] Bump rubocop from 0.63.0 to 0.63.1 in /Library/Homebrew/test Bumps [rubocop](https://github.com/rubocop-hq/rubocop) from 0.63.0 to 0.63.1. - [Release notes](https://github.com/rubocop-hq/rubocop/releases) - [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.63.0...v0.63.1) Signed-off-by: dependabot[bot] --- Library/Homebrew/test/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/test/Gemfile.lock b/Library/Homebrew/test/Gemfile.lock index a8f8662482..fa60a178e1 100644 --- a/Library/Homebrew/test/Gemfile.lock +++ b/Library/Homebrew/test/Gemfile.lock @@ -46,7 +46,7 @@ GEM rspec-support (3.8.0) rspec-wait (0.0.9) rspec (>= 3, < 4) - rubocop (0.63.0) + rubocop (0.63.1) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.5, != 2.5.1.1) From 72f31c5072a659c4f24a1760199883a4bb7198fc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Tue, 22 Jan 2019 06:28:40 +0000 Subject: [PATCH 040/199] Bump rubocop from 0.63.0 to 0.63.1 in /Library/Homebrew/vendor Bumps [rubocop](https://github.com/rubocop-hq/rubocop) from 0.63.0 to 0.63.1. - [Release notes](https://github.com/rubocop-hq/rubocop/releases) - [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.63.0...v0.63.1) Signed-off-by: dependabot[bot] --- Library/Homebrew/vendor/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/vendor/Gemfile.lock b/Library/Homebrew/vendor/Gemfile.lock index 7dba7589fb..a4af8aed24 100644 --- a/Library/Homebrew/vendor/Gemfile.lock +++ b/Library/Homebrew/vendor/Gemfile.lock @@ -19,7 +19,7 @@ GEM plist (3.5.0) powerpack (0.1.2) rainbow (3.0.0) - rubocop (0.63.0) + rubocop (0.63.1) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.5, != 2.5.1.1) From f0e3d4faf2c58b2ba48aeb3de7e68a1eea8d2c69 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Tue, 22 Jan 2019 06:28:51 +0000 Subject: [PATCH 041/199] Bump i18n from 1.5.2 to 1.5.3 in /Library/Homebrew/vendor Bumps [i18n](https://github.com/svenfuchs/i18n) from 1.5.2 to 1.5.3. - [Release notes](https://github.com/svenfuchs/i18n/releases) - [Changelog](https://github.com/ruby-i18n/i18n/blob/master/CHANGELOG.md) - [Commits](https://github.com/svenfuchs/i18n/compare/v1.5.2...v1.5.3) Signed-off-by: dependabot[bot] --- Library/Homebrew/vendor/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/vendor/Gemfile.lock b/Library/Homebrew/vendor/Gemfile.lock index 7dba7589fb..70b9d1bb9c 100644 --- a/Library/Homebrew/vendor/Gemfile.lock +++ b/Library/Homebrew/vendor/Gemfile.lock @@ -9,7 +9,7 @@ GEM ast (2.4.0) backports (3.11.4) concurrent-ruby (1.1.4) - i18n (1.5.2) + i18n (1.5.3) concurrent-ruby (~> 1.0) jaro_winkler (1.5.2) minitest (5.11.3) From a8876692a483c793b9eac020fb82ea13a178bfca Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 22 Jan 2019 09:38:03 +0000 Subject: [PATCH 042/199] brew vendor-gems: commit updates. --- .../vendor/bundle-standalone/bundler/setup.rb | 2 +- .../gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n.rb | 0 .../{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/backend.rb | 0 .../lib/i18n/backend/base.rb | 14 ++++++++------ .../lib/i18n/backend/cache.rb | 0 .../lib/i18n/backend/cache_file.rb | 0 .../lib/i18n/backend/cascade.rb | 0 .../lib/i18n/backend/chain.rb | 0 .../lib/i18n/backend/fallbacks.rb | 0 .../lib/i18n/backend/flatten.rb | 0 .../lib/i18n/backend/gettext.rb | 0 .../lib/i18n/backend/interpolation_compiler.rb | 0 .../lib/i18n/backend/key_value.rb | 0 .../lib/i18n/backend/memoize.rb | 0 .../lib/i18n/backend/metadata.rb | 0 .../lib/i18n/backend/pluralization.rb | 0 .../lib/i18n/backend/simple.rb | 0 .../lib/i18n/backend/transliterator.rb | 0 .../{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/config.rb | 0 .../lib/i18n/core_ext/hash.rb | 0 .../lib/i18n/exceptions.rb | 0 .../{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/gettext.rb | 0 .../lib/i18n/gettext/helpers.rb | 0 .../lib/i18n/gettext/po_parser.rb | 0 .../lib/i18n/interpolate/ruby.rb | 0 .../{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/locale.rb | 0 .../lib/i18n/locale/fallbacks.rb | 0 .../lib/i18n/locale/tag.rb | 0 .../lib/i18n/locale/tag/parents.rb | 0 .../lib/i18n/locale/tag/rfc4646.rb | 0 .../lib/i18n/locale/tag/simple.rb | 0 .../lib/i18n/middleware.rb | 0 .../{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/version.rb | 2 +- 33 files changed, 10 insertions(+), 8 deletions(-) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/backend.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/backend/base.rb (91%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/backend/cache.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/backend/cache_file.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/backend/cascade.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/backend/chain.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/backend/fallbacks.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/backend/flatten.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/backend/gettext.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/backend/interpolation_compiler.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/backend/key_value.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/backend/memoize.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/backend/metadata.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/backend/pluralization.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/backend/simple.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/backend/transliterator.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/config.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/core_ext/hash.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/exceptions.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/gettext.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/gettext/helpers.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/gettext/po_parser.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/interpolate/ruby.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/locale.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/locale/fallbacks.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/locale/tag.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/locale/tag/parents.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/locale/tag/rfc4646.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/locale/tag/simple.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/middleware.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{i18n-1.5.2 => i18n-1.5.3}/lib/i18n/version.rb (70%) diff --git a/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb b/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb index 7db420ea56..5249798143 100644 --- a/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb @@ -4,7 +4,7 @@ ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby' ruby_version = RbConfig::CONFIG["ruby_version"] path = File.expand_path('..', __FILE__) $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/concurrent-ruby-1.1.4/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.5.2/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.5.3/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.11.3/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/thread_safe-0.3.6/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-1.2.5/lib" diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/base.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/base.rb similarity index 91% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/base.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/base.rb index 061d6b1e78..769ef46b53 100644 --- a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/base.rb +++ b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/base.rb @@ -250,14 +250,16 @@ module I18n def translate_localization_format(locale, object, format, options) format.to_s.gsub(/%[aAbBpP]/) do |match| case match - when '%a' then I18n.t(:"date.abbr_day_names", :locale => locale, :format => format)[object.wday] - when '%A' then I18n.t(:"date.day_names", :locale => locale, :format => format)[object.wday] - when '%b' then I18n.t(:"date.abbr_month_names", :locale => locale, :format => format)[object.mon] - when '%B' then I18n.t(:"date.month_names", :locale => locale, :format => format)[object.mon] - when '%p' then I18n.t(:"time.#{object.hour < 12 ? :am : :pm}", :locale => locale, :format => format).upcase if object.respond_to? :hour - when '%P' then I18n.t(:"time.#{object.hour < 12 ? :am : :pm}", :locale => locale, :format => format).downcase if object.respond_to? :hour + when '%a' then I18n.t!(:"date.abbr_day_names", :locale => locale, :format => format)[object.wday] + when '%A' then I18n.t!(:"date.day_names", :locale => locale, :format => format)[object.wday] + when '%b' then I18n.t!(:"date.abbr_month_names", :locale => locale, :format => format)[object.mon] + when '%B' then I18n.t!(:"date.month_names", :locale => locale, :format => format)[object.mon] + when '%p' then I18n.t!(:"time.#{object.hour < 12 ? :am : :pm}", :locale => locale, :format => format).upcase if object.respond_to? :hour + when '%P' then I18n.t!(:"time.#{object.hour < 12 ? :am : :pm}", :locale => locale, :format => format).downcase if object.respond_to? :hour end end + rescue MissingTranslationData => e + e.message end def pluralization_key(entry, count) diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/cache.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/cache.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/cache.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/cache.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/cache_file.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/cache_file.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/cache_file.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/cache_file.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/cascade.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/cascade.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/cascade.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/cascade.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/chain.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/chain.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/chain.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/chain.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/fallbacks.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/fallbacks.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/fallbacks.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/fallbacks.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/flatten.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/flatten.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/flatten.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/flatten.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/gettext.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/gettext.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/gettext.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/gettext.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/interpolation_compiler.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/interpolation_compiler.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/interpolation_compiler.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/interpolation_compiler.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/key_value.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/key_value.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/key_value.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/key_value.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/memoize.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/memoize.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/memoize.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/memoize.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/metadata.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/metadata.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/metadata.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/metadata.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/pluralization.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/pluralization.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/pluralization.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/pluralization.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/simple.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/simple.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/simple.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/simple.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/transliterator.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/transliterator.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/backend/transliterator.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/backend/transliterator.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/config.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/config.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/config.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/config.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/core_ext/hash.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/core_ext/hash.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/core_ext/hash.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/core_ext/hash.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/exceptions.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/exceptions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/exceptions.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/exceptions.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/gettext.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/gettext.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/gettext.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/gettext.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/gettext/helpers.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/gettext/helpers.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/gettext/helpers.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/gettext/helpers.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/gettext/po_parser.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/gettext/po_parser.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/gettext/po_parser.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/gettext/po_parser.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/interpolate/ruby.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/interpolate/ruby.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/interpolate/ruby.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/interpolate/ruby.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/locale.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/locale.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/locale.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/locale.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/locale/fallbacks.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/locale/fallbacks.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/locale/fallbacks.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/locale/fallbacks.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/locale/tag.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/locale/tag.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/locale/tag.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/locale/tag.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/locale/tag/parents.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/locale/tag/parents.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/locale/tag/parents.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/locale/tag/parents.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/locale/tag/rfc4646.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/locale/tag/rfc4646.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/locale/tag/rfc4646.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/locale/tag/rfc4646.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/locale/tag/simple.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/locale/tag/simple.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/locale/tag/simple.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/locale/tag/simple.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/middleware.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/middleware.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/middleware.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/middleware.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/version.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/version.rb similarity index 70% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/version.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/version.rb index cd4e224b14..7cd24bf635 100644 --- a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.2/lib/i18n/version.rb +++ b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/i18n-1.5.3/lib/i18n/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module I18n - VERSION = "1.5.2" + VERSION = "1.5.3" end From 620294c2b6193cfa5c4d12ffc3709d93799d9c9d Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 22 Jan 2019 09:38:36 +0000 Subject: [PATCH 043/199] brew vendor-gems: commit updates. --- Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb b/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb index 7db420ea56..b7859effef 100644 --- a/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb @@ -21,6 +21,6 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/powerpack-0.1.2/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rainbow-3.0.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.10.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.4.1/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.63.0/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.63.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.31.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.1.0/lib" From db7fd7b7a2f37a896f7b795bd98f59996c1b9fd8 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 22 Jan 2019 13:30:24 +0000 Subject: [PATCH 044/199] Tweak audits - Ensure that new formulae problems aren't duplicated - Now that homebrew/core will imminently not have options adjust the various audits so they make more sense (and exclude taps) - Exclude taps from more preferential audits --- Library/Homebrew/dev-cmd/audit.rb | 59 ++++++++----------- Library/Homebrew/rubocops/options.rb | 21 +++---- .../Homebrew/test/rubocops/options_spec.rb | 16 ++--- 3 files changed, 41 insertions(+), 55 deletions(-) diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 02968fd412..a5afaf6789 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -202,7 +202,7 @@ module Homebrew end def format_problem_lines(problems) - problems.map { |p| "* #{p.chomp.gsub("\n", "\n ")}" } + problems.uniq.map { |p| "* #{p.chomp.gsub("\n", "\n ")}" } end class FormulaText @@ -405,7 +405,6 @@ module Homebrew @specs.each do |spec| # Check for things we don't like to depend on. # We allow non-Homebrew installs whenever possible. - options_message = "Formulae should not have optional or recommended dependencies" spec.deps.each do |dep| begin dep_f = dep.to_formula @@ -434,7 +433,7 @@ module Homebrew if @new_formula && dep_f.keg_only_reason && !["openssl", "apr", "apr-util"].include?(dep.name) && - (!["openblas"].include?(dep.name) || @core_tap) && + !["openblas"].include?(dep.name) && dep_f.keg_only_reason.reason == :provided_by_macos new_formula_problem( "Dependency '#{dep.name}' may be unnecessary as it is provided " \ @@ -443,6 +442,7 @@ module Homebrew end dep.options.each do |opt| + next if @core_tap next if dep_f.option_defined?(opt) next if dep_f.requirements.find do |r| if r.recommended? @@ -463,19 +463,17 @@ module Homebrew problem "Dependency '#{dep.name}' is marked as :run. Remove :run; it is a no-op." end - next unless @new_formula next unless @core_tap if dep.tags.include?(:recommended) || dep.tags.include?(:optional) - new_formula_problem options_message + problem "Formulae should not have optional or recommended dependencies" end end - next unless @new_formula next unless @core_tap if spec.requirements.map(&:recommended?).any? || spec.requirements.map(&:optional?).any? - new_formula_problem options_message + problem "Formulae should not have optional or recommended requirements" end end end @@ -529,6 +527,8 @@ module Homebrew def audit_postgresql return unless formula.name == "postgresql" + return unless @core_tap + major_version = formula.version .to_s .split(".") @@ -602,20 +602,16 @@ module Homebrew return unless formula.bottle_disabled? return if formula.bottle_unneeded? - if !formula.bottle_disable_reason.valid? + unless formula.bottle_disable_reason.valid? problem "Unrecognized bottle modifier" - else - bottle_disabled_whitelist = %w[ - cryptopp - leafnode - ] - return if bottle_disabled_whitelist.include?(formula.name) - - problem "Formulae should not use `bottle :disabled`" if @core_tap end + + return unless @core_tap + problem "Formulae should not use `bottle :disabled`" end def audit_github_repository + return unless @core_tap return unless @online return unless @new_formula @@ -635,8 +631,7 @@ module Homebrew return if metadata.nil? new_formula_problem "GitHub fork (not canonical repository)" if metadata["fork"] - if @core_tap && - (metadata["forks_count"] < 30) && (metadata["subscribers_count"] < 30) && + if (metadata["forks_count"] < 30) && (metadata["subscribers_count"] < 30) && (metadata["stargazers_count"] < 75) new_formula_problem "GitHub repository not notable enough (<30 forks, <30 watchers and <75 stars)" end @@ -647,13 +642,8 @@ module Homebrew end def audit_specs - if head_only?(formula) && formula.tap.to_s.downcase !~ %r{[-/]head-only$} - problem "Head-only (no stable download)" - end - - if devel_only?(formula) && formula.tap.to_s.downcase !~ %r{[-/]devel-only$} - problem "Devel-only (no stable download)" - end + problem "Head-only (no stable download)" if head_only?(formula) + problem "Devel-only (no stable download)" if devel_only?(formula) %w[Stable Devel HEAD].each do |name| spec_name = name.downcase.to_sym @@ -698,11 +688,11 @@ module Homebrew end end - if @core_tap && formula.devel - problem "Formulae should not have a `devel` spec" - end + return unless @core_tap - if @core_tap && formula.head + problem "Formulae should not have a `devel` spec" if formula.devel + + if formula.head head_spec_message = "Formulae should not have a `HEAD` spec" if @new_formula new_formula_problem head_spec_message @@ -922,10 +912,6 @@ module Homebrew return unless @strict - if @core_tap && line.include?("env :std") - problem "`env :std` in `core` formulae is deprecated" - end - if line.include?("env :userpaths") problem "`env :userpaths` in formulae is deprecated" end @@ -944,13 +930,18 @@ module Homebrew problem "Use \#{pkgshare} instead of \#{share}/#{formula.name}" end - if line =~ /depends_on .+ if build\.with(out)?\?\(?["']\w+["']\)?/ + if !@core_tap && line =~ /depends_on .+ if build\.with(out)?\?\(?["']\w+["']\)?/ problem "`Use :optional` or `:recommended` instead of `#{Regexp.last_match(0)}`" end return unless line =~ %r{share(\s*[/+]\s*)(['"])#{Regexp.escape(formula.name)}(?:\2|/)} problem "Use pkgshare instead of (share#{Regexp.last_match(1)}\"#{formula.name}\")" + + return unless @core_tap + + return unless line.include?("env :std") + problem "`env :std` in `core` formulae is deprecated" end def audit_reverse_migration diff --git a/Library/Homebrew/rubocops/options.rb b/Library/Homebrew/rubocops/options.rb index a5eaac00fd..a5a0c5e870 100644 --- a/Library/Homebrew/rubocops/options.rb +++ b/Library/Homebrew/rubocops/options.rb @@ -8,6 +8,9 @@ module RuboCop DEPRECATION_MSG = "macOS has been 64-bit only since 10.6 so 32-bit options are deprecated.".freeze UNI_DEPRECATION_MSG = "macOS has been 64-bit only since 10.6 so universal options are deprecated.".freeze + DEP_OPTION = "Formulae should not use `deprecated_option`".freeze + OPTION = "Formulae should not have an `option`".freeze + def audit_formula(_node, _class_node, _parent_class_node, body_node) option_call_nodes = find_every_method_call_by_name(body_node, :option) option_call_nodes.each do |option_call| @@ -33,22 +36,20 @@ module RuboCop problem "Use '--with#{Regexp.last_match(1)}-test' instead of '--#{option}'."\ " Migrate '--#{option}' with `deprecated_option`." end - end - end - end - module NewFormulaAudit - class Options < FormulaCop - DEP_OPTION = "New formulae should not use `deprecated_option`".freeze - OPTION = "Formulae should not have an `option`".freeze - - def audit_formula(_node, _class_node, _parent_class_node, body_node) - problem DEP_OPTION if method_called_ever?(body_node, :deprecated_option) return unless formula_tap == "homebrew-core" + problem DEP_OPTION if method_called_ever?(body_node, :deprecated_option) problem OPTION if method_called_ever?(body_node, :option) end end end + + # Keep this (empty) module and class around in case we need it later to + # avoid deleting all the NewFormulaAudit referencing logic. + module NewFormulaAudit + class Options < FormulaCop + end + end end end diff --git a/Library/Homebrew/test/rubocops/options_spec.rb b/Library/Homebrew/test/rubocops/options_spec.rb index 440a56fd96..a2eac92d8f 100644 --- a/Library/Homebrew/test/rubocops/options_spec.rb +++ b/Library/Homebrew/test/rubocops/options_spec.rb @@ -24,7 +24,7 @@ describe RuboCop::Cop::FormulaAudit::Options do RUBY end - it "with deprecated options" do + it "with bad option names" do expect_offense(<<~RUBY) class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' @@ -35,7 +35,7 @@ describe RuboCop::Cop::FormulaAudit::Options do RUBY end - it "with misc deprecated options" do + it "with without-check option name" do expect_offense(<<~RUBY) class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' @@ -44,19 +44,13 @@ describe RuboCop::Cop::FormulaAudit::Options do end RUBY end - end -end -describe RuboCop::Cop::NewFormulaAudit::Options do - subject(:cop) { described_class.new } - - context "When auditing options for a new formula" do - it "with deprecated options" do - expect_offense(<<~RUBY) + it "with deprecated_optionss" do + expect_offense(<<~RUBY, "/homebrew-core/") class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' deprecated_option "examples" => "with-examples" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ New formulae should not use `deprecated_option` + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Formulae should not use `deprecated_option` end RUBY end From 8bfde013f631ec5026313c9194ec2fff8cfc5f01 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 22 Jan 2019 14:20:24 +0000 Subject: [PATCH 045/199] utils: fix SVN remote test on Mojave. For some reason Mojave needs the SSL args always set otherwise this will always fail waiting for interactivity. Also, while debugging this I noticed that `utils.rb` had a failure expecting an integer so fix that too. --- Library/Homebrew/utils.rb | 2 +- Library/Homebrew/utils/svn.rb | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 98677b1976..9f68554e7f 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -291,7 +291,7 @@ module Homebrew $times = {} at_exit do - col_width = [$times.keys.map(&:size).max + 2, 15].max + col_width = [$times.keys.map(&:size).max.to_i + 2, 15].max $times.sort_by { |_k, v| v }.each do |method, time| puts format("%-*s %0.4f sec", col_width, "#{method}:", time) end diff --git a/Library/Homebrew/utils/svn.rb b/Library/Homebrew/utils/svn.rb index b824e0d064..23c9fe13d4 100644 --- a/Library/Homebrew/utils/svn.rb +++ b/Library/Homebrew/utils/svn.rb @@ -12,7 +12,9 @@ module Utils def self.svn_remote_exists?(url) return true unless svn_available? - ssl_args = ["--non-interactive", "--trust-server-cert"] if ENV["HOMEBREW_TEST_ONLINE"] - quiet_system "svn", "ls", url, "--depth", "empty", *ssl_args + # OK to unconditionally trust here because we're just checking if + # a URL exists. + quiet_system "svn", "ls", url, "--depth", "empty", + "--non-interactive", "--trust-server-cert" end end From 7b6d1f774d62b5f68326257dc43bb1cfad155c24 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Wed, 23 Jan 2019 08:34:24 +0530 Subject: [PATCH 046/199] deps: Use CLI::Parser to parse args --- Library/Homebrew/cmd/deps.rb | 96 ++++++++++++++++++++++++++---------- 1 file changed, 70 insertions(+), 26 deletions(-) diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index 13c2e85904..b2f038c286 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -54,51 +54,95 @@ require "formula" require "ostruct" +require "cli_parser" module Homebrew module_function + def deps_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `deps` [] + + Show dependencies for . When given multiple formula arguments, + show the intersection of dependencies for . + EOS + switch "--1", + description: "Only show dependencies one level down, instead of recursing." + switch "-n", + description: "Show dependencies in topological order." + switch "--union", + description: "Show the union of dependencies for , instead of the intersection." + switch "--full-name", + description: "List dependencies by their full name." + switch "--installed", + description: "Only list those dependencies that are currently installed." + switch "--all", + description: "List all the dependencies for all available formuale." + switch "--include-build", + description: "Show `:build` type dependencies for ." + switch "--include-optional", + description: "Show `:optional` dependecies for ." + switch "--include-test", + description: "Show `:test` dependencies for (non-recursive)." + switch "--skip-recommended", + description: "Skip `:recommended` type dependencies for ." + switch "--include-requirements", + description: "Include requirements in addition to dependencies for ." + switch "--tree", + description: "Show dependencies as a tree. When given multiple formula arguments "\ + "output individual trees for every formula." + switch "--for-each", + description: "Switch into the mode used by `deps --all`, but only list dependencies "\ + "for specified formula one specified formula per line. This is used for "\ + "debugging the `--installed`/`--all` display mode." + switch :verbose + switch :debug + end + end + def deps + deps_args.parse mode = OpenStruct.new( - installed?: ARGV.include?("--installed"), - tree?: ARGV.include?("--tree"), - all?: ARGV.include?("--all"), - topo_order?: ARGV.include?("-n"), - union?: ARGV.include?("--union"), - for_each?: ARGV.include?("--for-each"), + installed?: args.installed?, + tree?: args.tree?, + all?: args.all?, + topo_order?: args.n?, + union?: args.union?, + for_each?: args.for_each?, ) if mode.tree? if mode.installed? - puts_deps_tree Formula.installed.sort, !ARGV.one? + puts_deps_tree Formula.installed.sort, !args.send("1?") else - raise FormulaUnspecifiedError if ARGV.named.empty? + raise FormulaUnspecifiedError if args.remaining.empty? - puts_deps_tree ARGV.formulae, !ARGV.one? + puts_deps_tree ARGV.formulae, !args.send("1?") end return elsif mode.all? puts_deps Formula.sort return - elsif !ARGV.named.empty? && mode.for_each? + elsif !args.remaining.empty? && mode.for_each? puts_deps ARGV.formulae return end - @only_installed_arg = ARGV.include?("--installed") && - !ARGV.include?("--include-build") && - !ARGV.include?("--include-test") && - !ARGV.include?("--include-optional") && - !ARGV.include?("--skip-recommended") + @only_installed_arg = args.installed? && + !args.include_build? && + !args.include_test? && + !args.include_optional? && + !args.skip_recommended? - if ARGV.named.empty? + if args.remaining.empty? raise FormulaUnspecifiedError unless mode.installed? puts_deps Formula.installed.sort return end - all_deps = deps_for_formulae(ARGV.formulae, !ARGV.one?, &(mode.union? ? :| : :&)) + all_deps = deps_for_formulae(ARGV.formulae, !args.send("1?"), &(mode.union? ? :| : :&)) all_deps = condense_requirements(all_deps) all_deps.select!(&:installed?) if mode.installed? all_deps.map!(&method(:dep_display_name)) @@ -108,26 +152,26 @@ module Homebrew end def condense_requirements(deps) - return deps if ARGV.include?("--include-requirements") + return deps if args.include_requirements? deps.select { |dep| dep.is_a? Dependency } end def dep_display_name(dep) str = if dep.is_a? Requirement - if ARGV.include?("--include-requirements") + if args.include_requirements? ":#{dep.display_s}" else # This shouldn't happen, but we'll put something here to help debugging "::#{dep.name}" end - elsif ARGV.include?("--full-name") + elsif args.full_name? dep.to_formula.full_name else dep.name end - if ARGV.include?("--annotate") + if args.annotate? str = "#{str} [build]" if dep.build? str = "#{str} [test]" if dep.test? str = "#{str} [optional]" if dep.optional? @@ -180,14 +224,14 @@ module Homebrew reqs = f.requirements deps = f.deps dependables = reqs + deps - dependables.reject!(&:optional?) unless ARGV.include?("--include-optional") - dependables.reject!(&:build?) unless ARGV.include?("--include-build") - dependables.reject!(&:test?) unless ARGV.include?("--include-test") - dependables.reject!(&:recommended?) if ARGV.include?("--skip-recommended") + dependables.reject!(&:optional?) unless args.include_optional? + dependables.reject!(&:build?) unless args.include_build? + dependables.reject!(&:test?) unless args.include_test? + dependables.reject!(&:recommended?) if args.skip_recommended? max = dependables.length - 1 @dep_stack.push f.name dependables.each_with_index do |dep, i| - next if !ARGV.include?("--include-requirements") && dep.is_a?(Requirement) + next if !args.include_requirements? && dep.is_a?(Requirement) tree_lines = if i == max "└──" From 382b5447d8695856256750e1af587dd9976a14b3 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Wed, 23 Jan 2019 09:20:49 +0530 Subject: [PATCH 047/199] gits-logs: Use CLI::Parser to parse args --- Library/Homebrew/cmd/gist-logs.rb | 34 ++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/cmd/gist-logs.rb b/Library/Homebrew/cmd/gist-logs.rb index 975acbd65d..d791924182 100644 --- a/Library/Homebrew/cmd/gist-logs.rb +++ b/Library/Homebrew/cmd/gist-logs.rb @@ -18,11 +18,39 @@ require "formula" require "system_config" require "stringio" require "socket" +require "cli_parser" module Homebrew module_function + def gist_logs_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `gist-logs` [] : + + Upload logs for a failed build of to a new Gist. + + is usually the name of the formula to install, but it can be specified + in several different ways. See [SPECIFYING FORMULAE](#specifying-formulae). + + If no logs are found, an error message is presented. + EOS + switch "--with-hostname", + description: "Include the hostname in the Gist." + switch "-n", "--new-issue", + description: "Automatically create a new issue in the appropriate GitHub repository as "\ + "well as creating the Gist." + switch "-p", "--private", + description: "The Gist will be marked private and will not appear in listings but will "\ + "be accessible with the link." + switch :verbose + switch :debug + end + end + def gistify_logs(f) + gist_logs_args.parse + files = load_logs(f.logs) build_time = f.logs.ctime timestamp = build_time.strftime("%Y-%m-%d_%H-%M-%S") @@ -60,7 +88,7 @@ module Homebrew end url = create_gist(files, descr) - if ARGV.include?("--new-issue") || ARGV.switch?("n") + if args.new_issue? url = create_issue(f.tap, "#{f.name} failed to build on #{MacOS.full_version}", url) end @@ -72,7 +100,7 @@ module Homebrew s = <<~EOS Homebrew build logs for #{f.full_name} on #{OS_VERSION} EOS - if ARGV.include?("--with-hostname") + if args.with_hostname? hostname = Socket.gethostname s << "Host: #{hostname}\n" end @@ -114,7 +142,7 @@ module Homebrew end def create_private? - ARGV.include?("--private") || ARGV.switch?("p") + args.private? end def create_gist(files, description) From e2e4f93f06b37390ec7dbf4f8e6f498a068c1eaa Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Wed, 23 Jan 2019 10:14:31 +0530 Subject: [PATCH 048/199] search: Add descriptions to option declarations --- Library/Homebrew/cmd/search.rb | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb index 5f51d1c758..aff503cb2d 100644 --- a/Library/Homebrew/cmd/search.rb +++ b/Library/Homebrew/cmd/search.rb @@ -41,20 +41,38 @@ module Homebrew }, }.freeze - def search(argv = ARGV) - CLI::Parser.parse(argv) do - switch "--desc" + def search_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `search`, `-S` [] (|`/``/`) + + Perform a substring search of cask tokens and formula names for . If + is surrounded with slashes, then it is interpreted as a regular expression. + The search for is extended online to `homebrew/core` and `homebrew/cask`. + + If no is passed, display all locally available formulae (including tapped ones). + No online search is performed. + EOS + switch "--casks", + description: "Display all locally available casks (including tapped ones). "\ + "No online search is performed." + switch "--desc", + description: "search formulae with a description matching and casks with "\ + "a name matching ." package_manager_switches = PACKAGE_MANAGERS.keys.map { |name| "--#{name}" } - package_manager_switches.each do |s| - switch s + switch s, + description: "Search for in the given package manager's list." end - - switch "--casks" - + switch :verbose + switch :debug conflicts(*package_manager_switches) end + end + + def search + search_args.parse if package_manager = PACKAGE_MANAGERS.find { |name,| args[:"#{name}?"] } _, url = package_manager From e43d400fd20256411851b3b58ef58b27c3d27cde Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 23 Jan 2019 08:37:28 +0000 Subject: [PATCH 049/199] gist-logs: add missing install require. Fixes #5586 --- Library/Homebrew/cmd/gist-logs.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/Library/Homebrew/cmd/gist-logs.rb b/Library/Homebrew/cmd/gist-logs.rb index e606014b5c..7193c4b024 100644 --- a/Library/Homebrew/cmd/gist-logs.rb +++ b/Library/Homebrew/cmd/gist-logs.rb @@ -15,6 +15,7 @@ #: If no logs are found, an error message is presented. require "formula" +require "install" require "system_config" require "stringio" require "socket" From 57d7d4c9dd13fe5c4c17ac29ff7b3b093b03eadf Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 23 Jan 2019 15:40:44 +0000 Subject: [PATCH 050/199] brew.rb: duplicate MissingEnvironmentVariables exception. Fixes #5592. --- Library/Homebrew/brew.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index 8124cd02cf..c3e7d9aa5c 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -10,6 +10,9 @@ if RUBY_X < 2 || (RUBY_X == 2 && RUBY_Y < 3) raise "Homebrew must be run under Ruby 2.3! You're running #{RUBY_VERSION}." end +# Also define here so we can rescue regardless of location. +class MissingEnvironmentVariables < RuntimeError; end + begin require_relative "global" rescue MissingEnvironmentVariables => e From 02a70496b61731e1a7fb94c5909fe99f2e09e5fc Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 23 Jan 2019 15:46:03 +0000 Subject: [PATCH 051/199] style: better handle file arguments. Fixes #5588. --- Library/Homebrew/style.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/style.rb b/Library/Homebrew/style.rb index ca47f72043..c4886c6211 100644 --- a/Library/Homebrew/style.rb +++ b/Library/Homebrew/style.rb @@ -61,7 +61,7 @@ module Homebrew end if files && !has_non_formula - config = if (files.first/"spec").exist? + config = if files.first && File.exist?("#{files.first}/spec") HOMEBREW_LIBRARY/".rubocop_rspec.yml" else HOMEBREW_LIBRARY/".rubocop_audit.yml" From e722a906f4c916241c66cd067c669897c1f03103 Mon Sep 17 00:00:00 2001 From: Christian Bernard Date: Wed, 23 Jan 2019 11:45:19 -0700 Subject: [PATCH 052/199] Added missing method to_a to Cask::DSL:ConflictsWith class. --- Library/Homebrew/cask/dsl/conflicts_with.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Library/Homebrew/cask/dsl/conflicts_with.rb b/Library/Homebrew/cask/dsl/conflicts_with.rb index fa05f584c1..f2945d6b99 100644 --- a/Library/Homebrew/cask/dsl/conflicts_with.rb +++ b/Library/Homebrew/cask/dsl/conflicts_with.rb @@ -25,6 +25,9 @@ module Cask instance_variable_set("@#{key}", instance_variable_get("@#{key}").merge([*value])) end end + def to_a + (@pairs.values) + end end end end From ffe4c6bcefb30740e01ff708b71d2c63f99e3199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Galv=C3=A3o?= Date: Wed, 23 Jan 2019 18:39:50 +0000 Subject: [PATCH 053/199] CaskSha256MismatchError: link to fix --- Library/Homebrew/cask/exceptions.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/exceptions.rb b/Library/Homebrew/cask/exceptions.rb index 939e9e1292..b3e8519743 100644 --- a/Library/Homebrew/cask/exceptions.rb +++ b/Library/Homebrew/cask/exceptions.rb @@ -136,7 +136,9 @@ module Cask Actual: #{Formatter.error(actual.to_s)} File: #{path} - To retry an incomplete download, remove the file above. + To retry an incomplete download, remove the file above. If the issue persists, visit: + + https://github.com/Homebrew/homebrew-cask/blob/master/doc/reporting_bugs/checksum_does_not_match_error.md EOS end end From 57fd624d251734ab9f712f47649dd245aca8986b Mon Sep 17 00:00:00 2001 From: Christian Bernard Date: Wed, 23 Jan 2019 12:21:15 -0700 Subject: [PATCH 054/199] Fix style issues based on brew style guide --- Library/Homebrew/cask/dsl/conflicts_with.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/dsl/conflicts_with.rb b/Library/Homebrew/cask/dsl/conflicts_with.rb index f2945d6b99..ea4065e21d 100644 --- a/Library/Homebrew/cask/dsl/conflicts_with.rb +++ b/Library/Homebrew/cask/dsl/conflicts_with.rb @@ -25,8 +25,9 @@ module Cask instance_variable_set("@#{key}", instance_variable_get("@#{key}").merge([*value])) end end + def to_a - (@pairs.values) + @pairs.values end end end From 0015803ddd9a946d2e0c46482abeaf593007d831 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 23 Jan 2019 21:35:27 +0000 Subject: [PATCH 055/199] Update Azure Pipelines Use latest macOS/Xcode settings. --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 627f5d7f14..8a06007867 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,10 +1,10 @@ jobs: - job: macOS pool: - vmImage: xcode9-macos10.13 + vmImage: macOS-10.13 steps: - bash: | - sudo xcode-select --switch /Applications/Xcode_10.app/Contents/Developer + sudo xcode-select --switch /Applications/Xcode_10.1.app/Contents/Developer HOMEBREW_REPOSITORY="$(brew --repo)" mv "$HOMEBREW_REPOSITORY/Library/Taps" "$PWD/Library" sudo rm -rf "$HOMEBREW_REPOSITORY" From eed1444d61ee6e61c3b683e45effcd3cbaafed94 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 23 Jan 2019 21:57:37 +0000 Subject: [PATCH 056/199] Update deprecations and cleanup - Move `odeprecated` to `odisabled` - Remove `odisabled` - Enable automatic cleanup on install/reinstall/upgrade. --- Library/Homebrew/.rubocop.yml | 2 +- Library/Homebrew/brew.rb | 2 +- Library/Homebrew/build_environment.rb | 2 +- Library/Homebrew/cleanup.rb | 2 - Library/Homebrew/cmd/install.rb | 4 - Library/Homebrew/cmd/prune.rb | 3 +- Library/Homebrew/cmd/reinstall.rb | 6 - Library/Homebrew/cmd/upgrade.rb | 7 +- Library/Homebrew/compat.rb | 6 - Library/Homebrew/compat/cask.rb | 21 -- Library/Homebrew/compat/cask/cache.rb | 17 -- Library/Homebrew/compat/cask/cask_loader.rb | 24 -- Library/Homebrew/compat/cask/caskroom.rb | 49 ---- Library/Homebrew/compat/cask/dsl.rb | 22 -- Library/Homebrew/compat/download_strategy.rb | 256 ------------------ .../compat/extend/os/mac/utils/bottles.rb | 19 -- Library/Homebrew/compat/formula.rb | 33 +-- Library/Homebrew/compat/os/mac.rb | 2 +- .../compat/requirements/x11_requirement.rb | 15 - .../compat/requirements/xcode_requirement.rb | 21 -- Library/Homebrew/compat/tap.rb | 47 ---- Library/Homebrew/dev-cmd/tests.rb | 1 - Library/Homebrew/diagnostic.rb | 9 - Library/Homebrew/extend/ARGV.rb | 7 +- Library/Homebrew/extend/os/mac/diagnostic.rb | 1 - Library/Homebrew/formula.rb | 2 +- Library/Homebrew/formula_installer.rb | 2 +- Library/Homebrew/manpages/brew.1.md.erb | 10 - Library/Homebrew/os.rb | 1 - Library/Homebrew/software_spec.rb | 2 +- Library/Homebrew/test/cmd/upgrade_spec.rb | 11 +- .../Homebrew/test/diagnostic_checks_spec.rb | 6 - docs/FAQ.md | 2 - docs/Manpage.md | 17 -- manpages/brew.1 | 16 -- 35 files changed, 16 insertions(+), 631 deletions(-) delete mode 100644 Library/Homebrew/compat/cask.rb delete mode 100644 Library/Homebrew/compat/cask/cache.rb delete mode 100644 Library/Homebrew/compat/cask/cask_loader.rb delete mode 100644 Library/Homebrew/compat/cask/caskroom.rb delete mode 100644 Library/Homebrew/compat/cask/dsl.rb delete mode 100644 Library/Homebrew/compat/download_strategy.rb delete mode 100644 Library/Homebrew/compat/extend/os/mac/utils/bottles.rb delete mode 100644 Library/Homebrew/compat/requirements/x11_requirement.rb delete mode 100644 Library/Homebrew/compat/requirements/xcode_requirement.rb delete mode 100644 Library/Homebrew/compat/tap.rb diff --git a/Library/Homebrew/.rubocop.yml b/Library/Homebrew/.rubocop.yml index ebfcf6ca3b..317c6ffd63 100644 --- a/Library/Homebrew/.rubocop.yml +++ b/Library/Homebrew/.rubocop.yml @@ -64,10 +64,10 @@ Metrics/LineLength: IgnoredPatterns: ['#: '] # we won't change backward compatible predicate names -# TODO: deprecate whitelisted names and move to compat Naming/PredicateName: Exclude: - 'compat/**/*' + # can't rename these NameWhitelist: is_32_bit?, is_64_bit? # whitelist those that are standard diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index 8124cd02cf..96ebd7effe 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -95,7 +95,7 @@ begin end if ENV["HOMEBREW_BUILD_FROM_SOURCE"] - odeprecated("HOMEBREW_BUILD_FROM_SOURCE", "--build-from-source") + odisabled("HOMEBREW_BUILD_FROM_SOURCE", "--build-from-source") end if internal_cmd diff --git a/Library/Homebrew/build_environment.rb b/Library/Homebrew/build_environment.rb index 54dc6f3407..d8ecdccbdf 100644 --- a/Library/Homebrew/build_environment.rb +++ b/Library/Homebrew/build_environment.rb @@ -41,7 +41,7 @@ module Homebrew MACOSX_DEPLOYMENT_TARGET PKG_CONFIG_PATH PKG_CONFIG_LIBDIR HOMEBREW_DEBUG HOMEBREW_MAKE_JOBS HOMEBREW_VERBOSE HOMEBREW_SVN HOMEBREW_GIT - HOMEBREW_SDKROOT HOMEBREW_BUILD_FROM_SOURCE + HOMEBREW_SDKROOT MAKE GIT CPP ACLOCAL_PATH PATH CPATH LD_LIBRARY_PATH LD_RUN_PATH LD_PRELOAD LIBRARY_PATH diff --git a/Library/Homebrew/cleanup.rb b/Library/Homebrew/cleanup.rb index e11dc893ec..0b13099781 100644 --- a/Library/Homebrew/cleanup.rb +++ b/Library/Homebrew/cleanup.rb @@ -158,7 +158,6 @@ module Homebrew def self.install_formula_clean!(f) return if ENV["HOMEBREW_NO_INSTALL_CLEANUP"] - return unless ENV["HOMEBREW_INSTALL_CLEANUP"] cleanup = Cleanup.new if cleanup.periodic_clean_due? @@ -170,7 +169,6 @@ module Homebrew def periodic_clean_due? return false if ENV["HOMEBREW_NO_INSTALL_CLEANUP"] - return unless ENV["HOMEBREW_INSTALL_CLEANUP"] return true unless PERIODIC_CLEAN_FILE.exist? PERIODIC_CLEAN_FILE.mtime < CLEANUP_DEFAULT_DAYS.days.ago diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 2bb5779376..c0fbc44695 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -31,10 +31,6 @@ #: source even if a bottle is provided. Dependencies will still be installed #: from bottles if they are available. #: -#: If `HOMEBREW_BUILD_FROM_SOURCE` is set, regardless of whether `--build-from-source` was -#: passed, then both and the dependencies installed as part of this process -#: are built from source even if bottles are available. -#: #: If `--force-bottle` is passed, install from a bottle if it exists for the #: current or newest version of macOS, even if it would not normally be used #: for installation. diff --git a/Library/Homebrew/cmd/prune.rb b/Library/Homebrew/cmd/prune.rb index 3c8ffdb3f0..387af49764 100644 --- a/Library/Homebrew/cmd/prune.rb +++ b/Library/Homebrew/cmd/prune.rb @@ -25,7 +25,6 @@ module Homebrew def prune prune_args.parse - odeprecated("'brew prune'", "'brew cleanup'") - Cleanup.new(dry_run: args.dry_run?).prune_prefix_symlinks_and_directories + odisabled("'brew prune'", "'brew cleanup'") end end diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index 658247b77b..123e97d7ab 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -3,9 +3,6 @@ #: #: If `--display-times` is passed, install times for each formula are printed #: at the end of the run. -#: -#: If `HOMEBREW_INSTALL_CLEANUP` is set then remove previously installed versions -#: of upgraded as well as the HOMEBREW_CACHE for that formula. require "formula_installer" require "development_tools" @@ -23,9 +20,6 @@ module Homebrew `reinstall` [] : Uninstall and then install (with existing install options). - - If `HOMEBREW_INSTALL_CLEANUP` is set then remove previously installed versions - of upgraded as well as the HOMEBREW_CACHE for that formula. EOS switch "-s", "--build-from-source", description: "Compile the formula> from source even if a bottle is available." diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index fd84995b72..7a9fad981c 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -28,13 +28,10 @@ module Homebrew module_function def upgrade - # TODO: deprecate for next minor release. if ARGV.include?("--cleanup") - ENV["HOMEBREW_INSTALL_CLEANUP"] = "1" - odeprecated("'brew upgrade --cleanup'", "'HOMEBREW_INSTALL_CLEANUP'") + odisabled("'brew upgrade --cleanup'") elsif ENV["HOMEBREW_UPGRADE_CLEANUP"] - ENV["HOMEBREW_INSTALL_CLEANUP"] = "1" - odeprecated("'HOMEBREW_UPGRADE_CLEANUP'", "'HOMEBREW_INSTALL_CLEANUP'") + odisabled("'HOMEBREW_UPGRADE_CLEANUP'") end FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed? diff --git a/Library/Homebrew/compat.rb b/Library/Homebrew/compat.rb index 5079476f18..a5cd87a590 100644 --- a/Library/Homebrew/compat.rb +++ b/Library/Homebrew/compat.rb @@ -1,8 +1,2 @@ -require "compat/extend/os/mac/utils/bottles" require "compat/os/mac" -require "compat/requirements/x11_requirement" -require "compat/requirements/xcode_requirement" -require "compat/cask" -require "compat/download_strategy" require "compat/formula" -require "compat/tap" diff --git a/Library/Homebrew/compat/cask.rb b/Library/Homebrew/compat/cask.rb deleted file mode 100644 index 59708eeb98..0000000000 --- a/Library/Homebrew/compat/cask.rb +++ /dev/null @@ -1,21 +0,0 @@ -require "compat/cask/cache" -require "compat/cask/cask_loader" -require "compat/cask/caskroom" -require "compat/cask/dsl" - -module Cask - class << self - module Compat - def init - Cache.delete_legacy_cache - - Caskroom.migrate_caskroom_from_repo_to_prefix - Caskroom.migrate_legacy_caskroom - - super - end - end - - prepend Compat - end -end diff --git a/Library/Homebrew/compat/cask/cache.rb b/Library/Homebrew/compat/cask/cache.rb deleted file mode 100644 index b70f0412a2..0000000000 --- a/Library/Homebrew/compat/cask/cache.rb +++ /dev/null @@ -1,17 +0,0 @@ -module Cask - module Cache - class << self - module Compat - def delete_legacy_cache - legacy_cache = HOMEBREW_CACHE.join("Casks") - return unless legacy_cache.exist? - - ohai "Deleting legacy cache at #{legacy_cache}" - FileUtils.remove_entry_secure(legacy_cache) - end - end - - prepend Compat - end - end -end diff --git a/Library/Homebrew/compat/cask/cask_loader.rb b/Library/Homebrew/compat/cask/cask_loader.rb deleted file mode 100644 index d0119b4ef1..0000000000 --- a/Library/Homebrew/compat/cask/cask_loader.rb +++ /dev/null @@ -1,24 +0,0 @@ -module Cask - module CaskLoader - class FromContentLoader; end - - class FromPathLoader < FromContentLoader - module Compat - private - - # TODO: can't delete this code until the merge of - # https://github.com/Homebrew/brew/pull/4730 or an equivalent. - def cask(header_token, **options, &block) - if header_token.is_a?(Hash) && header_token.key?(:v1) - odisabled %q("cask :v1 => 'token'"), %q("cask 'token'") - header_token = header_token[:v1] - end - - super(header_token, **options, &block) - end - end - - prepend Compat - end - end -end diff --git a/Library/Homebrew/compat/cask/caskroom.rb b/Library/Homebrew/compat/cask/caskroom.rb deleted file mode 100644 index 87597c05d2..0000000000 --- a/Library/Homebrew/compat/cask/caskroom.rb +++ /dev/null @@ -1,49 +0,0 @@ -module Cask - module Caskroom - class << self - module Compat - def migrate_legacy_caskroom - return if path.exist? - - legacy_caskroom_path = Pathname.new("/opt/homebrew-cask/Caskroom") - return if path == legacy_caskroom_path - return unless legacy_caskroom_path.exist? - return if legacy_caskroom_path.symlink? - - ohai "Migrating Caskroom from #{legacy_caskroom_path} to #{path}." - if path.parent.writable? - FileUtils.mv legacy_caskroom_path, path - else - opoo "#{path.parent} is not writable, sudo is needed to move the Caskroom." - SystemCommand.run("/bin/mv", args: [legacy_caskroom_path, path.parent], sudo: true) - end - - ohai "Creating symlink from #{path} to #{legacy_caskroom_path}." - if legacy_caskroom_path.parent.writable? - FileUtils.ln_s path, legacy_caskroom_path - else - opoo "#{legacy_caskroom_path.parent} is not writable, sudo is needed to link the Caskroom." - SystemCommand.run("/bin/ln", args: ["-s", path, legacy_caskroom_path], sudo: true) - end - end - - def migrate_caskroom_from_repo_to_prefix - repo_caskroom_path = HOMEBREW_REPOSITORY.join("Caskroom") - return if path.exist? - return unless repo_caskroom_path.directory? - - ohai "Moving Caskroom from HOMEBREW_REPOSITORY to HOMEBREW_PREFIX" - - if path.parent.writable? - FileUtils.mv repo_caskroom_path, path - else - opoo "#{path.parent} is not writable, sudo is needed to move the Caskroom." - SystemCommand.run("/bin/mv", args: [repo_caskroom_path, path.parent], sudo: true) - end - end - end - - prepend Compat - end - end -end diff --git a/Library/Homebrew/compat/cask/dsl.rb b/Library/Homebrew/compat/cask/dsl.rb deleted file mode 100644 index 646af08364..0000000000 --- a/Library/Homebrew/compat/cask/dsl.rb +++ /dev/null @@ -1,22 +0,0 @@ -module Cask - class DSL - module Compat - # TODO: can't delete this code until the merge of - # https://github.com/Homebrew/brew/pull/4730 or an equivalent. - - def gpg(*) - odisabled "the `gpg` stanza" - end - - def license(*) - odisabled "the `license` stanza" - end - - def accessibility_access(*) - odisabled "the `accessibility_access` stanza" - end - end - - prepend Compat - end -end diff --git a/Library/Homebrew/compat/download_strategy.rb b/Library/Homebrew/compat/download_strategy.rb deleted file mode 100644 index 960ca9f067..0000000000 --- a/Library/Homebrew/compat/download_strategy.rb +++ /dev/null @@ -1,256 +0,0 @@ -require "download_strategy" - -# S3DownloadStrategy downloads tarballs from AWS S3. -# To use it, add `:using => :s3` to the URL section of your -# formula. This download strategy uses AWS access tokens (in the -# environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`) -# to sign the request. This strategy is good in a corporate setting, -# because it lets you use a private S3 bucket as a repo for internal -# distribution. (It will work for public buckets as well.) -class S3DownloadStrategy < CurlDownloadStrategy - def initialize(url, name, version, **meta) - odisabled("S3DownloadStrategy", - "a vendored S3DownloadStrategy in your own formula or tap (using require_relative)") - super - end - - def _fetch(url:, resolved_url:) - if url !~ %r{^https?://([^.].*)\.s3\.amazonaws\.com/(.+)$} && - url !~ %r{^s3://([^.].*?)/(.+)$} - raise "Bad S3 URL: " + url - end - - bucket = Regexp.last_match(1) - key = Regexp.last_match(2) - - ENV["AWS_ACCESS_KEY_ID"] = ENV["HOMEBREW_AWS_ACCESS_KEY_ID"] - ENV["AWS_SECRET_ACCESS_KEY"] = ENV["HOMEBREW_AWS_SECRET_ACCESS_KEY"] - - begin - require "aws-sdk-s3" - rescue LoadError - Homebrew.install_gem! "aws-sdk-s3", "~> 1.8" - require "aws-sdk-s3" - end - - begin - signer = Aws::S3::Presigner.new - s3url = signer.presigned_url :get_object, bucket: bucket, key: key - rescue Aws::Sigv4::Errors::MissingCredentialsError - ohai "AWS credentials missing, trying public URL instead." - s3url = url - end - - curl_download s3url, to: temporary_path - end -end - -# GitHubPrivateRepositoryDownloadStrategy downloads contents from GitHub -# Private Repository. To use it, add -# `:using => :github_private_repo` to the URL section of -# your formula. This download strategy uses GitHub access tokens (in the -# environment variables `HOMEBREW_GITHUB_API_TOKEN`) to sign the request. This -# strategy is suitable for corporate use just like S3DownloadStrategy, because -# it lets you use a private GitHub repository for internal distribution. It -# works with public one, but in that case simply use CurlDownloadStrategy. -class GitHubPrivateRepositoryDownloadStrategy < CurlDownloadStrategy - require "utils/formatter" - require "utils/github" - - def initialize(url, name, version, **meta) - odisabled("GitHubPrivateRepositoryDownloadStrategy", - "a vendored GitHubPrivateRepositoryDownloadStrategy in your own formula or tap (using require_relative)") - super - parse_url_pattern - set_github_token - end - - def parse_url_pattern - unless match = url.match(%r{https://github.com/([^/]+)/([^/]+)/(\S+)}) - raise CurlDownloadStrategyError, "Invalid url pattern for GitHub Repository." - end - - _, @owner, @repo, @filepath = *match - end - - def download_url - "https://#{@github_token}@github.com/#{@owner}/#{@repo}/#{@filepath}" - end - - private - - def _fetch(url:, resolved_url:) - curl_download download_url, to: temporary_path - end - - def set_github_token - @github_token = ENV["HOMEBREW_GITHUB_API_TOKEN"] - unless @github_token - raise CurlDownloadStrategyError, "Environmental variable HOMEBREW_GITHUB_API_TOKEN is required." - end - - validate_github_repository_access! - end - - def validate_github_repository_access! - # Test access to the repository - GitHub.repository(@owner, @repo) - rescue GitHub::HTTPNotFoundError - # We only handle HTTPNotFoundError here, - # becase AuthenticationFailedError is handled within util/github. - message = <<~EOS - HOMEBREW_GITHUB_API_TOKEN can not access the repository: #{@owner}/#{@repo} - This token may not have permission to access the repository or the url of formula may be incorrect. - EOS - raise CurlDownloadStrategyError, message - end -end - -# GitHubPrivateRepositoryReleaseDownloadStrategy downloads tarballs from GitHub -# Release assets. To use it, add `:using => :github_private_release` to the URL section -# of your formula. This download strategy uses GitHub access tokens (in the -# environment variables HOMEBREW_GITHUB_API_TOKEN) to sign the request. -class GitHubPrivateRepositoryReleaseDownloadStrategy < GitHubPrivateRepositoryDownloadStrategy - def initialize(url, name, version, **meta) - odisabled("GitHubPrivateRepositoryReleaseDownloadStrategy", - "a vendored GitHubPrivateRepositoryReleaseDownloadStrategy in your own formula or tap (using require_relative)") - super - end - - def parse_url_pattern - url_pattern = %r{https://github.com/([^/]+)/([^/]+)/releases/download/([^/]+)/(\S+)} - unless @url =~ url_pattern - raise CurlDownloadStrategyError, "Invalid url pattern for GitHub Release." - end - - _, @owner, @repo, @tag, @filename = *@url.match(url_pattern) - end - - def download_url - "https://#{@github_token}@api.github.com/repos/#{@owner}/#{@repo}/releases/assets/#{asset_id}" - end - - private - - def _fetch(url:, resolved_url:) - # HTTP request header `Accept: application/octet-stream` is required. - # Without this, the GitHub API will respond with metadata, not binary. - curl_download download_url, "--header", "Accept: application/octet-stream", to: temporary_path - end - - def asset_id - @asset_id ||= resolve_asset_id - end - - def resolve_asset_id - release_metadata = fetch_release_metadata - assets = release_metadata["assets"].select { |a| a["name"] == @filename } - raise CurlDownloadStrategyError, "Asset file not found." if assets.empty? - - assets.first["id"] - end - - def fetch_release_metadata - release_url = "https://api.github.com/repos/#{@owner}/#{@repo}/releases/tags/#{@tag}" - GitHub.open_api(release_url) - end -end - -# ScpDownloadStrategy downloads files using ssh via scp. To use it, add -# `:using => :scp` to the URL section of your formula or -# provide a URL starting with scp://. This strategy uses ssh credentials for -# authentication. If a public/private keypair is configured, it will not -# prompt for a password. -# -# @example -# class Abc < Formula -# url "scp://example.com/src/abc.1.0.tar.gz" -# ... -class ScpDownloadStrategy < AbstractFileDownloadStrategy - def initialize(url, name, version, **meta) - odisabled("ScpDownloadStrategy", - "a vendored ScpDownloadStrategy in your own formula or tap (using require_relative)") - super - parse_url_pattern - end - - def parse_url_pattern - url_pattern = %r{scp://([^@]+@)?([^@:/]+)(:\d+)?/(\S+)} - if @url !~ url_pattern - raise ScpDownloadStrategyError, "Invalid URL for scp: #{@url}" - end - - _, @user, @host, @port, @path = *@url.match(url_pattern) - end - - def fetch - ohai "Downloading #{@url}" - - if cached_location.exist? - puts "Already downloaded: #{cached_location}" - else - system_command! "scp", args: [scp_source, temporary_path.to_s] - ignore_interrupts { temporary_path.rename(cached_location) } - end - end - - def clear_cache - super - rm_rf(temporary_path) - end - - private - - def scp_source - path_prefix = "/" unless @path.start_with?("~") - port_arg = "-P #{@port[1..-1]} " if @port - "#{port_arg}#{@user}#{@host}:#{path_prefix}#{@path}" - end -end - -class DownloadStrategyDetector - class << self - module Compat - def detect_from_url(url) - case url - when %r{^s3://} - odisabled("s3://", - "a vendored S3DownloadStrategy in your own formula or tap (using require_relative)") - S3DownloadStrategy - when %r{^scp://} - odisabled("scp://", - "a vendored ScpDownloadStrategy in your own formula or tap (using require_relative)") - ScpDownloadStrategy - else - super(url) - end - end - - def detect_from_symbol(symbol) - case symbol - when :github_private_repo - odisabled(":github_private_repo", - "a vendored GitHubPrivateRepositoryDownloadStrategy in your own formula or tap (using require_relative)") - GitHubPrivateRepositoryDownloadStrategy - when :github_private_release - odisabled(":github_private_repo", - "a vendored GitHubPrivateRepositoryReleaseDownloadStrategy in your own formula or tap "\ - "(using require_relative)") - GitHubPrivateRepositoryReleaseDownloadStrategy - when :s3 - odisabled(":s3", - "a vendored S3DownloadStrategy in your own formula or tap (using require_relative)") - S3DownloadStrategy - when :scp - odisabled(":scp", - "a vendored ScpDownloadStrategy in your own formula or tap (using require_relative)") - ScpDownloadStrategy - else - super(symbol) - end - end - end - - prepend Compat - end -end diff --git a/Library/Homebrew/compat/extend/os/mac/utils/bottles.rb b/Library/Homebrew/compat/extend/os/mac/utils/bottles.rb deleted file mode 100644 index 4e26d0a4ea..0000000000 --- a/Library/Homebrew/compat/extend/os/mac/utils/bottles.rb +++ /dev/null @@ -1,19 +0,0 @@ -module Utils - class Bottles - class Collector - module Compat - private - - def tag_without_or_later(tag) - return super unless tag.to_s.end_with?("_or_later") - - odisabled "`or_later` bottles", - "bottles without `or_later` (or_later is implied now)" - tag.to_s[/(\w+)_or_later$/, 1].to_sym - end - end - - prepend Compat - end - end -end diff --git a/Library/Homebrew/compat/formula.rb b/Library/Homebrew/compat/formula.rb index d85802e425..7f34b86d67 100644 --- a/Library/Homebrew/compat/formula.rb +++ b/Library/Homebrew/compat/formula.rb @@ -2,40 +2,15 @@ class Formula module Compat # Run `scons` using a Homebrew-installed version rather than whatever is # in the `PATH`. - # TODO: deprecate - def scons(*args) - odeprecated("scons", 'system "scons"') - - system Formulary.factory("scons").opt_bin/"scons", *args + def scons(*) + odisabled("scons", 'system "scons"') end # Run `make` 3.81 or newer. # Uses the system make on Leopard and newer, and the # path to the actually-installed make on Tiger or older. - # TODO: deprecate - def make(*args) - odeprecated("make", 'system "make"') - - if Utils.popen_read("/usr/bin/make", "--version") - .match(/Make (\d\.\d+)/)[1] > "3.80" - make_path = "/usr/bin/make" - else - make = Formula["make"].opt_bin/"make" - make_path = if make.exist? - make.to_s - else - (Formula["make"].opt_bin/"gmake").to_s - end - end - - if superenv? - make_name = File.basename(make_path) - with_env(HOMEBREW_MAKE: make_name) do - system "make", *args - end - else - system make_path, *args - end + def make(*) + odisabled("make", 'system "make"') end end diff --git a/Library/Homebrew/compat/os/mac.rb b/Library/Homebrew/compat/os/mac.rb index b94b744b90..043bb85a93 100644 --- a/Library/Homebrew/compat/os/mac.rb +++ b/Library/Homebrew/compat/os/mac.rb @@ -3,7 +3,7 @@ module OS class << self module Compat def prefer_64_bit? - odeprecated("MacOS.prefer_64_bit?") + odisabled("MacOS.prefer_64_bit?") Hardware::CPU.is_64_bit? end end diff --git a/Library/Homebrew/compat/requirements/x11_requirement.rb b/Library/Homebrew/compat/requirements/x11_requirement.rb deleted file mode 100644 index 6d1b686d8a..0000000000 --- a/Library/Homebrew/compat/requirements/x11_requirement.rb +++ /dev/null @@ -1,15 +0,0 @@ -require "requirement" - -class X11Requirement < Requirement - module Compat - def initialize(tags = []) - if tags.first.to_s.match?(/(\d\.)+\d/) - odisabled('depends_on :x11 => "X.Y.Z"') - end - - super(tags) - end - end - - prepend Compat -end diff --git a/Library/Homebrew/compat/requirements/xcode_requirement.rb b/Library/Homebrew/compat/requirements/xcode_requirement.rb deleted file mode 100644 index 93ada7f826..0000000000 --- a/Library/Homebrew/compat/requirements/xcode_requirement.rb +++ /dev/null @@ -1,21 +0,0 @@ -require "requirement" - -class XcodeRequirement < Requirement - module Compat - def initialize(tags = []) - @version = if tags.first.to_s.match?(/(\d\.)+\d/) - tags.shift - else - tags.find do |tag| - next unless tag.to_s.match?(/(\d\.)+\d/) - odisabled('depends_on :xcode => [..., "X.Y.Z"]') - tags.delete(tag) - end - end - - super(tags) - end - end - - prepend Compat -end diff --git a/Library/Homebrew/compat/tap.rb b/Library/Homebrew/compat/tap.rb deleted file mode 100644 index e7953fe461..0000000000 --- a/Library/Homebrew/compat/tap.rb +++ /dev/null @@ -1,47 +0,0 @@ -class Tap - module Compat - def initialize(user, repo) - super - - return unless user == "caskroom" - - old_initial_revision_var = "HOMEBREW_UPDATE_BEFORE#{repo_var}" - old_current_revision_var = "HOMEBREW_UPDATE_AFTER#{repo_var}" - - new_user = "Homebrew" - new_repo = (repo == "cask") ? repo : "cask-#{repo}" - - old_name = name - old_path = path - old_remote = path.git_origin - - clear_cache - super(new_user, new_repo) - - return unless old_path.directory? - - new_initial_revision_var = "HOMEBREW_UPDATE_BEFORE#{repo_var}" - new_current_revision_var = "HOMEBREW_UPDATE_AFTER#{repo_var}" - - ENV[new_initial_revision_var] ||= ENV[old_initial_revision_var] - ENV[new_current_revision_var] ||= ENV[old_current_revision_var] - - new_name = name - new_path = path - new_remote = default_remote - - ohai "Migrating tap #{old_name} to #{new_name}..." if $stdout.tty? - - if old_path.git? - puts "Changing remote from #{old_remote} to #{new_remote}..." if $stdout.tty? - old_path.git_origin = new_remote - end - - puts "Moving #{old_path} to #{new_path}..." if $stdout.tty? - path.dirname.mkpath - FileUtils.mv old_path, new_path - end - end - - prepend Compat -end diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index 58e6843236..af9ffee6a4 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -61,7 +61,6 @@ module Homebrew ENV.delete("HOMEBREW_NO_GITHUB_API") ENV.delete("HOMEBREW_NO_EMOJI") ENV.delete("HOMEBREW_DEVELOPER") - ENV.delete("HOMEBREW_INSTALL_CLEANUP") ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1" ENV["HOMEBREW_NO_COMPAT"] = "1" if args.no_compat? ENV["HOMEBREW_TEST_GENERIC_OS"] = "1" if args.generic? diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 7eff0334c0..53f7016511 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -115,15 +115,6 @@ module Homebrew EOS end - def check_build_from_source - return unless ENV["HOMEBREW_BUILD_FROM_SOURCE"] - - <<~EOS - You have HOMEBREW_BUILD_FROM_SOURCE set. - #{please_create_pull_requests} - EOS - end - # Anaconda installs multiple system & brew dupes, including OpenSSL, Python, # sqlite, libpng, Qt, etc. Regularly breaks compile on Vim, MacVim and others. # Is flagged as part of the *-config script checks below, but people seem diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb index d69a3c2df4..ac931df1f5 100644 --- a/Library/Homebrew/extend/ARGV.rb +++ b/Library/Homebrew/extend/ARGV.rb @@ -219,15 +219,10 @@ module HomebrewArgvExtension switch?("s") || include?("--build-from-source") end - def build_all_from_source? - !ENV["HOMEBREW_BUILD_FROM_SOURCE"].nil? - end - # Whether a given formula should be built from source during the current # installation run. def build_formula_from_source?(f) - return true if build_all_from_source? - return false unless build_from_source? || build_bottle? + return false if !build_from_source? && !build_bottle? formulae.any? { |argv_f| argv_f.full_name == f.full_name } end diff --git a/Library/Homebrew/extend/os/mac/diagnostic.rb b/Library/Homebrew/extend/os/mac/diagnostic.rb index c4669c9baa..e93f180e65 100644 --- a/Library/Homebrew/extend/os/mac/diagnostic.rb +++ b/Library/Homebrew/extend/os/mac/diagnostic.rb @@ -15,7 +15,6 @@ module Homebrew def supported_configuration_checks %w[ - check_build_from_source check_for_unsupported_macos ].freeze end diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index eec6635b29..982b53282e 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -2510,7 +2510,7 @@ class Formula # version '7.1' # end def fails_with(compiler, &block) - odeprecated "fails_with :gcc_4_0" if compiler == :gcc_4_0 + odisabled "fails_with :gcc_4_0" if compiler == :gcc_4_0 specs.each { |spec| spec.fails_with(compiler, &block) } end diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index fd8c233b52..1860724bd4 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -46,7 +46,7 @@ class FormulaInstaller @show_header = false @ignore_deps = false @only_deps = false - @build_from_source = ARGV.build_from_source? || ARGV.build_all_from_source? + @build_from_source = ARGV.build_from_source? @build_bottle = false @force_bottle = ARGV.force_bottle? @include_test = ARGV.include?("--include-test") diff --git a/Library/Homebrew/manpages/brew.1.md.erb b/Library/Homebrew/manpages/brew.1.md.erb index 7191f20cb6..06f41e37f3 100644 --- a/Library/Homebrew/manpages/brew.1.md.erb +++ b/Library/Homebrew/manpages/brew.1.md.erb @@ -192,16 +192,6 @@ Note that environment variables must have a value set to be detected. For exampl *Default:* the beer emoji. - * `HOMEBREW_INSTALL_CLEANUP`: - If set, `brew install`, `brew upgrade` and `brew reinstall` will remove - previously installed version(s) of the installed/upgraded formulae. - - If `brew cleanup` has not been run in 30 days then it will be run at this - time. - - This will become the default in a later version of Homebrew. To opt-out see - `HOMEBREW_NO_INSTALL_CLEANUP`. - * `HOMEBREW_LOGS`: If set, Homebrew will use the specified directory to store log files. diff --git a/Library/Homebrew/os.rb b/Library/Homebrew/os.rb index 7daa73051f..24803816af 100644 --- a/Library/Homebrew/os.rb +++ b/Library/Homebrew/os.rb @@ -18,7 +18,6 @@ module OS # Don't tell people to report issues on unsupported configurations. if !OS::Mac.prerelease? && !OS::Mac.outdated_release? && - !ENV["HOMEBREW_BUILD_FROM_SOURCE"] && ARGV.none? { |v| v.start_with?("--cc=") } && ENV["HOMEBREW_PREFIX"] == "/usr/local" ISSUES_URL = "https://docs.brew.sh/Troubleshooting".freeze diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index 8de0964817..4e144a0a8b 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -208,7 +208,7 @@ class SoftwareSpec end def fails_with(compiler, &block) - odeprecated "fails_with :gcc_4_0" if compiler == :gcc_4_0 + odisabled "fails_with :gcc_4_0" if compiler == :gcc_4_0 compiler_failures << CompilerFailure.create(compiler, &block) end diff --git a/Library/Homebrew/test/cmd/upgrade_spec.rb b/Library/Homebrew/test/cmd/upgrade_spec.rb index 83afb0cff1..b12a022e77 100644 --- a/Library/Homebrew/test/cmd/upgrade_spec.rb +++ b/Library/Homebrew/test/cmd/upgrade_spec.rb @@ -1,19 +1,10 @@ describe "brew upgrade", :integration_test do - it "upgrades a Formula to the latest version" do + it "upgrades a Formula and cleans up old versions" do setup_test_formula "testball" (HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath expect { brew "upgrade" }.to be_a_success - expect(HOMEBREW_CELLAR/"testball/0.1").to be_a_directory - end - - it "upgrades a Formula and cleans up old versions when `--cleanup` is passed" do - setup_test_formula "testball" - (HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath - - expect { brew "upgrade", "--cleanup" }.to be_a_success - expect(HOMEBREW_CELLAR/"testball/0.1").to be_a_directory expect(HOMEBREW_CELLAR/"testball/0.0.1").not_to exist end diff --git a/Library/Homebrew/test/diagnostic_checks_spec.rb b/Library/Homebrew/test/diagnostic_checks_spec.rb index 06be59c5c4..3f1dbcd44a 100644 --- a/Library/Homebrew/test/diagnostic_checks_spec.rb +++ b/Library/Homebrew/test/diagnostic_checks_spec.rb @@ -6,12 +6,6 @@ describe Homebrew::Diagnostic::Checks do expect(subject.inject_file_list(%w[/a /b], "foo:\n")).to eq("foo:\n /a\n /b\n") end - specify "#check_build_from_source" do - ENV["HOMEBREW_BUILD_FROM_SOURCE"] = "1" - expect(subject.check_build_from_source) - .to match("You have HOMEBREW_BUILD_FROM_SOURCE set.") - end - specify "#check_for_anaconda" do mktmpdir do |path| anaconda = "#{path}/anaconda" diff --git a/docs/FAQ.md b/docs/FAQ.md index 658cf93725..e5cb158893 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -90,8 +90,6 @@ following conditions: will use a bottled version of the formula, but `brew install --enable-bar ` will trigger a source build. * The `--build-from-source` option is invoked. -* The environment variable `HOMEBREW_BUILD_FROM_SOURCE` is set -(intended for developers only). * The machine is not running a supported version of macOS as all bottled builds are generated only for supported macOS versions. * Homebrew is installed to a prefix other than the standard diff --git a/docs/Manpage.md b/docs/Manpage.md index 5076d1957f..2c7117f1a7 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -269,10 +269,6 @@ these flags should only appear after a command. source even if a bottle is provided. Dependencies will still be installed from bottles if they are available. - If `HOMEBREW_BUILD_FROM_SOURCE` is set, regardless of whether `--build-from-source` was - passed, then both *`formula`* and the dependencies installed as part of this process - are built from source even if bottles are available. - If `--force-bottle` is passed, install from a bottle if it exists for the current or newest version of macOS, even if it would not normally be used for installation. @@ -424,9 +420,6 @@ these flags should only appear after a command. If `--display-times` is passed, install times for each formula are printed at the end of the run. - If `HOMEBREW_INSTALL_CLEANUP` is set then remove previously installed versions - of upgraded *`formulae`* as well as the HOMEBREW_CACHE for that formula. - * `search`, `-S`: Display all locally available formulae (including tapped ones). No online search is performed. @@ -1185,16 +1178,6 @@ Note that environment variables must have a value set to be detected. For exampl *Default:* the beer emoji. - * `HOMEBREW_INSTALL_CLEANUP`: - If set, `brew install`, `brew upgrade` and `brew reinstall` will remove - previously installed version(s) of the installed/upgraded formulae. - - If `brew cleanup` has not been run in 30 days then it will be run at this - time. - - This will become the default in a later version of Homebrew. To opt-out see - `HOMEBREW_NO_INSTALL_CLEANUP`. - * `HOMEBREW_LOGS`: If set, Homebrew will use the specified directory to store log files. diff --git a/manpages/brew.1 b/manpages/brew.1 index bf59b91d7c..4aa57bc90c 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -276,9 +276,6 @@ If \fB\-\-cc=\fR\fIcompiler\fR is passed, attempt to compile using \fIcompiler\f If \fB\-\-build\-from\-source\fR (or \fB\-s\fR) is passed, compile the specified \fIformula\fR from source even if a bottle is provided\. Dependencies will still be installed from bottles if they are available\. . .IP -If \fBHOMEBREW_BUILD_FROM_SOURCE\fR is set, regardless of whether \fB\-\-build\-from\-source\fR was passed, then both \fIformula\fR and the dependencies installed as part of this process are built from source even if bottles are available\. -. -.IP If \fB\-\-force\-bottle\fR is passed, install from a bottle if it exists for the current or newest version of macOS, even if it would not normally be used for installation\. . .IP @@ -435,9 +432,6 @@ Uninstall and then install \fIformula\fR (with existing install options)\. .IP If \fB\-\-display\-times\fR is passed, install times for each formula are printed at the end of the run\. . -.IP -If \fBHOMEBREW_INSTALL_CLEANUP\fR is set then remove previously installed versions of upgraded \fIformulae\fR as well as the HOMEBREW_CACHE for that formula\. -. .TP \fBsearch\fR, \fB\-S\fR Display all locally available formulae (including tapped ones)\. No online search is performed\. @@ -1312,16 +1306,6 @@ Text printed before the installation summary of each successful build\. \fIDefault:\fR the beer emoji\. . .TP -\fBHOMEBREW_INSTALL_CLEANUP\fR -If set, \fBbrew install\fR, \fBbrew upgrade\fR and \fBbrew reinstall\fR will remove previously installed version(s) of the installed/upgraded formulae\. -. -.IP -If \fBbrew cleanup\fR has not been run in 30 days then it will be run at this time\. -. -.IP -This will become the default in a later version of Homebrew\. To opt\-out see \fBHOMEBREW_NO_INSTALL_CLEANUP\fR\. -. -.TP \fBHOMEBREW_LOGS\fR If set, Homebrew will use the specified directory to store log files\. . From 44e998a59bb51f0a34e1560545d03e93320a63f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Galv=C3=A3o?= Date: Thu, 24 Jan 2019 00:37:56 +0000 Subject: [PATCH 057/199] Removed cleanup from cask manpage --- Library/Homebrew/manpages/brew-cask.1.md | 4 ---- manpages/brew-cask.1 | 4 ---- 2 files changed, 8 deletions(-) diff --git a/Library/Homebrew/manpages/brew-cask.1.md b/Library/Homebrew/manpages/brew-cask.1.md index b0eb087a24..2e0e646466 100644 --- a/Library/Homebrew/manpages/brew-cask.1.md +++ b/Library/Homebrew/manpages/brew-cask.1.md @@ -35,10 +35,6 @@ graphical user interface. * `cat` [ ... ]: Dump the given Cask definition file to the standard output. - * `cleanup` [--outdated]: - Clean up cached downloads and tracker symlinks. With `--outdated`, - only clean up cached downloads older than 10 days old. - * `create` : Generate a Cask definition file for the Cask identified by and open a template for it in your favorite editor. diff --git a/manpages/brew-cask.1 b/manpages/brew-cask.1 index 7f546ba296..bbbd2aec8f 100644 --- a/manpages/brew-cask.1 +++ b/manpages/brew-cask.1 @@ -40,10 +40,6 @@ Check the given Casks for installability\. If no tokens are given on the command Dump the given Cask definition file to the standard output\. . .TP -\fBcleanup\fR [\-\-outdated] -Clean up cached downloads and tracker symlinks\. With \fB\-\-outdated\fR, only clean up cached downloads older than 10 days old\. -. -.TP \fBcreate\fR \fItoken\fR Generate a Cask definition file for the Cask identified by \fItoken\fR and open a template for it in your favorite editor\. . From 382e0ed7b4273272774e1c31bae43556dafc019e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 24 Jan 2019 20:36:03 +0000 Subject: [PATCH 058/199] azure-pipelines-yml: early exit on errors. We don't want to silently ignore failing commands. Also, while we're editing the `tap-new` generated `azure-pipelines.yml` also add the changes missed here from #5600. --- Library/Homebrew/dev-cmd/tap-new.rb | 5 +++-- azure-pipelines.yml | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/dev-cmd/tap-new.rb b/Library/Homebrew/dev-cmd/tap-new.rb index 7c5b0ad4e2..d43c059e18 100644 --- a/Library/Homebrew/dev-cmd/tap-new.rb +++ b/Library/Homebrew/dev-cmd/tap-new.rb @@ -55,10 +55,11 @@ module Homebrew jobs: - job: macOS pool: - vmImage: xcode9-macos10.13 + vmImage: macOS-10.13 steps: - bash: | - sudo xcode-select --switch /Applications/Xcode_10.app/Contents/Developer + set -e + sudo xcode-select --switch /Applications/Xcode_10.1.app/Contents/Developer brew update HOMEBREW_TAP_DIR="/usr/local/Homebrew/Library/Taps/#{tap}" mkdir -p "$HOMEBREW_TAP_DIR" diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 8a06007867..c21e217b42 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -4,6 +4,7 @@ jobs: vmImage: macOS-10.13 steps: - bash: | + set -e sudo xcode-select --switch /Applications/Xcode_10.1.app/Contents/Developer HOMEBREW_REPOSITORY="$(brew --repo)" mv "$HOMEBREW_REPOSITORY/Library/Taps" "$PWD/Library" @@ -36,6 +37,7 @@ jobs: vmImage: ubuntu-16.04 steps: - bash: | + set -e HOMEBREW_REPOSITORY=/home/linuxbrew/.linuxbrew sudo mkdir -p /home/linuxbrew sudo mv "$PWD" "$HOMEBREW_REPOSITORY" From 04cb8f2a7820fbe0a7fd8421edeac31cf215ba63 Mon Sep 17 00:00:00 2001 From: Win Treese Date: Thu, 24 Jan 2019 16:30:00 -0500 Subject: [PATCH 059/199] Fix regexp to allow multiple digits in Mac OS minor version. The regular expression check for the -mmacosx-version-min value only looked at a single digit in the minor version number, so it did not compare correctly if the option was setting the minimum version to (say) 10.11. --- Library/Homebrew/shims/super/cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/shims/super/cc b/Library/Homebrew/shims/super/cc index 008b015efc..2c90e5e939 100755 --- a/Library/Homebrew/shims/super/cc +++ b/Library/Homebrew/shims/super/cc @@ -190,7 +190,7 @@ class Cmd when "-Xpreprocessor" # used for -Xpreprocessor -fopenmp args << arg << enum.next - when /-mmacosx-version-min=10\.(\d)/ + when /-mmacosx-version-min=10\.(\d+)/ arg = "-mmacosx-version-min=10.9" if high_sierra_or_later? && $1.to_i < 9 args << arg when "--fast-math" From cadb193e3b58a8ad4b31c6f45236daa53e3ec7d6 Mon Sep 17 00:00:00 2001 From: Christian Bernard Date: Fri, 25 Jan 2019 08:05:13 -0700 Subject: [PATCH 060/199] Update to convert pairs to hash k=>v during to_a in Cask::DSL::ConflictsWith#to_a --- Library/Homebrew/cask/dsl/conflicts_with.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/dsl/conflicts_with.rb b/Library/Homebrew/cask/dsl/conflicts_with.rb index ea4065e21d..75242b9490 100644 --- a/Library/Homebrew/cask/dsl/conflicts_with.rb +++ b/Library/Homebrew/cask/dsl/conflicts_with.rb @@ -27,7 +27,9 @@ module Cask end def to_a - @pairs.values + conflicts={} + @pairs.each { |k, v| conflicts[k]=v } + conflicts end end end From 6f184ea0dd3c3eb860688d8e481b6b6e140e1f60 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 25 Jan 2019 20:10:02 +0000 Subject: [PATCH 061/199] formula_installer: skip linking formulae with already installed casks. If you have the `emacs` or `docker` formulae and casks both installed the formula will fail to link. Skip trying to link the formula if the cask is already installed. Fixes https://github.com/Homebrew/homebrew-core/issues/36310. --- Library/Homebrew/formula_installer.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index fd8c233b52..ba0fd8bb34 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -793,6 +793,17 @@ class FormulaInstaller return end + cask_installed_with_formula_name = begin + Cask::CaskLoader.load(formula.name).installed? + rescue Cask::CaskUnavailableError + false + end + + if cask_installed_with_formula_name + ohai "#{formula.name} cask is installed, skipping link." + return + end + if keg.linked? opoo "This keg was marked linked already, continuing anyway" keg.remove_linked_keg_record From ce9856efca490551908ceeedae9ceaa017ade79f Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 25 Jan 2019 20:15:53 +0000 Subject: [PATCH 062/199] os/mac/diagnostic: detect Bitdefender. This has caused us multiple hard-to-diagnose issues so let's complain about it in `brew doctor`. --- Library/Homebrew/extend/os/mac/diagnostic.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Library/Homebrew/extend/os/mac/diagnostic.rb b/Library/Homebrew/extend/os/mac/diagnostic.rb index c4669c9baa..8a426de6fe 100644 --- a/Library/Homebrew/extend/os/mac/diagnostic.rb +++ b/Library/Homebrew/extend/os/mac/diagnostic.rb @@ -297,6 +297,19 @@ module Homebrew end end + def check_for_bitdefender + if !Pathname("/Library/Bitdefender/AVP/EndpointSecurityforMac.app").exist? && + !Pathname("/Library/Bitdefender/AVP/BDLDaemon").exist? + return + end + + <<~EOS + You have installed Bitdefender. The "Traffic Scan" option interferes with + Homebrew's ability to download packages. See: + https://github.com/Homebrew/brew/issues/5558 + EOS + end + def check_for_multiple_volumes return unless HOMEBREW_CELLAR.exist? From d13a287954dc78de700efda591275aa70c1167ab Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Thu, 24 Jan 2019 22:51:33 -0800 Subject: [PATCH 063/199] Fix check_coretap_git_origin check_coretap_git_origin was not working as intended. Permit Linuxbrew/homebrew-core as a valid origin. Factor out check_coretap_git_branch. --- Library/Homebrew/diagnostic.rb | 15 +++++++++------ Library/Homebrew/extend/os/linux/tap.rb | 10 ++++------ Library/Homebrew/tap.rb | 4 ---- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 7eff0334c0..bd8afa26b4 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -581,11 +581,9 @@ module Homebrew Without a correctly configured origin, Homebrew won't update properly. You can solve this by adding the Homebrew remote: - git -C "#{coretap_path}" remote add origin #{Formatter.url("https://github.com/Homebrew/homebrew-core.git")} + git -C "#{coretap_path}" remote add origin #{Formatter.url(CoreTap.instance.default_remote)} EOS - elsif origin !~ %r{Homebrew/homebrew-core(\.git|/)?$} - return if ENV["CI"] && origin.include?("Homebrew/homebrew-test-bot") - + elsif origin !~ %r{#{CoreTap.instance.full_name}(\.git|/)?$} <<~EOS Suspicious #{CoreTap.instance} git origin remote found. @@ -595,17 +593,22 @@ module Homebrew Unless you have compelling reasons, consider setting the origin remote to point at the main repository by running: - git -C "#{coretap_path}" remote set-url origin #{Formatter.url("https://github.com/Homebrew/homebrew-core.git")} + git -C "#{coretap_path}" remote set-url origin #{Formatter.url(CoreTap.instance.default_remote)} EOS end + end + def check_coretap_git_branch return if ENV["CI"] + coretap_path = CoreTap.instance.path + return if !Utils.git_available? || !(coretap_path/".git").exist? + branch = coretap_path.git_branch return if branch.nil? || branch =~ /master/ <<~EOS - Homebrew/homebrew-core is not on the master branch + #{CoreTap.instance.full_name} is not on the master branch Check out the master branch by running: git -C "$(brew --repo homebrew/core)" checkout master diff --git a/Library/Homebrew/extend/os/linux/tap.rb b/Library/Homebrew/extend/os/linux/tap.rb index fd692afd94..1ae251b9cc 100644 --- a/Library/Homebrew/extend/os/linux/tap.rb +++ b/Library/Homebrew/extend/os/linux/tap.rb @@ -1,9 +1,7 @@ class CoreTap < Tap - def default_remote - if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"] - "https://github.com/Homebrew/homebrew-core".freeze - else - "https://github.com/Linuxbrew/homebrew-core".freeze - end + # @private + def initialize + super "Homebrew", "core" + @full_name = "Linuxbrew/homebrew-core" unless ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"] end end diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index bf92a7d042..de323aa858 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -635,10 +635,6 @@ end # A specialized {Tap} class for the core formulae. class CoreTap < Tap - def default_remote - "https://github.com/Homebrew/homebrew-core".freeze - end - # @private def initialize super "Homebrew", "core" From 80d8d441a288f1a77633d981380e6657f0ff8231 Mon Sep 17 00:00:00 2001 From: Chongyu Zhu Date: Sat, 26 Jan 2019 14:26:35 +0800 Subject: [PATCH 064/199] python_virtualenv_constants: upgrade virtualenv to 16.3.0 --- Library/Homebrew/language/python_virtualenv_constants.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/language/python_virtualenv_constants.rb b/Library/Homebrew/language/python_virtualenv_constants.rb index f9feb811aa..341c455028 100644 --- a/Library/Homebrew/language/python_virtualenv_constants.rb +++ b/Library/Homebrew/language/python_virtualenv_constants.rb @@ -1,4 +1,6 @@ PYTHON_VIRTUALENV_URL = - "https://github.com/pypa/virtualenv/archive/16.2.0.tar.gz".freeze + "https://files.pythonhosted.org/packages/8b/f4" \ + "/360aa656ddb0f4168aeaa1057d8784b95d1ce12f34332c1cf52420b6db4e" \ + "/virtualenv-16.3.0.tar.gz".freeze PYTHON_VIRTUALENV_SHA256 = - "448def1220df9960e6d18fb5424107ffb1249eb566a5a311257860ab6b52b3fd".freeze + "729f0bcab430e4ef137646805b5b1d8efbb43fe53d4a0f33328624a84a5121f7".freeze From b24e96e28da945cf063f5868f32afeed7e002dd1 Mon Sep 17 00:00:00 2001 From: Michka Popoff Date: Sat, 26 Jan 2019 16:07:27 +0100 Subject: [PATCH 065/199] diagnostic: ignore case in origin comparison On circle-ci we do: git remote set-url origin $CIRCLE_REPOSITORY_URL which is defined as: https://github.com/linuxbrew/homebrew-core This is being compared to: https://github.com/Linuxbrew/homebrew-core --- Library/Homebrew/diagnostic.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index bd8afa26b4..813c80bcf4 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -583,7 +583,7 @@ module Homebrew properly. You can solve this by adding the Homebrew remote: git -C "#{coretap_path}" remote add origin #{Formatter.url(CoreTap.instance.default_remote)} EOS - elsif origin !~ %r{#{CoreTap.instance.full_name}(\.git|/)?$} + elsif origin !~ %r{#{CoreTap.instance.full_name}(\.git|/)?$}i <<~EOS Suspicious #{CoreTap.instance} git origin remote found. From 97ca5932cfb43fd687aff0587654ea21b0ab7358 Mon Sep 17 00:00:00 2001 From: Christian Bernard Date: Sat, 26 Jan 2019 10:15:45 -0700 Subject: [PATCH 066/199] Updated Cask::Cask#to_h to call Conflicts#to_h instead of to_a. Updated ConflictsWith#to_h to iterate over VALID_KEYS. --- Library/Homebrew/cask/cask.rb | 2 +- Library/Homebrew/cask/dsl/conflicts_with.rb | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/cask/cask.rb b/Library/Homebrew/cask/cask.rb index 12d578df81..f279630487 100644 --- a/Library/Homebrew/cask/cask.rb +++ b/Library/Homebrew/cask/cask.rb @@ -133,7 +133,7 @@ module Cask end, "caveats" => caveats, "depends_on" => depends_on, - "conflicts_with" => conflicts_with.to_a, + "conflicts_with" => conflicts_with.to_h, "container" => container, "auto_updates" => auto_updates, } diff --git a/Library/Homebrew/cask/dsl/conflicts_with.rb b/Library/Homebrew/cask/dsl/conflicts_with.rb index 75242b9490..e9db95fd27 100644 --- a/Library/Homebrew/cask/dsl/conflicts_with.rb +++ b/Library/Homebrew/cask/dsl/conflicts_with.rb @@ -26,10 +26,8 @@ module Cask end end - def to_a - conflicts={} - @pairs.each { |k, v| conflicts[k]=v } - conflicts + def to_h + Hash[VALID_KEYS.map { |key| [key, instance_variable_get("@#{key}").to_a] }] end end end From de08f33cc32cf452d8dac5ea2034a77cd66bc77d Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 26 Jan 2019 19:08:25 +0000 Subject: [PATCH 067/199] docs/How-to-Create-and-Maintain-a-Tap: naming to avoid clashes. As requested in: https://github.com/Homebrew/brew/issues/5615#issuecomment-457816870 --- docs/How-to-Create-and-Maintain-a-Tap.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/How-to-Create-and-Maintain-a-Tap.md b/docs/How-to-Create-and-Maintain-a-Tap.md index b668f4db11..835517aa51 100644 --- a/docs/How-to-Create-and-Maintain-a-Tap.md +++ b/docs/How-to-Create-and-Maintain-a-Tap.md @@ -5,11 +5,12 @@ can be created by anyone to provide their own formulae and/or external commands to any Homebrew user. ## Creating a tap + A tap is usually a Git repository available online, but you can use anything as long as it’s a protocol that Git understands, or even just a directory with files in it. If hosted on GitHub, we recommend that the repository’s name start with -`homebrew-` so the short `brew tap` command can be used. +`homebrew-` so the short `brew tap` command can be used. See the [manpage](Manpage.md) for more information on repository naming. Tap formulae follow the same format as the core’s ones, and can be added at the @@ -20,7 +21,12 @@ easier to grasp, and top-level files are not mixed with formulae. See [homebrew/core](https://github.com/Homebrew/homebrew-core) for an example of a tap with a `Formula` subdirectory. +## Naming your formulae to avoid clashes + +If your formulae have the same name as Homebrew/homebrew-core formulae they cannot be installed side-by-side. If you wish to create a different version of a formula that's in Homebrew/homebrew-core (e.g. with `option`s) consider giving it a different name e.g. `nginx-full` for more fully-featured `nginx` formula. This will allow both `nginx` and `nginx-full` to be installed at the same time (but not linked if there are conflicts and one of them is not declared to be `keg_only`. + ### Installing + If it’s on GitHub, users can install any of your formulae with `brew install user/repo/formula`. Homebrew will automatically add your `github.com/user/homebrew-repo` tap before installing the formula. @@ -42,15 +48,18 @@ no core formula with the same name, or with `brew install user/repo/foo` to avoid conflicts. ## Maintaining a tap + A tap is just a Git repository so you don’t have to do anything specific when making modifications, apart from committing and pushing your changes. ### Updating + Once your tap is installed, Homebrew will update it each time a user runs `brew update`. Outdated formulae will be upgraded when a user runs `brew upgrade`, like core formulae. ## External commands + You can provide your tap users with custom `brew` commands by adding them in a `cmd` subdirectory. [Read more on external commands](External-Commands.md). From 67fadbfc1f850d2b5a0a1e7000d41b5fb5173750 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 26 Jan 2019 19:28:56 +0000 Subject: [PATCH 068/199] Update installation and Linuxbrew documentation Update for the pending 2.0.0 release which will support Linux. --- docs/Installation.md | 17 +++++++++-------- docs/Linuxbrew.md | 8 ++++---- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/docs/Installation.md b/docs/Installation.md index 5e4b64c94c..ea63cb6ef1 100644 --- a/docs/Installation.md +++ b/docs/Installation.md @@ -1,26 +1,27 @@ # Installation -The suggested and easiest way to install Homebrew is on the +The supported and best way to install Homebrew is on the [homepage](https://brew.sh). -The standard script installs Homebrew to `/usr/local` so that +This script installs Homebrew to `/usr/local` so that [you don’t need sudo](FAQ.md#why-does-homebrew-say-sudo-is-bad) when you `brew install`. It is a careful script; it can be run even if you have stuff installed to `/usr/local` already. It tells you exactly what it will do before -it does it too. And you have to confirm everything it will do before it starts. +it does it too. You have to confirm everything it will do before it starts. -## Requirements +## macOS Requirements * An 64-bit Intel CPU [1](#1) -* macOS 10.12 or higher [2](#2) +* macOS 10.12 (or higher) [2](#2) * Command Line Tools (CLT) for Xcode: `xcode-select --install`, [developer.apple.com/downloads](https://developer.apple.com/downloads) or [Xcode](https://itunes.apple.com/us/app/xcode/id497799835) [3](#3) -* A Bourne-compatible shell for installation (e.g. bash or zsh) [4](#4) +* A Bourne-compatible shell for installation (e.g. `bash` or `zsh`) [4](#4) ## Alternative Installs -### OS X Mountain Lion (10.8) and below -Because GitHub now only allows clients that support TLS 1.2 to access repositories over HTTPS, the Homebrew installer will use the Git protocol when run on systems older than OS X Mavericks (10.9). This requires the availability of a `git` binary, which can be provided by pre-installing the [Command Line Tools for Xcode](https://developer.apple.com/download/more/). Homebrew will also require the Command Line Tools or Xcode in order to automatically compile and install a newer `curl` and `git` with support for TLS 1.2. +### Linux or Windows 10 Subsystem for Linux + +Check out [the Linuxbrew installation documentation](Linuxbrew.md). ### Untar anywhere Just extract (or `git clone`) Homebrew wherever you want. Just avoid: diff --git a/docs/Linuxbrew.md b/docs/Linuxbrew.md index 87a9de9038..326bbdb514 100644 --- a/docs/Linuxbrew.md +++ b/docs/Linuxbrew.md @@ -2,7 +2,7 @@ # Linuxbrew -The Homebrew package manager may be used on Linux and Windows 10, using [Windows Subsystem for Linux (WSL)](https://docs.microsoft.com/en-us/windows/wsl/about). Homebrew is referred to as Linuxbrew when running on Linux or Windows. It can be installed in your home directory, in which case it does not use *sudo*. Linuxbrew does not use any libraries provided by your host system, except *glibc* and *gcc* if they are new enough. Linuxbrew can install its own current versions of *glibc* and *gcc* for older distribution of Linux. +The Homebrew package manager may be used on Linux and Windows 10, using [Windows Subsystem for Linux (WSL)](https://docs.microsoft.com/en-us/windows/wsl/about). Homebrew is referred to as Linuxbrew when running on Linux or WSL. It can be installed in your home directory, in which case it does not use *sudo*. Linuxbrew does not use any libraries provided by your host system, except *glibc* and *gcc* if they are new enough. Linuxbrew can install its own current versions of *glibc* and *gcc* for older distributions of Linux. [Features](#features), [dependencies](#dependencies) and [installation instructions](#install) are described below. Terminology (e.g. the difference between a Cellar, Tap, Cask and so forth) is [explained in the documentation](Formula-Cookbook.md#homebrew-terminology). @@ -40,12 +40,12 @@ brew install hello If you're using an older distribution of Linux, installing your first package will also install a recent version of `glibc` and `gcc`. Use `brew doctor` to troubleshoot common issues. -## Dependencies +## Linux/WSL Requirements + **GCC** 4.4 or newer + **Linux** 2.6.32 or newer + **Glibc** 2.12 or newer -+ **64-bit x86** CPU ++ **64-bit x86_64** CPU Paste at a terminal prompt: @@ -71,7 +71,7 @@ Linuxbrew does not currently support 32-bit x86 platforms. It would be possible ## Alternative Installation -Extract or `git clone` Linuxbrew wherever you want. Use `/home/linuxbrew/.linuxbrew` if possible. +Extract or `git clone` Linuxbrew wherever you want. Use `/home/linuxbrew/.linuxbrew` if possible (to enabled the use of binary packages). ```sh git clone https://github.com/Homebrew/brew ~/.linuxbrew/Homebrew From 1aa8ad09e212cd9cd2f3ae55f899ed4ef03ae4d0 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 26 Jan 2019 17:13:14 +0000 Subject: [PATCH 069/199] Deprecate macOS versions below Mavericks And remove all dead/unneeded code. --- Library/Homebrew/brew.sh | 22 +-- Library/Homebrew/compilers.rb | 20 +-- Library/Homebrew/development_tools.rb | 13 -- Library/Homebrew/diagnostic.rb | 2 - Library/Homebrew/emoji.rb | 3 - Library/Homebrew/extend/ENV/shared.rb | 12 -- Library/Homebrew/extend/ENV/std.rb | 15 +-- Library/Homebrew/extend/ENV/super.rb | 19 +-- Library/Homebrew/extend/os/emoji.rb | 1 - .../extend/os/mac/dependency_collector.rb | 14 +- .../extend/os/mac/development_tools.rb | 33 +---- Library/Homebrew/extend/os/mac/emoji.rb | 7 - .../Homebrew/extend/os/mac/extend/ENV/std.rb | 26 +--- .../extend/os/mac/extend/ENV/super.rb | 17 +-- .../Homebrew/extend/os/mac/hardware/cpu.rb | 125 ++++-------------- .../Homebrew/extend/os/mac/missing_formula.rb | 12 +- .../Homebrew/extend/os/mac/system_config.rb | 4 +- .../Homebrew/extend/os/mac/utils/bottles.rb | 8 +- Library/Homebrew/formula.rb | 15 +-- Library/Homebrew/hardware.rb | 12 -- Library/Homebrew/language/haskell.rb | 5 - Library/Homebrew/os/mac.rb | 24 ---- Library/Homebrew/os/mac/architecture_list.rb | 36 +---- Library/Homebrew/os/mac/sdk.rb | 2 - Library/Homebrew/os/mac/version.rb | 17 +-- Library/Homebrew/os/mac/xcode.rb | 72 ++-------- Library/Homebrew/os/mac/xquartz.rb | 56 +------- .../requirements/xcode_requirement.rb | 6 +- Library/Homebrew/rubocops/lines.rb | 7 - Library/Homebrew/sandbox.rb | 2 +- Library/Homebrew/software_spec.rb | 4 + Library/Homebrew/test/ENV_spec.rb | 23 +--- .../Homebrew/test/compiler_failure_spec.rb | 9 +- .../Homebrew/test/compiler_selector_spec.rb | 33 +---- Library/Homebrew/test/cxxstdlib_spec.rb | 10 -- Library/Homebrew/test/hardware/cpu_spec.rb | 75 ----------- .../test/os/mac/dependency_collector_spec.rb | 15 +-- Library/Homebrew/test/os/mac/hardware_spec.rb | 56 -------- Library/Homebrew/test/os/mac/mach_spec.rb | 26 +--- Library/Homebrew/test/os/mac/version_spec.rb | 36 +++-- Library/Homebrew/test/rubocops/lines_spec.rb | 11 -- .../cask/Casks/with-depends-on-macos-array.rb | 2 +- .../Casks/with-depends-on-macos-comparison.rb | 2 +- .../Casks/with-depends-on-macos-failure.rb | 2 +- .../test/utils/bottles/bottles_spec.rb | 23 +--- .../test/utils/bottles/collector_spec.rb | 14 +- docs/Common-Issues.md | 23 ---- docs/Gems,-Eggs-and-Perl-Modules.md | 4 +- docs/Installation.md | 4 + docs/Python-for-Formula-Authors.md | 8 +- 50 files changed, 157 insertions(+), 830 deletions(-) delete mode 100644 Library/Homebrew/extend/os/emoji.rb delete mode 100644 Library/Homebrew/extend/os/mac/emoji.rb delete mode 100644 Library/Homebrew/test/os/mac/hardware_spec.rb diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index 788a610b23..ff112c1221 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -93,23 +93,14 @@ then # Don't change this from Mac OS X to match what macOS itself does in Safari on 10.12 HOMEBREW_OS_USER_AGENT_VERSION="Mac OS X $HOMEBREW_MACOS_VERSION" - # The system Curl is too old for some modern HTTPS certificates on - # older macOS versions. - # # Intentionally set this variable by exploding another. # shellcheck disable=SC2086,SC2183 printf -v HOMEBREW_MACOS_VERSION_NUMERIC "%02d%02d%02d" ${HOMEBREW_MACOS_VERSION//./ } - if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "101000" ]] - then - HOMEBREW_SYSTEM_CURL_TOO_OLD="1" - HOMEBREW_FORCE_BREWED_CURL="1" - fi - # Announce pre-Mavericks deprecation now + # Refuse to run on pre-Mavericks if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "100900" ]] then - printf "WARNING: Your version of macOS (%s) will not be able to run Homebrew when\n" "$HOMEBREW_MACOS_VERSION" >&2 - printf " version 2.0.0 is released (Q1 2019)!\n" >&2 + printf "ERROR: Your version of macOS (%s) is too old to run Homebrew!" "$HOMEBREW_MACOS_VERSION" >&2 if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "100700" ]] then printf " For 10.4 - 10.6 support see: https://github.com/mistydemeo/tigerbrew\n" >&2 @@ -117,6 +108,15 @@ then printf "\n" >&2 fi + # The system Curl is too old for some modern HTTPS certificates on + # older macOS versions. + # + if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "101000" ]] + then + HOMEBREW_SYSTEM_CURL_TOO_OLD="1" + HOMEBREW_FORCE_BREWED_CURL="1" + fi + # The system Git on macOS versions before Sierra is too old for some Homebrew functionality we rely on. HOMEBREW_MINIMUM_GIT_VERSION="2.14.3" if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "101200" ]] diff --git a/Library/Homebrew/compilers.rb b/Library/Homebrew/compilers.rb index 4c6bc285ee..5f79d32dce 100644 --- a/Library/Homebrew/compilers.rb +++ b/Library/Homebrew/compilers.rb @@ -4,7 +4,6 @@ module CompilerConstants GNU_GCC_REGEXP = /^gcc-(4\.9|[5-8])$/.freeze COMPILER_SYMBOL_MAP = { "gcc" => :gcc, - "gcc-4.2" => :gcc_4_2, "clang" => :clang, "llvm_clang" => :llvm_clang, }.freeze @@ -19,9 +18,11 @@ class CompilerFailure def version(val = nil) if val @version = Version.parse(val.to_s) - else - @version + if name.to_s == "clang" && val.to_i < 600 + odisabled "'fails_with :clang' with 'build' < 600" + end end + @version end # Allows Apple compiler `fails_with` statements to keep using `build` @@ -66,14 +67,6 @@ class CompilerFailure end COLLECTIONS = { - cxx11: [ - create(:gcc_4_2), - create(:clang) { build 425 }, - ], - cxx14: [ - create(:clang) { build 600 }, - create(:gcc_4_2), - ], openmp: [ create(:clang), ], @@ -86,9 +79,8 @@ class CompilerSelector Compiler = Struct.new(:name, :version) COMPILER_PRIORITY = { - clang: [:clang, :gcc_4_2, :gnu, :llvm_clang], - gcc_4_2: [:gcc_4_2, :gnu, :clang], - gcc: [:gnu, :gcc, :llvm_clang, :clang, :gcc_4_2], + clang: [:clang, :gnu, :llvm_clang], + gcc: [:gnu, :gcc, :llvm_clang, :clang], }.freeze def self.select_for(formula, compilers = self.compilers) diff --git a/Library/Homebrew/development_tools.rb b/Library/Homebrew/development_tools.rb index 728b4177e1..0e730f3ab6 100644 --- a/Library/Homebrew/development_tools.rb +++ b/Library/Homebrew/development_tools.rb @@ -37,18 +37,6 @@ class DevelopmentTools :clang end - def gcc_4_2_build_version - @gcc_4_2_build_version ||= begin - if (gcc = locate("gcc-4.2")) && - !gcc.realpath.basename.to_s.start_with?("llvm") && - build_version = `#{gcc} --version 2>/dev/null`[/build (\d{4,})/, 1] - Version.new build_version - else - Version::NULL - end - end - end - def clang_version @clang_version ||= begin if (path = locate("clang")) && @@ -98,7 +86,6 @@ class DevelopmentTools end def clear_version_cache - @gcc_4_2_build_version = nil @clang_version = @clang_build_version = nil @non_apple_gcc_version = {} end diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 29a281a333..b62a5b9842 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -190,8 +190,6 @@ module Homebrew # Static libs which are generally OK should be added to this list, # with a short description of the software they come with. white_list = [ - "libsecurity_agent_client.a", # OS X 10.8.2 Supplemental Update - "libsecurity_agent_server.a", # OS X 10.8.2 Supplemental Update "libntfs-3g.a", # NTFS-3G "libntfs.a", # NTFS-3G "libublio.a", # NTFS-3G diff --git a/Library/Homebrew/emoji.rb b/Library/Homebrew/emoji.rb index 43fa781e6b..652d5b2eb6 100644 --- a/Library/Homebrew/emoji.rb +++ b/Library/Homebrew/emoji.rb @@ -7,8 +7,5 @@ module Emoji def enabled? !ENV["HOMEBREW_NO_EMOJI"] end - alias generic_enabled? enabled? end end - -require "extend/os/emoji" diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb index 138418f24e..36f932bc40 100644 --- a/Library/Homebrew/extend/ENV/shared.rb +++ b/Library/Homebrew/extend/ENV/shared.rb @@ -316,18 +316,6 @@ module SharedEnvExtension %w[clang llvm_clang].include?(cc.to_s) end - # @private - def compiler_with_cxx11_support?(cc) - return if compiler_any_clang?(cc) - - version = if cc == :gcc - DevelopmentTools.non_apple_gcc_version "gcc" - else - cc[/^gcc-(\d+(?:\.\d+)?)$/, 1] - end - version && Version.create(version) >= Version.create("4.8") - end - private def cc=(val) diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb index a909f41df6..2f25389771 100644 --- a/Library/Homebrew/extend/ENV/std.rb +++ b/Library/Homebrew/extend/ENV/std.rb @@ -100,11 +100,6 @@ module Stdenv dir/base.to_s.sub("gcc", "g++").sub("clang", "clang++") end - def gcc_4_2 - super - set_cpu_cflags - end - GNU_GCC_VERSIONS.each do |n| define_method(:"gcc-#{n}") do super() @@ -145,14 +140,8 @@ module Stdenv end def cxx11 - if compiler == :clang - append "CXX", "-std=c++11" - append "CXX", "-stdlib=libc++" - elsif compiler_with_cxx11_support?(compiler) - append "CXX", "-std=c++11" - else - raise "The selected compiler doesn't support C++11: #{compiler}" - end + append "CXX", "-std=c++11" + libcxx end def libcxx diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index 91b83a1f93..0b5cb41eaf 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -77,7 +77,7 @@ module Superenv # K - Don't strip -arch , -m32, or -m64 # w - Pass -no_weak_imports to the linker # - # On 10.8 and newer, these flags will also be present: + # These flags will also be present: # s - apply fix for sed's Unicode support # a - apply fix for apr-1-config path end @@ -109,13 +109,8 @@ module Superenv path.append(homebrew_extra_paths) path.append("/usr/bin", "/bin", "/usr/sbin", "/sbin") - # Homebrew's apple-gcc42 will be outside the PATH in superenv, - # so xcrun may not be able to find it begin - case homebrew_cc - when "gcc-4.2" - path.append(Formulary.factory("apple-gcc42").opt_bin) - when GNU_GCC_REGEXP + if homebrew_cc =~ GNU_GCC_REGEXP path.append(gcc_version_formula($&).opt_bin) end rescue FormulaUnavailableError @@ -279,14 +274,8 @@ module Superenv end def cxx11 - if homebrew_cc == "clang" - append_to_cccfg "x" - append_to_cccfg "g" - elsif compiler_with_cxx11_support?(homebrew_cc) - append_to_cccfg "x" - else - raise "The selected compiler doesn't support C++11: #{homebrew_cc}" - end + append_to_cccfg "x" + append_to_cccfg "g" if homebrew_cc == "clang" end def libcxx diff --git a/Library/Homebrew/extend/os/emoji.rb b/Library/Homebrew/extend/os/emoji.rb deleted file mode 100644 index 59efced1d7..0000000000 --- a/Library/Homebrew/extend/os/emoji.rb +++ /dev/null @@ -1 +0,0 @@ -require "extend/os/mac/emoji" if OS.mac? diff --git a/Library/Homebrew/extend/os/mac/dependency_collector.rb b/Library/Homebrew/extend/os/mac/dependency_collector.rb index 4a49c8d292..014fecdb5e 100644 --- a/Library/Homebrew/extend/os/mac/dependency_collector.rb +++ b/Library/Homebrew/extend/os/mac/dependency_collector.rb @@ -2,25 +2,15 @@ class DependencyCollector undef git_dep_if_needed, subversion_dep_if_needed, cvs_dep_if_needed, xz_dep_if_needed, unzip_dep_if_needed, bzip2_dep_if_needed - def git_dep_if_needed(tags) - return if MacOS.version >= :lion - - Dependency.new("git", tags) - end + def git_dep_if_needed(tags); end def subversion_dep_if_needed(tags); end def cvs_dep_if_needed(tags) - return if MacOS.version < :lion - Dependency.new("cvs", tags) end - def xz_dep_if_needed(tags) - return if MacOS.version >= :mavericks - - Dependency.new("xz", tags) - end + def xz_dep_if_needed(tags); end def unzip_dep_if_needed(tags); end diff --git a/Library/Homebrew/extend/os/mac/development_tools.rb b/Library/Homebrew/extend/os/mac/development_tools.rb index 018ab77547..1d4f6fe435 100644 --- a/Library/Homebrew/extend/os/mac/development_tools.rb +++ b/Library/Homebrew/extend/os/mac/development_tools.rb @@ -26,17 +26,7 @@ class DevelopmentTools end def default_compiler - case default_cc - when /^gcc/ then :gcc_4_2 - when "clang" then :clang - else - # guess :( - if MacOS::Xcode.version >= "4.3" - :clang - else - :gcc_4_2 - end - end + :clang end def curl_handles_most_https_certificates? @@ -52,23 +42,10 @@ class DevelopmentTools end def installation_instructions - if MacOS.version >= "10.9" - <<~EOS - Install the Command Line Tools: - xcode-select --install - EOS - elsif MacOS.version == "10.8" || MacOS.version == "10.7" - <<~EOS - Install the Command Line Tools from - https://developer.apple.com/download/more/ - or via Xcode's preferences. - EOS - else - <<~EOS - Install Xcode from - https://developer.apple.com/download/more/ - EOS - end + <<~EOS + Install the Command Line Tools: + xcode-select --install + EOS end def custom_installation_instructions diff --git a/Library/Homebrew/extend/os/mac/emoji.rb b/Library/Homebrew/extend/os/mac/emoji.rb deleted file mode 100644 index 79c0c78e36..0000000000 --- a/Library/Homebrew/extend/os/mac/emoji.rb +++ /dev/null @@ -1,7 +0,0 @@ -module Emoji - class << self - def enabled? - generic_enabled? && MacOS.version >= :lion - end - end -end diff --git a/Library/Homebrew/extend/os/mac/extend/ENV/std.rb b/Library/Homebrew/extend/os/mac/extend/ENV/std.rb index 04a2cb8e17..a44a614a61 100644 --- a/Library/Homebrew/extend/os/mac/extend/ENV/std.rb +++ b/Library/Homebrew/extend/os/mac/extend/ENV/std.rb @@ -27,36 +27,24 @@ module Stdenv append_path "ACLOCAL_PATH", "#{MacOS::X11.share}/aclocal" - if MacOS::XQuartz.provided_by_apple? && MacOS.sdk_path_if_needed - append_path "CMAKE_PREFIX_PATH", "#{MacOS.sdk_path_if_needed}/usr/X11" - end - append "CFLAGS", "-I#{MacOS::X11.include}" unless MacOS::CLT.installed? end def setup_build_environment(formula = nil) generic_setup_build_environment formula - if MacOS.version >= :mountain_lion - # Mountain Lion's sed is stricter, and errors out when - # it encounters files with mixed character sets - delete("LC_ALL") - self["LC_CTYPE"] = "C" - end + # sed is strict, and errors out when it encounters files with + # mixed character sets + delete("LC_ALL") + self["LC_CTYPE"] = "C" # Add lib and include etc. from the current macosxsdk to compiler flags: macosxsdk MacOS.version - if MacOS::Xcode.without_clt? - append_path "PATH", "#{MacOS::Xcode.prefix}/usr/bin" - append_path "PATH", "#{MacOS::Xcode.toolchain_path}/usr/bin" - end + return unless MacOS::Xcode.without_clt? - # Leopard's ld needs some convincing that it's building 64-bit - # See: https://github.com/mistydemeo/tigerbrew/issues/59 - return unless MacOS.version == :leopard - - append "LDFLAGS", "-arch #{Hardware::CPU.arch_64_bit}" + append_path "PATH", "#{MacOS::Xcode.prefix}/usr/bin" + append_path "PATH", "#{MacOS::Xcode.toolchain_path}/usr/bin" end def remove_macosxsdk(version = MacOS.version) diff --git a/Library/Homebrew/extend/os/mac/extend/ENV/super.rb b/Library/Homebrew/extend/os/mac/extend/ENV/super.rb index 1b1c8afc9b..0d8db8c8bb 100644 --- a/Library/Homebrew/extend/os/mac/extend/ENV/super.rb +++ b/Library/Homebrew/extend/os/mac/extend/ENV/super.rb @@ -22,13 +22,6 @@ module Superenv def homebrew_extra_paths paths = [] - # On 10.9, there are shims for all tools in /usr/bin. - # On 10.7 and 10.8 we need to add these directories ourselves. - if MacOS::Xcode.without_clt? && MacOS.version <= "10.8" - paths << "#{MacOS::Xcode.prefix}/usr/bin" - paths << "#{MacOS::Xcode.toolchain_path}/usr/bin" - end - paths << MacOS::X11.bin.to_s if x11? paths end @@ -96,9 +89,9 @@ module Superenv def determine_cccfg s = "" # Fix issue with sed barfing on unicode characters on Mountain Lion - s << "s" if MacOS.version >= :mountain_lion - # Fix issue with >= 10.8 apr-1-config having broken paths - s << "a" if MacOS.version >= :mountain_lion + s << "s" + # Fix issue with >= Mountain Lion apr-1-config having broken paths + s << "a" s end @@ -133,9 +126,9 @@ module Superenv ENV["ac_have_clock_syscall"] = "no" end - # On 10.9, the tools in /usr/bin proxy to the active developer directory. + # The tools in /usr/bin proxy to the active developer directory. # This means we can use them for any combination of CLT and Xcode. - self["HOMEBREW_PREFER_CLT_PROXIES"] = "1" if MacOS.version >= "10.9" + self["HOMEBREW_PREFER_CLT_PROXIES"] = "1" end def no_weak_imports diff --git a/Library/Homebrew/extend/os/mac/hardware/cpu.rb b/Library/Homebrew/extend/os/mac/hardware/cpu.rb index 4a70687ba2..c8e3c9f393 100644 --- a/Library/Homebrew/extend/os/mac/hardware/cpu.rb +++ b/Library/Homebrew/extend/os/mac/hardware/cpu.rb @@ -1,20 +1,7 @@ module Hardware class CPU class << self - undef optimization_flags, type, family, universal_archs, can_run?, - features, sse4? - - PPC_OPTIMIZATION_FLAGS = { - g3: "-mcpu=750", - g4: "-mcpu=7400", - g4e: "-mcpu=7450", - g5: "-mcpu=970", - g5_64: "-mcpu=970 -arch ppc64", - }.freeze - - def optimization_flags - OPTIMIZATION_FLAGS.merge(PPC_OPTIMIZATION_FLAGS) - end + undef type, family, universal_archs, features, sse4? # These methods use info spewed out by sysctl. # Look in for decoding info. @@ -22,54 +9,37 @@ module Hardware case sysctl_int("hw.cputype") when 7 :intel - when 18 - :ppc else :dunno end end def family - if intel? - case sysctl_int("hw.cpufamily") - when 0x73d67300 # Yonah: Core Solo/Duo - :core - when 0x426f69ef # Merom: Core 2 Duo - :core2 - when 0x78ea4fbc # Penryn - :penryn - when 0x6b5a4cd2 # Nehalem - :nehalem - when 0x573B5EEC # Arrandale - :arrandale - when 0x5490B78C # Sandy Bridge - :sandybridge - when 0x1F65E835 # Ivy Bridge - :ivybridge - when 0x10B282DC # Haswell - :haswell - when 0x582ed09c # Broadwell - :broadwell - when 0x37fc219f # Skylake - :skylake - when 0x0f817246 # Kaby Lake - :kabylake - else - :dunno - end - elsif ppc? - case sysctl_int("hw.cpusubtype") - when 9 - :g3 # PowerPC 750 - when 10 - :g4 # PowerPC 7400 - when 11 - :g4e # PowerPC 7450 - when 100 - :g5_64 # PowerPC 970 - else - :dunno - end + case sysctl_int("hw.cpufamily") + when 0x73d67300 # Yonah: Core Solo/Duo + :core + when 0x426f69ef # Merom: Core 2 Duo + :core2 + when 0x78ea4fbc # Penryn + :penryn + when 0x6b5a4cd2 # Nehalem + :nehalem + when 0x573B5EEC # Arrandale + :arrandale + when 0x5490B78C # Sandy Bridge + :sandybridge + when 0x1F65E835 # Ivy Bridge + :ivybridge + when 0x10B282DC # Haswell + :haswell + when 0x582ed09c # Broadwell + :broadwell + when 0x37fc219f # Skylake + :skylake + when 0x0f817246 # Kaby Lake + :kabylake + else + :dunno end end @@ -83,20 +53,6 @@ module Hardware [arch_64_bit, arch_32_bit].extend ArchitectureListExtension end - # Determines whether the current CPU and macOS combination - # can run an executable of the specified architecture. - # `arch` is a symbol in the same format returned by - # {Hardware::CPU.family}. - def can_run?(arch) - if Hardware::CPU.intel? - intel_can_run? arch - elsif Hardware::CPU.ppc? - ppc_can_run? arch - else - false - end - end - def features @features ||= sysctl_n( "machdep.cpu.features", @@ -156,35 +112,6 @@ module Hardware @properties[keys] = Utils.popen_read("/usr/sbin/sysctl", "-n", *keys) end end - - def intel_can_run?(arch) - case arch - when *PPC_32BIT_ARCHS - # Rosetta is still available - MacOS.version < :lion - when *PPC_64BIT_ARCHS - # Rosetta never supported PPC64 - false - when *INTEL_64BIT_ARCHS - Hardware::CPU.is_64_bit? - when *INTEL_32BIT_ARCHS - true - else # dunno - false - end - end - - def ppc_can_run?(arch) - case arch - when *PPC_32BIT_ARCHS - true - when *PPC_64BIT_ARCHS - Hardware::CPU.is_64_bit? - else - # Intel is never supported - false - end - end end end end diff --git a/Library/Homebrew/extend/os/mac/missing_formula.rb b/Library/Homebrew/extend/os/mac/missing_formula.rb index ea6d50112a..cf54137adb 100644 --- a/Library/Homebrew/extend/os/mac/missing_formula.rb +++ b/Library/Homebrew/extend/os/mac/missing_formula.rb @@ -4,15 +4,9 @@ module Homebrew def blacklisted_reason(name) case name.downcase when "xcode" - if MacOS.version >= :lion - <<~EOS - Xcode can be installed from the App Store. - EOS - else - <<~EOS - Xcode can be installed from #{Formatter.url("https://developer.apple.com/download/more/")}. - EOS - end + <<~EOS + Xcode can be installed from the App Store. + EOS else generic_blacklisted_reason(name) end diff --git a/Library/Homebrew/extend/os/mac/system_config.rb b/Library/Homebrew/extend/os/mac/system_config.rb index 89989aa750..a773128f37 100644 --- a/Library/Homebrew/extend/os/mac/system_config.rb +++ b/Library/Homebrew/extend/os/mac/system_config.rb @@ -36,7 +36,7 @@ class SystemConfig end def clt - @clt ||= if MacOS::CLT.installed? && MacOS::Xcode.version >= "4.3" + @clt ||= if MacOS::CLT.installed? MacOS::CLT.version end end @@ -59,7 +59,7 @@ class SystemConfig f.puts "CLT: #{clt || "N/A"}" f.puts "Xcode: #{xcode || "N/A"}" f.puts "CLT headers: #{clt_headers}" if MacOS::CLT.separate_header_package? && clt_headers - f.puts "XQuartz: #{xquartz}" if !MacOS::XQuartz.provided_by_apple? && xquartz + f.puts "XQuartz: #{xquartz}" if xquartz end end end diff --git a/Library/Homebrew/extend/os/mac/utils/bottles.rb b/Library/Homebrew/extend/os/mac/utils/bottles.rb index d6ab6f6a2b..954ca0b36d 100644 --- a/Library/Homebrew/extend/os/mac/utils/bottles.rb +++ b/Library/Homebrew/extend/os/mac/utils/bottles.rb @@ -4,13 +4,7 @@ module Utils undef tag def tag - if MacOS.version >= :lion - MacOS.cat - elsif MacOS.version == :snow_leopard - Hardware::CPU.is_64_bit? ? :snow_leopard : :snow_leopard_32 - else - "#{MacOS.cat}_64".to_sym - end + MacOS.cat end end diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 982b53282e..106154944c 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1034,7 +1034,7 @@ class Formula # called or when brewing a formula. # This is optional. You can use all the vars like #{version} here. # EOS - # s += "Some issue only on older systems" if MacOS.version < :mountain_lion + # s += "Some issue only on older systems" if MacOS.version < :el_capitan # s # end def caveats @@ -2350,12 +2350,9 @@ class Formula #
# Optional and enforce that boost is built with `--with-c++11`.
     # depends_on "boost" => [:optional, "with-c++11"]
#
# If a dependency is only needed in certain cases:
-    # depends_on "sqlite" if MacOS.version == :leopard
+    # depends_on "sqlite" if MacOS.version == :mavericks
     # depends_on :xcode # If the formula really needs full Xcode.
-    # depends_on :macos => :lion # Needs at least OS X Lion (10.7).
-    # depends_on :arch => :intel # If this formula only builds on Intel architecture.
-    # depends_on :arch => :x86_64 # If this formula only builds on Intel x86 64-bit.
-    # depends_on :arch => :ppc # Only builds on PowerPC?
+    # depends_on :macos => :mojave # Needs at least OS X Lion (10.14).
     # depends_on :x11 => :optional # X11/XQuartz components.
     # depends_on :osxfuse # Permits the use of the upstream signed binary or our source package.
     # depends_on :tuntap # Does the same thing as above. This is vital for Yosemite and above.
@@ -2366,8 +2363,6 @@ class Formula # depends_on "python3" => :optional #
# Python 2.7:
     # depends_on "python@2"
- #
# Python 2.7 but use system Python where possible
-    # depends_on "python@2" if MacOS.version <= :snow_leopard
def depends_on(dep) specs.each { |spec| spec.depends_on(dep) } end @@ -2511,10 +2506,14 @@ class Formula # end def fails_with(compiler, &block) odisabled "fails_with :gcc_4_0" if compiler == :gcc_4_0 + odisabled "fails_with :gcc_4_2" if compiler == :gcc_4_2 + odisabled "fails_with :gcc" if compiler == :gcc && !block_given? specs.each { |spec| spec.fails_with(compiler, &block) } end def needs(*standards) + odisabled "needs :cxx11" if standards.include?(:cxx11) + odisabled "needs :cxx14" if standards.include?(:cxx14) specs.each { |spec| spec.needs(*standards) } end diff --git a/Library/Homebrew/hardware.rb b/Library/Homebrew/hardware.rb index 2611bad014..b687b841a7 100644 --- a/Library/Homebrew/hardware.rb +++ b/Library/Homebrew/hardware.rb @@ -117,18 +117,6 @@ module Hardware def feature?(name) features.include?(name) end - - def can_run?(arch) - if is_32_bit? - arch_32_bit == arch - elsif intel? - (INTEL_32BIT_ARCHS + INTEL_64BIT_ARCHS).include?(arch) - elsif ppc? - (PPC_32BIT_ARCHS + PPC_64BIT_ARCHS).include?(arch) - else - false - end - end end end diff --git a/Library/Homebrew/language/haskell.rb b/Library/Homebrew/language/haskell.rb index dfe6a0dde6..bf68441fae 100644 --- a/Library/Homebrew/language/haskell.rb +++ b/Library/Homebrew/language/haskell.rb @@ -1,11 +1,6 @@ module Language module Haskell module Cabal - def self.included(base) - # use llvm-gcc on Lion or below, as when building GHC) - base.fails_with(:clang) if MacOS.version <= :lion - end - def cabal_sandbox(options = {}) pwd = Pathname.pwd home = options[:home] || pwd diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index c7d7c59050..2fdb2c24ea 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -167,30 +167,6 @@ module OS end STANDARD_COMPILERS = { - "3.1.4" => { gcc_4_2_build: 5577 }, - "3.2.6" => { gcc_4_2_build: 5666, clang: "1.7", clang_build: 77 }, - "4.0" => { gcc_4_2_build: 5666, clang: "2.0", clang_build: 137 }, - "4.0.1" => { gcc_4_2_build: 5666, clang: "2.0", clang_build: 137 }, - "4.0.2" => { gcc_4_2_build: 5666, clang: "2.0", clang_build: 137 }, - "4.2" => { clang: "3.0", clang_build: 211 }, - "4.3" => { clang: "3.1", clang_build: 318 }, - "4.3.1" => { clang: "3.1", clang_build: 318 }, - "4.3.2" => { clang: "3.1", clang_build: 318 }, - "4.3.3" => { clang: "3.1", clang_build: 318 }, - "4.4" => { clang: "4.0", clang_build: 421 }, - "4.4.1" => { clang: "4.0", clang_build: 421 }, - "4.5" => { clang: "4.1", clang_build: 421 }, - "4.5.1" => { clang: "4.1", clang_build: 421 }, - "4.5.2" => { clang: "4.1", clang_build: 421 }, - "4.6" => { clang: "4.2", clang_build: 425 }, - "4.6.1" => { clang: "4.2", clang_build: 425 }, - "4.6.2" => { clang: "4.2", clang_build: 425 }, - "4.6.3" => { clang: "4.2", clang_build: 425 }, - "5.0" => { clang: "5.0", clang_build: 500 }, - "5.0.1" => { clang: "5.0", clang_build: 500 }, - "5.0.2" => { clang: "5.0", clang_build: 500 }, - "5.1" => { clang: "5.1", clang_build: 503 }, - "5.1.1" => { clang: "5.1", clang_build: 503 }, "6.0" => { clang: "6.0", clang_build: 600 }, "6.0.1" => { clang: "6.0", clang_build: 600 }, "6.1" => { clang: "6.0", clang_build: 600 }, diff --git a/Library/Homebrew/os/mac/architecture_list.rb b/Library/Homebrew/os/mac/architecture_list.rb index 6b357652e7..aa3c035b79 100644 --- a/Library/Homebrew/os/mac/architecture_list.rb +++ b/Library/Homebrew/os/mac/architecture_list.rb @@ -1,49 +1,15 @@ require "hardware" module ArchitectureListExtension - # @private - def fat? - length > 1 - end - - # @private - def intel_universal? - intersects_all?(Hardware::CPU::INTEL_32BIT_ARCHS, Hardware::CPU::INTEL_64BIT_ARCHS) - end - - # @private - def ppc_universal? - intersects_all?(Hardware::CPU::PPC_32BIT_ARCHS, Hardware::CPU::PPC_64BIT_ARCHS) - end - - # Old-style 32-bit PPC/Intel universal, e.g. ppc7400 and i386 - # @private - def cross_universal? - intersects_all?(Hardware::CPU::PPC_32BIT_ARCHS, Hardware::CPU::INTEL_32BIT_ARCHS) - end - # @private def universal? - intel_universal? || ppc_universal? || cross_universal? - end - - def ppc? - (Hardware::CPU::PPC_32BIT_ARCHS + Hardware::CPU::PPC_64BIT_ARCHS).any? { |a| include? a } - end - - # @private - def remove_ppc! - (Hardware::CPU::PPC_32BIT_ARCHS + Hardware::CPU::PPC_64BIT_ARCHS).each { |a| delete a } + intersects_all?(Hardware::CPU::INTEL_32BIT_ARCHS, Hardware::CPU::INTEL_64BIT_ARCHS) end def as_arch_flags map { |a| "-arch #{a}" }.join(" ") end - def as_cmake_arch_flags - join(";") - end - protected def intersects_all?(*set) diff --git a/Library/Homebrew/os/mac/sdk.rb b/Library/Homebrew/os/mac/sdk.rb index 63b20cd7c7..1bae724ee7 100644 --- a/Library/Homebrew/os/mac/sdk.rb +++ b/Library/Homebrew/os/mac/sdk.rb @@ -84,8 +84,6 @@ module OS @sdk_prefix ||= begin # Xcode.prefix is pretty smart, so let's look inside to find the sdk sdk_prefix = "#{Xcode.prefix}/Platforms/MacOSX.platform/Developer/SDKs" - # Xcode < 4.3 style - sdk_prefix = "/Developer/SDKs" unless File.directory? sdk_prefix # Finally query Xcode itself (this is slow, so check it last) sdk_platform_path = Utils.popen_read(DevelopmentTools.locate("xcrun"), "--show-sdk-platform-path").chomp sdk_prefix = File.join(sdk_platform_path, "Developer", "SDKs") unless File.directory? sdk_prefix diff --git a/Library/Homebrew/os/mac/version.rb b/Library/Homebrew/os/mac/version.rb index fe1d7988f4..8adf848d2f 100644 --- a/Library/Homebrew/os/mac/version.rb +++ b/Library/Homebrew/os/mac/version.rb @@ -4,17 +4,12 @@ module OS module Mac class Version < ::Version SYMBOLS = { - mojave: "10.14", - high_sierra: "10.13", - sierra: "10.12", - el_capitan: "10.11", - yosemite: "10.10", - mavericks: "10.9", - mountain_lion: "10.8", - lion: "10.7", - snow_leopard: "10.6", - leopard_64: "10.5", - leopard: "10.5", + mojave: "10.14", + high_sierra: "10.13", + sierra: "10.12", + el_capitan: "10.11", + yosemite: "10.10", + mavericks: "10.9", }.freeze def self.from_symbol(sym) diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb index 549f7a02fd..7d1742e3ce 100644 --- a/Library/Homebrew/os/mac/xcode.rb +++ b/Library/Homebrew/os/mac/xcode.rb @@ -9,10 +9,6 @@ module OS def latest_version case MacOS.version - when "10.5" then "3.1.4" - when "10.6" then "3.2.6" - when "10.7" then "4.6.3" - when "10.8" then "5.1.1" when "10.9" then "6.2" when "10.10" then "7.2.1" when "10.11" then "8.2.1" @@ -59,7 +55,7 @@ module OS end def without_clt? - version >= "4.3" && !MacOS::CLT.installed? + !MacOS::CLT.installed? end # Returns a Pathname object corresponding to Xcode.app's Developer @@ -80,8 +76,6 @@ module OS end def toolchain_path - return if version < "4.3" - Pathname.new("#{prefix}/Toolchains/XcodeDefault.xctoolchain") end @@ -110,14 +104,14 @@ module OS end def update_instructions - if MacOS.version >= "10.9" && !OS::Mac.prerelease? + if OS::Mac.prerelease? <<~EOS - Xcode can be updated from the App Store. + Xcode can be updated from: + https://developer.apple.com/download/more/ EOS else <<~EOS - Xcode can be updated from - https://developer.apple.com/download/more/ + Xcode can be updated from the App Store. EOS end end @@ -169,18 +163,6 @@ module OS # comparable version. case (DevelopmentTools.clang_version.to_f * 10).to_i when 0 then "dunno" - when 1..14 then "3.2.2" - when 15 then "3.2.4" - when 16 then "3.2.5" - when 17..20 then "4.0" - when 21 then "4.1" - when 22..30 then "4.2" - when 31 then "4.3" - when 40 then "4.4" - when 41 then "4.5" - when 42 then "4.6" - when 50 then "5.0" - when 51 then "5.1" when 60 then "6.0" when 61 then "6.1" when 70 then "7.0" @@ -194,24 +176,14 @@ module OS end end - def provides_gcc? - version < "4.3" - end - def default_prefix? - if version < "4.3" - prefix.to_s.start_with? "/Developer" - else - prefix.to_s == "/Applications/Xcode.app/Contents/Developer" - end + prefix.to_s == "/Applications/Xcode.app/Contents/Developer" end end module CLT module_function - STANDALONE_PKG_ID = "com.apple.pkg.DeveloperToolsCLILeo".freeze - FROM_XCODE_PKG_ID = "com.apple.pkg.DeveloperToolsCLI".freeze # The original Mavericks CLT package ID EXECUTABLE_PKG_ID = "com.apple.pkg.CLTools_Executables".freeze MAVERICKS_NEW_PKG_ID = "com.apple.pkg.CLTools_Base".freeze # obsolete @@ -220,8 +192,7 @@ module OS "/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_:macos_version.pkg".freeze HEADER_PKG_ID = "com.apple.pkg.macOS_SDK_headers_for_macOS_10.14".freeze - # Returns true even if outdated tools are installed, e.g. - # tools from Xcode 4.x on 10.9 + # Returns true even if outdated tools are installed def installed? !version.null? end @@ -257,16 +228,10 @@ module OS <<~EOS Update them from Software Update in System Preferences. EOS - elsif MacOS.version >= "10.9" + else <<~EOS Update them from Software Update in the App Store. EOS - elsif MacOS.version == "10.8" || MacOS.version == "10.7" - <<~EOS - The standalone package can be obtained from - https://developer.apple.com/download/more/ - or it can be installed via Xcode's preferences. - EOS end end @@ -280,9 +245,7 @@ module OS when "10.12" then "900.0.39.2" when "10.11" then "800.0.42.1" when "10.10" then "700.1.81" - when "10.9" then "600.0.57" - when "10.8" then "503.0.40" - else "425.0.28" + else "600.0.57" end end @@ -296,8 +259,6 @@ module OS end def below_minimum_version? - # Lion was the first version of OS X to ship with a CLT - return false if MacOS.version < :lion return false unless installed? version < minimum_version @@ -311,9 +272,6 @@ module OS end def detect_clang_version - # Lion was the first version of OS X to ship with a CLT - return if MacOS.version < :lion - path = if MacOS.version >= :mavericks "#{PKG_PATH}/usr/bin/clang" else @@ -349,17 +307,9 @@ module OS end def detect_version - # CLT isn't a distinct entity pre-4.3, and pkgutil doesn't exist - # at all on Tiger, so just count it as installed if Xcode is installed - if MacOS::Xcode.installed? && MacOS::Xcode.version < "3.0" - return MacOS::Xcode.version - end - version = nil - [EXECUTABLE_PKG_ID, MAVERICKS_NEW_PKG_ID, STANDALONE_PKG_ID, FROM_XCODE_PKG_ID].each do |id| - if MacOS.version >= :mavericks - next unless File.exist?("#{PKG_PATH}/usr/bin/clang") - end + [EXECUTABLE_PKG_ID, MAVERICKS_NEW_PKG_ID].each do |id| + next unless File.exist?("#{PKG_PATH}/usr/bin/clang") version = MacOS.pkgutil_info(id)[/version: (.+)$/, 1] break if version end diff --git a/Library/Homebrew/os/mac/xquartz.rb b/Library/Homebrew/os/mac/xquartz.rb index 514e52c5e4..393512b439 100644 --- a/Library/Homebrew/os/mac/xquartz.rb +++ b/Library/Homebrew/os/mac/xquartz.rb @@ -7,7 +7,6 @@ module OS DEFAULT_BUNDLE_PATH = Pathname.new("Applications/Utilities/XQuartz.app").freeze FORGE_BUNDLE_ID = "org.macosforge.xquartz.X11".freeze - APPLE_BUNDLE_ID = "org.x.X11".freeze FORGE_PKG_ID = "org.macosforge.xquartz.pkg".freeze PKGINFO_VERSION_MAP = { @@ -44,17 +43,12 @@ module OS def detect_version if (path = bundle_path) && path.exist? && (version = version_from_mdls(path)) version - elsif prefix.to_s == "/usr/X11" || prefix.to_s == "/usr/X11R6" - guess_system_version else version_from_pkgutil end end def minimum_version - version = guess_system_version - return version unless version == "dunno" - # Update this a little later than latest_version to give people # time to upgrade. "2.7.11" @@ -63,12 +57,7 @@ module OS # - https://xquartz.macosforge.org/trac/wiki # - https://xquartz.macosforge.org/trac/wiki/Releases def latest_version - case MacOS.version - when "10.5" - "2.6.3" - else - "2.7.11" - end + "2.7.11" end def bundle_path @@ -77,7 +66,7 @@ module OS # Ask Spotlight where XQuartz is. If the user didn't install XQuartz # in the conventional place, this is our only option. - MacOS.app_with_bundle_id(FORGE_BUNDLE_ID, APPLE_BUNDLE_ID) + MacOS.app_with_bundle_id(FORGE_BUNDLE_ID) end def version_from_mdls(path) @@ -87,18 +76,6 @@ module OS version unless version.empty? end - # The XQuartz that Apple shipped in OS X through 10.7 does not have a - # pkg-util entry, so if Spotlight indexing is disabled we must make an - # educated guess as to what version is installed. - def guess_system_version - case MacOS.version - when "10.5" then "2.1.6" - when "10.6" then "2.3.6" - when "10.7" then "2.6.3" - else "dunno" - end - end - # Upstream XQuartz *does* have a pkg-info entry, so if we can't get it # from mdls, we can try pkgutil. This is very slow. def version_from_pkgutil @@ -106,23 +83,12 @@ module OS PKGINFO_VERSION_MAP.fetch(str, str) end - def provided_by_apple? - [FORGE_BUNDLE_ID, APPLE_BUNDLE_ID].find do |id| - MacOS.app_with_bundle_id(id) - end == APPLE_BUNDLE_ID - end - # This should really be private, but for compatibility reasons it must # remain public. New code should use `MacOS::X11.bin`, `MacOS::X11.lib` and # `MacOS::X11.include` instead, as that accounts for Xcode-only systems. def prefix @prefix ||= if Pathname.new("/opt/X11/lib/libpng.dylib").exist? Pathname.new("/opt/X11") - elsif Pathname.new("/usr/X11/lib/libpng.dylib").exist? - Pathname.new("/usr/X11") - # X11 doesn't include libpng on Tiger - elsif Pathname.new("/usr/X11R6/lib/libX11.dylib").exist? - Pathname.new("/usr/X11R6") end end @@ -132,34 +98,20 @@ module OS def outdated? return false unless installed? - return false if provided_by_apple? version < latest_version end - # If XQuartz and/or the CLT are installed, headers will be found under - # `/opt/X11/include` or `/usr/X11/include`. For Xcode-only systems, they are - # found in the SDK, so we use {.sdk_path} for both the headers and libraries. - # Confusingly, executables (e.g. config scripts) are only found under - # `/opt/X11/bin` or `/usr/X11/bin` in all cases. - def effective_prefix - if provided_by_apple? && Xcode.without_clt? - Pathname.new("#{OS::Mac.sdk_path}/usr/X11") - else - prefix - end - end - def bin prefix/"bin" end def include - effective_prefix/"include" + prefix/"include" end def lib - effective_prefix/"lib" + prefix/"lib" end def share diff --git a/Library/Homebrew/requirements/xcode_requirement.rb b/Library/Homebrew/requirements/xcode_requirement.rb index 2cafe29d50..045a88822e 100644 --- a/Library/Homebrew/requirements/xcode_requirement.rb +++ b/Library/Homebrew/requirements/xcode_requirement.rb @@ -28,13 +28,9 @@ class XcodeRequirement < Requirement Xcode#{version} cannot be installed on macOS #{MacOS.version}. You must upgrade your version of macOS. EOS - elsif MacOS.version >= :lion - message + <<~EOS - Xcode can be installed from the App Store. - EOS else message + <<~EOS - Xcode can be installed from #{Formatter.url("https://developer.apple.com/download/more/")}. + Xcode can be installed from the App Store. EOS end end diff --git a/Library/Homebrew/rubocops/lines.rb b/Library/Homebrew/rubocops/lines.rb index 3e1713f50d..55cd1f5c59 100644 --- a/Library/Homebrew/rubocops/lines.rb +++ b/Library/Homebrew/rubocops/lines.rb @@ -362,13 +362,6 @@ module RuboCop problem "`depends_on` can take requirement classes instead of instances" end - os = [:leopard?, :snow_leopard?, :lion?, :mountain_lion?] - os.each do |version| - find_instance_method_call(body_node, "MacOS", version) do |method| - problem "\"#{method.source}\" is deprecated, use a comparison to MacOS.version instead" - end - end - find_instance_method_call(body_node, "Dir", :[]) do |method| next unless parameters(method).size == 1 diff --git a/Library/Homebrew/sandbox.rb b/Library/Homebrew/sandbox.rb index b55ffc7856..3392cb018b 100644 --- a/Library/Homebrew/sandbox.rb +++ b/Library/Homebrew/sandbox.rb @@ -5,7 +5,7 @@ class Sandbox SANDBOX_EXEC = "/usr/bin/sandbox-exec".freeze def self.available? - OS.mac? && OS::Mac.version >= "10.6" && File.executable?(SANDBOX_EXEC) + OS.mac? && File.executable?(SANDBOX_EXEC) end def self.formula?(_formula) diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index 4e144a0a8b..329d2b8fc6 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -209,10 +209,14 @@ class SoftwareSpec def fails_with(compiler, &block) odisabled "fails_with :gcc_4_0" if compiler == :gcc_4_0 + odisabled "fails_with :gcc_4_2" if compiler == :gcc_4_2 + odisabled "fails_with :gcc" if compiler == :gcc && !block_given? compiler_failures << CompilerFailure.create(compiler, &block) end def needs(*standards) + odisabled "needs :cxx11" if standards.include?(:cxx11) + odisabled "needs :cxx14" if standards.include?(:cxx14) standards.each do |standard| compiler_failures.concat CompilerFailure.for_standard(standard) end diff --git a/Library/Homebrew/test/ENV_spec.rb b/Library/Homebrew/test/ENV_spec.rb index 5aff602354..050cfb2bef 100644 --- a/Library/Homebrew/test/ENV_spec.rb +++ b/Library/Homebrew/test/ENV_spec.rb @@ -126,10 +126,8 @@ shared_examples EnvActivation do describe "#compiler" do it "allows switching compilers" do - [:clang, :gcc_4_2].each do |compiler| - subject.public_send(compiler) - expect(subject.compiler).to eq(compiler) - end + subject.public_send("gcc-6") + expect(subject.compiler).to eq("gcc-6") end end @@ -162,12 +160,6 @@ shared_examples EnvActivation do expect(subject.compiler_any_clang?(:llvm_clang)).to be true end end - - describe "#compiler_with_cxx11_support?" do - it "returns true for gcc-4.9" do - expect(subject.compiler_with_cxx11_support?("gcc-4.9")).to be true - end - end end describe Stdenv do @@ -183,17 +175,6 @@ describe Superenv do end describe "#cxx11" do - it "raises an error when the compiler isn't supported" do - %w[gcc gcc-4.7].each do |compiler| - subject["HOMEBREW_CC"] = compiler - - expect { subject.cxx11 } - .to raise_error(/The selected compiler doesn't support C\+\+11:/) - - expect(subject["HOMEBREW_CCCFG"]).to be nil - end - end - it "supports gcc-5" do subject["HOMEBREW_CC"] = "gcc-5" subject.cxx11 diff --git a/Library/Homebrew/test/compiler_failure_spec.rb b/Library/Homebrew/test/compiler_failure_spec.rb index a6dc8b530c..ee71c1f64d 100644 --- a/Library/Homebrew/test/compiler_failure_spec.rb +++ b/Library/Homebrew/test/compiler_failure_spec.rb @@ -6,18 +6,17 @@ describe CompilerFailure do describe "::create" do it "creates a failure when given a symbol" do failure = described_class.create(:clang) - expect(failure).to fail_with(double("Compiler", name: :clang, version: 425)) + expect(failure).to fail_with(double("Compiler", name: :clang, version: 600)) end it "can be given a build number in a block" do - failure = described_class.create(:clang) { build 211 } - expect(failure).to fail_with(double("Compiler", name: :clang, version: 210)) - expect(failure).not_to fail_with(double("Compiler", name: :clang, version: 318)) + failure = described_class.create(:clang) { build 700 } + expect(failure).to fail_with(double("Compiler", name: :clang, version: 700)) end it "can be given an empty block" do failure = described_class.create(:clang) {} - expect(failure).to fail_with(double("Compiler", name: :clang, version: 425)) + expect(failure).to fail_with(double("Compiler", name: :clang, version: 600)) end it "creates a failure when given a hash" do diff --git a/Library/Homebrew/test/compiler_selector_spec.rb b/Library/Homebrew/test/compiler_selector_spec.rb index 25bea750e8..8d45b5b1cc 100644 --- a/Library/Homebrew/test/compiler_selector_spec.rb +++ b/Library/Homebrew/test/compiler_selector_spec.rb @@ -4,14 +4,13 @@ require "software_spec" describe CompilerSelector do subject { described_class.new(software_spec, versions, compilers) } - let(:compilers) { [:clang, :gcc_4_2, :gnu] } + let(:compilers) { [:clang, :gnu] } let(:software_spec) { SoftwareSpec.new } let(:cc) { :clang } let(:versions) do double( - gcc_4_2_build_version: Version.create("5666"), - llvm_build_version: Version::NULL, - clang_build_version: Version.create("425"), + llvm_build_version: Version::NULL, + clang_build_version: Version.create("600"), ) end @@ -37,36 +36,10 @@ describe CompilerSelector do it "still returns gcc-7 if it fails with gcc without a specific version" do software_spec.fails_with(:clang) - software_spec.fails_with(:gcc_4_2) expect(subject.compiler).to eq("gcc-7") end - it "returns gcc if it fails with clang and llvm" do - software_spec.fails_with(:clang) - expect(subject.compiler).to eq(:gcc_4_2) - end - - it "returns clang if it fails with gcc and llvm" do - software_spec.fails_with(:gcc_4_2) - expect(subject.compiler).to eq(:clang) - end - - example "returns gcc if it fails with a specific gcc version" do - software_spec.fails_with(:clang) - software_spec.fails_with(gcc: "7") - expect(subject.compiler).to eq(:gcc_4_2) - end - - example "returns a lower version of gcc if it fails with the highest version" do - software_spec.fails_with(:clang) - software_spec.fails_with(:gcc_4_2) - software_spec.fails_with(gcc: "7") - expect(subject.compiler).to eq("gcc-6") - end - it "raises an error when gcc or llvm is missing" do - allow(versions).to receive(:gcc_4_2_build_version).and_return(Version::NULL) - software_spec.fails_with(:clang) software_spec.fails_with(gcc: "7") software_spec.fails_with(gcc: "6") diff --git a/Library/Homebrew/test/cxxstdlib_spec.rb b/Library/Homebrew/test/cxxstdlib_spec.rb index 2c11a9a120..ea1631a011 100644 --- a/Library/Homebrew/test/cxxstdlib_spec.rb +++ b/Library/Homebrew/test/cxxstdlib_spec.rb @@ -3,21 +3,13 @@ require "cxxstdlib" describe CxxStdlib do let(:clang) { described_class.create(:libstdcxx, :clang) } - let(:gcc) { described_class.create(:libstdcxx, :gcc) } - let(:gcc42) { described_class.create(:libstdcxx, :gcc_4_2) } let(:gcc6) { described_class.create(:libstdcxx, "gcc-6") } let(:gcc7) { described_class.create(:libstdcxx, "gcc-7") } let(:lcxx) { described_class.create(:libcxx, :clang) } let(:purec) { described_class.create(nil, :clang) } describe "#compatible_with?" do - specify "Apple libstdcxx intercompatibility" do - expect(clang).to be_compatible_with(gcc) - expect(clang).to be_compatible_with(gcc42) - end - specify "compatibility with itself" do - expect(gcc).to be_compatible_with(gcc) expect(gcc7).to be_compatible_with(gcc7) expect(clang).to be_compatible_with(clang) end @@ -49,8 +41,6 @@ describe CxxStdlib do describe "#apple_compiler?" do it "returns true for Apple compilers" do expect(clang).to be_an_apple_compiler - expect(gcc).to be_an_apple_compiler - expect(gcc42).to be_an_apple_compiler end it "returns false for non-Apple compilers" do diff --git a/Library/Homebrew/test/hardware/cpu_spec.rb b/Library/Homebrew/test/hardware/cpu_spec.rb index 5bcb9fca5c..8b469c5c36 100644 --- a/Library/Homebrew/test/hardware/cpu_spec.rb +++ b/Library/Homebrew/test/hardware/cpu_spec.rb @@ -5,7 +5,6 @@ describe Hardware::CPU do let(:cpu_types) { [ :intel, - :ppc, :dunno, ] } @@ -37,78 +36,4 @@ describe Hardware::CPU do expect(cpu_families).to include described_class.family end end - - describe "::can_run?" do - subject { described_class } - - matcher :be_able_to_run do |arch| - match do |expected| - allow(expected).to receive(:type).and_return type - allow(expected).to receive(:bits).and_return bits - - expect(expected.can_run?(arch)).to be true - end - end - - let(:type) { described_class.type } - let(:bits) { described_class.bits } - - before do - allow(described_class).to receive(:type).and_return type - allow(described_class).to receive(:bits).and_return bits - end - - context "when on an 32-bit Intel machine" do - let(:type) { :intel } - let(:bits) { 32 } - - it { is_expected.to be_able_to_run :i386 } - it { is_expected.not_to be_able_to_run :x86_64 } - it { is_expected.not_to be_able_to_run :ppc32 } - it { is_expected.not_to be_able_to_run :ppc64 } - end - - context "when on an 64-bit Intel machine" do - let(:type) { :intel } - let(:bits) { 64 } - - it { is_expected.to be_able_to_run :i386 } - it { is_expected.to be_able_to_run :x86_64 } - it { is_expected.not_to be_able_to_run :ppc32 } - it { is_expected.not_to be_able_to_run :ppc64 } - end - - context "when on a 32-bit PowerPC machine" do - let(:type) { :ppc } - let(:bits) { 32 } - - it { is_expected.not_to be_able_to_run :i386 } - it { is_expected.not_to be_able_to_run :x86_64 } - it { is_expected.to be_able_to_run :ppc32 } - it { is_expected.not_to be_able_to_run :ppc64 } - end - - context "when on a 64-bit PowerPC machine" do - let(:type) { :ppc } - let(:bits) { 64 } - - it { is_expected.not_to be_able_to_run :i386 } - it { is_expected.not_to be_able_to_run :x86_64 } - it { is_expected.to be_able_to_run :ppc32 } - it { is_expected.to be_able_to_run :ppc64 } - end - - context "when the CPU type is unknown" do - let(:type) { :dunno } - - it { is_expected.not_to be_able_to_run :i386 } - it { is_expected.not_to be_able_to_run :x86_64 } - it { is_expected.not_to be_able_to_run :ppc32 } - it { is_expected.not_to be_able_to_run :ppc64 } - end - - context "when the architecture is unknown" do - it { is_expected.not_to be_able_to_run :blah } - end - end end diff --git a/Library/Homebrew/test/os/mac/dependency_collector_spec.rb b/Library/Homebrew/test/os/mac/dependency_collector_spec.rb index d492cd24d8..90a23f3753 100644 --- a/Library/Homebrew/test/os/mac/dependency_collector_spec.rb +++ b/Library/Homebrew/test/os/mac/dependency_collector_spec.rb @@ -7,20 +7,7 @@ describe DependencyCollector do described_class.clear_cache end - specify "#tar_needs_xz_dependency?" do - allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.9")) - expect(described_class).not_to need_tar_xz_dependency - end - - specify "Resource xz pre-Mavericks dependency" do - allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.8")) - resource = Resource.new - resource.url("https://brew.sh/foo.tar.xz") - expect(subject.add(resource)).to eq(Dependency.new("xz", [:build])) - end - - specify "Resource xz Mavericks or newer dependency" do - allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.9")) + specify "Resource dependency from a '.xz' URL" do resource = Resource.new resource.url("https://brew.sh/foo.tar.xz") expect(subject.add(resource)).to be nil diff --git a/Library/Homebrew/test/os/mac/hardware_spec.rb b/Library/Homebrew/test/os/mac/hardware_spec.rb deleted file mode 100644 index 4d5bbd3390..0000000000 --- a/Library/Homebrew/test/os/mac/hardware_spec.rb +++ /dev/null @@ -1,56 +0,0 @@ -require "hardware" -require "extend/os/mac/hardware/cpu" - -describe Hardware::CPU do - describe "::can_run?" do - it "reports that Intel Macs can run Intel executables" do - allow(described_class).to receive(:type).and_return :intel - allow(described_class).to receive(:bits).and_return 64 - expect(described_class.can_run?(:i386)).to be true - expect(described_class.can_run?(:x86_64)).to be true - end - - it "reports that PowerPC Macs can run PowerPC executables" do - allow(described_class).to receive(:type).and_return :ppc - allow(described_class).to receive(:bits).and_return 64 - expect(described_class.can_run?(:ppc)).to be true - expect(described_class.can_run?(:ppc64)).to be true - end - - it "reports that 32-bit Intel Macs can't run x86_64 executables" do - allow(described_class).to receive(:type).and_return :intel - allow(described_class).to receive(:bits).and_return 32 - expect(described_class.can_run?(:x86_64)).to be false - end - - it "reports that 32-bit PowerPC Macs can't run ppc64 executables" do - allow(described_class).to receive(:type).and_return :ppc - allow(described_class).to receive(:bits).and_return 32 - expect(described_class.can_run?(:ppc64)).to be false - end - - it "reports that Intel Macs can only run 32-bit PowerPC executables on 10.6 and older" do - allow(described_class).to receive(:type).and_return :intel - allow(OS::Mac).to receive(:version).and_return OS::Mac::Version.new "10.6" - expect(described_class.can_run?(:ppc)).to be true - - allow(OS::Mac).to receive(:version).and_return OS::Mac::Version.new "10.7" - expect(described_class.can_run?(:ppc)).to be false - end - - it "reports that PowerPC Macs can't run Intel executables" do - allow(described_class).to receive(:type).and_return :ppc - expect(described_class.can_run?(:i386)).to be false - expect(described_class.can_run?(:x86_64)).to be false - end - - it "returns false for unknown CPU types" do - allow(described_class).to receive(:type).and_return :dunno - expect(described_class.can_run?(:i386)).to be false - end - - it "returns false for unknown arches" do - expect(described_class.can_run?(:blah)).to be false - end - end -end diff --git a/Library/Homebrew/test/os/mac/mach_spec.rb b/Library/Homebrew/test/os/mac/mach_spec.rb index f64ea1631e..f07f45b780 100644 --- a/Library/Homebrew/test/os/mac/mach_spec.rb +++ b/Library/Homebrew/test/os/mac/mach_spec.rb @@ -110,42 +110,18 @@ describe ArchitectureListExtension do specify "universal checks" do expect(archs).to be_universal - expect(archs).to be_intel_universal - expect(archs).to be_ppc_universal - expect(archs).to be_cross_universal - expect(archs).to be_fat non_universal = [:i386].extend(described_class) expect(non_universal).not_to be_universal intel_only = [:i386, :x86_64].extend(described_class) expect(intel_only).to be_universal - expect(intel_only).not_to be_ppc_universal - expect(intel_only).not_to be_cross_universal - - ppc_only = [:ppc970, :ppc64].extend(described_class) - expect(ppc_only).to be_universal - expect(ppc_only).not_to be_intel_universal - expect(ppc_only).not_to be_cross_universal - - cross = [:ppc7400, :i386].extend(described_class) - expect(cross).to be_universal - expect(cross).not_to be_intel_universal - expect(cross).not_to be_ppc_universal - end - - specify "messaging flags" do - archs.remove_ppc! - expect(archs.length).to eq(2) - expect(archs.as_arch_flags).to match(/-arch i386/) - expect(archs.as_arch_flags).to match(/-arch x86_64/) end specify "architecture flags" do pn = dylib_path("fat") - expect(pn.archs).to be_intel_universal + expect(pn.archs).to be_universal expect(pn.archs.as_arch_flags).to eq("-arch x86_64 -arch i386") - expect(pn.archs.as_cmake_arch_flags).to eq("x86_64;i386") end end diff --git a/Library/Homebrew/test/os/mac/version_spec.rb b/Library/Homebrew/test/os/mac/version_spec.rb index 797207b678..cb45a14001 100644 --- a/Library/Homebrew/test/os/mac/version_spec.rb +++ b/Library/Homebrew/test/os/mac/version_spec.rb @@ -2,13 +2,13 @@ require "version" require "os/mac/version" describe OS::Mac::Version do - subject { described_class.new("10.7") } + subject { described_class.new("10.10") } specify "comparison with Symbol" do - expect(subject).to be > :snow_leopard - expect(subject).to be == :lion - expect(subject).to be === :lion # rubocop:disable Style/CaseEquality - expect(subject).to be < :mountain_lion + expect(subject).to be > :mavericks + expect(subject).to be == :yosemite + expect(subject).to be === :yosemite # rubocop:disable Style/CaseEquality + expect(subject).to be < :el_capitan end specify "comparison with Fixnum" do @@ -17,35 +17,33 @@ describe OS::Mac::Version do end specify "comparison with Float" do - expect(subject).to be > 10.6 - expect(subject).to be == 10.7 - expect(subject).to be === 10.7 # rubocop:disable Style/CaseEquality - expect(subject).to be < 10.8 + expect(subject).to be > 10.9 + expect(subject).to be < 10.11 end specify "comparison with String" do - expect(subject).to be > "10.6" - expect(subject).to be == "10.7" - expect(subject).to be === "10.7" # rubocop:disable Style/CaseEquality - expect(subject).to be < "10.8" + expect(subject).to be > "10.9" + expect(subject).to be == "10.10" + expect(subject).to be === "10.10" # rubocop:disable Style/CaseEquality + expect(subject).to be < "10.11" end specify "comparison with Version" do - expect(subject).to be > Version.create("10.6") - expect(subject).to be == Version.create("10.7") - expect(subject).to be === Version.create("10.7") # rubocop:disable Style/CaseEquality - expect(subject).to be < Version.create("10.8") + expect(subject).to be > Version.create("10.9") + expect(subject).to be == Version.create("10.10") + expect(subject).to be === Version.create("10.10") # rubocop:disable Style/CaseEquality + expect(subject).to be < Version.create("10.11") end specify "#from_symbol" do - expect(described_class.from_symbol(:lion)).to eq(subject) + expect(described_class.from_symbol(:yosemite)).to eq(subject) expect { described_class.from_symbol(:foo) } .to raise_error(ArgumentError) end specify "#pretty_name" do expect(described_class.new("10.11").pretty_name).to eq("El Capitan") - expect(described_class.new("10.8").pretty_name).to eq("Mountain Lion") + expect(described_class.new("10.14").pretty_name).to eq("Mojave") expect(described_class.new("10.10").pretty_name).to eq("Yosemite") end end diff --git a/Library/Homebrew/test/rubocops/lines_spec.rb b/Library/Homebrew/test/rubocops/lines_spec.rb index 5e7aa067f4..7598d8f696 100644 --- a/Library/Homebrew/test/rubocops/lines_spec.rb +++ b/Library/Homebrew/test/rubocops/lines_spec.rb @@ -483,17 +483,6 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do RUBY end - it "old style OS check" do - expect_offense(<<~RUBY) - class Foo < Formula - desc "foo" - url 'https://brew.sh/foo-1.0.tgz' - depends_on :foo if MacOS.snow_leopard? - ^^^^^^^^^^^^^^^^^^^ \"MacOS.snow_leopard?\" is deprecated, use a comparison to MacOS.version instead - end - RUBY - end - it "non glob DIR usage" do expect_offense(<<~RUBY) class Foo < Formula diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-array.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-array.rb index 8e54f72817..761d71c8e7 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-array.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-array.rb @@ -6,7 +6,7 @@ cask 'with-depends-on-macos-array' do homepage 'https://brew.sh/with-depends-on-macos-array' # since all OS releases are included, this should always pass - depends_on macos: ['10.5', '10.6', '10.7', '10.8', '10.9', '10.10', MacOS.version.to_s] + depends_on macos: ['10.9', '10.10', MacOS.version.to_s] app 'Caffeine.app' end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-comparison.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-comparison.rb index 72301e09cd..aa2cb6649a 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-comparison.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-comparison.rb @@ -5,7 +5,7 @@ cask 'with-depends-on-macos-comparison' do url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" homepage 'https://brew.sh/with-depends-on-macos-comparison' - depends_on macos: '>= 10.5' + depends_on macos: '>= 10.9' app 'Caffeine.app' end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-failure.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-failure.rb index 67db1b29f8..66c001fce6 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-failure.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-failure.rb @@ -6,7 +6,7 @@ cask 'with-depends-on-macos-failure' do homepage 'https://brew.sh/with-depends-on-macos-failure' # guarantee a mismatched release - depends_on macos: MacOS.version.to_s == '10.5' ? '10.6' : '10.5' + depends_on macos: MacOS.version.to_s == '10.9' ? '10.10' : '10.9' app 'Caffeine.app' end diff --git a/Library/Homebrew/test/utils/bottles/bottles_spec.rb b/Library/Homebrew/test/utils/bottles/bottles_spec.rb index 906743e825..fcaaa1db52 100644 --- a/Library/Homebrew/test/utils/bottles/bottles_spec.rb +++ b/Library/Homebrew/test/utils/bottles/bottles_spec.rb @@ -2,26 +2,9 @@ require "utils/bottles" describe Utils::Bottles do describe "#tag", :needs_macos do - it "returns :leopard_64 on Leopard Intel 64-bit" do - allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.5")) - allow(Hardware::CPU).to receive(:type).and_return(:intel) - expect(described_class.tag).to eq(:leopard_64) - end - - it "returns :snow_leopard on Snow Leopard 64-bit" do - allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.6")) - allow(Hardware::CPU).to receive(:is_64_bit?).and_return(true) - expect(described_class.tag).to eq(:snow_leopard) - end - - it "returns :lion on Lion" do - allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.7")) - expect(described_class.tag).to eq(:lion) - end - - it "returns :mountain_lion on Mountain Lion" do - allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.8")) - expect(described_class.tag).to eq(:mountain_lion) + it "returns :mavericks on Mavericks" do + allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.9")) + expect(described_class.tag).to eq(:mavericks) end end end diff --git a/Library/Homebrew/test/utils/bottles/collector_spec.rb b/Library/Homebrew/test/utils/bottles/collector_spec.rb index 3eefdec40c..98c3532bf9 100644 --- a/Library/Homebrew/test/utils/bottles/collector_spec.rb +++ b/Library/Homebrew/test/utils/bottles/collector_spec.rb @@ -3,9 +3,9 @@ require "utils/bottles" describe Utils::Bottles::Collector do describe "#fetch_checksum_for" do it "returns passed tags" do - subject[:lion] = "foo" - subject[:mountain_lion] = "bar" - expect(subject.fetch_checksum_for(:mountain_lion)).to eq(["bar", :mountain_lion]) + subject[:yosemite] = "foo" + subject[:el_captain] = "bar" + expect(subject.fetch_checksum_for(:el_captain)).to eq(["bar", :el_captain]) end it "returns nil if empty" do @@ -13,14 +13,14 @@ describe Utils::Bottles::Collector do end it "returns nil when there is no match" do - subject[:lion] = "foo" + subject[:yosemite] = "foo" expect(subject.fetch_checksum_for(:foo)).to be nil end it "uses older tags when needed", :needs_macos do - subject[:lion] = "foo" - expect(subject.fetch_checksum_for(:mountain_lion)).to eq(["foo", :lion]) - expect(subject.fetch_checksum_for(:snow_leopard)).to be nil + subject[:yosemite] = "foo" + expect(subject.fetch_checksum_for(:yosemite)).to eq(["foo", :yosemite]) + expect(subject.fetch_checksum_for(:mavericks)).to be nil end end end diff --git a/docs/Common-Issues.md b/docs/Common-Issues.md index 81281ee53f..7dfc6c2d03 100644 --- a/docs/Common-Issues.md +++ b/docs/Common-Issues.md @@ -4,7 +4,6 @@ This is a list of commonly encountered problems, known issues, and their solutio ### `brew` complains about absence of "Command Line Tools" You need to have the Xcode Command Line Utilities installed (and updated): run `xcode-select --install` in the terminal. -(In OS X prior to 10.9, the "Command Line Tools" package can alternatively be installed from within Xcode. `⌘,` will get you to preferences. Visit the "Downloads" tab and hit the install button next to "Command Line Tools".) ### Ruby: `bad interpreter: /usr/bin/ruby^M: no such file or directory` You cloned with `git`, and your Git configuration is set to use Windows line endings. See this page: @@ -29,28 +28,6 @@ cd $(brew --repository)/Library git clean -fd ``` -### Ruby: `invalid multibyte escape: /^\037\213/` - -You see an error similar to: - -``` -Error: /usr/local/Library/Homebrew/download_strategy.rb:84: invalid multibyte escape: /^\037\213/ -invalid multibyte escape: /^\037\235/ -``` - -In the past, Homebrew assumed that `/usr/bin/ruby` was Ruby 1.8. On OS X 10.9, it is now Ruby 2.0. There are various incompatibilities between the two versions, so if you upgrade to OS X 10.9 while using a sufficiently old version of Homebrew, you will encounter errors. - -The incompatibilities have been addressed in more recent versions of Homebrew, and instead of making assumptions about `/usr/bin/ruby`, it uses the executable inside macOS's Ruby framework or a vendored Ruby. - -To recover from this situation, do the following: - -```sh -cd $(brew --prefix) -git fetch origin -git reset --hard FETCH_HEAD -brew update -``` - ### `launchctl` refuses to load launchd plist files When trying to load a plist file into launchctl, you receive an error that resembles diff --git a/docs/Gems,-Eggs-and-Perl-Modules.md b/docs/Gems,-Eggs-and-Perl-Modules.md index 939caae3fe..8fafd9655a 100644 --- a/docs/Gems,-Eggs-and-Perl-Modules.md +++ b/docs/Gems,-Eggs-and-Perl-Modules.md @@ -7,8 +7,8 @@ add-ons available to all users: * `/Library/Python` * `/Library/Perl` -Starting with OS X Lion (10.7), you need `sudo` to install to these like -so: `sudo gem install`, `sudo easy_install` or `sudo cpan -i`. +You need `sudo` to install to these like so: `sudo gem install`, +`sudo easy_install` or `sudo cpan -i`. An option to avoid sudo is to use an access control list. For example: diff --git a/docs/Installation.md b/docs/Installation.md index ea63cb6ef1..85a5ec5e9d 100644 --- a/docs/Installation.md +++ b/docs/Installation.md @@ -10,6 +10,7 @@ installed to `/usr/local` already. It tells you exactly what it will do before it does it too. You have to confirm everything it will do before it starts. ## macOS Requirements + * An 64-bit Intel CPU [1](#1) * macOS 10.12 (or higher) [2](#2) * Command Line Tools (CLT) for Xcode: `xcode-select --install`, @@ -24,6 +25,7 @@ it does it too. You have to confirm everything it will do before it starts. Check out [the Linuxbrew installation documentation](Linuxbrew.md). ### Untar anywhere + Just extract (or `git clone`) Homebrew wherever you want. Just avoid: * Directories with names that contain spaces. Homebrew itself can handle spaces, but many build scripts cannot. @@ -40,9 +42,11 @@ mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar ``` ### Multiple installations + Create a Homebrew installation wherever you extract the tarball. Whichever `brew` command is called is where the packages will be installed. You can use this as you see fit, e.g. a system set of libs in `/usr/local` and tweaked formulae for development in `~/homebrew`. ## Uninstallation + Uninstallation is documented in the [FAQ](FAQ.md). 1 For 32-bit or PPC support see diff --git a/docs/Python-for-Formula-Authors.md b/docs/Python-for-Formula-Authors.md index 2766a96447..ccef1184f4 100644 --- a/docs/Python-for-Formula-Authors.md +++ b/docs/Python-for-Formula-Authors.md @@ -18,13 +18,7 @@ Applications should unconditionally bundle all of their Python-language dependen Formulae for apps that require Python 3 **should** declare an unconditional dependency on `"python"`. These apps **must** work with the current Homebrew Python 3.x formula. -Applications that are compatible with Python 2 **should** use the Apple-provided system Python in `/usr/bin` on systems that provide Python 2.7. To do this, declare: - -```ruby -depends_on "python@2" if MacOS.version <= :snow_leopard -``` - -No explicit Python dependency is needed on recent OS versions since `/usr/bin` is always in `PATH` for Homebrew formulae; on Leopard and older, the `python` in `PATH` is used if it's at least version 2.7, or else Homebrew's Python 2.7.x is installed. +Applications that are compatible with Python 2 **should** use the Apple-provided system Python in `/usr/bin` on systems that provide Python 2.7. No explicit Python dependency is needed since `/usr/bin` is always in `PATH` for Homebrew formulae. ### Installing From b40579f69afad74a4bd4b69743c60179e8ac35ae Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Sat, 26 Jan 2019 16:44:03 +0530 Subject: [PATCH 070/199] install: Use CLI::Parser to parse args --- Library/Homebrew/cmd/install.rb | 134 +++++++++++++++++++++++++------- 1 file changed, 106 insertions(+), 28 deletions(-) diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 2bb5779376..847dfba57c 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -79,20 +79,98 @@ require "development_tools" require "install" require "search" require "cleanup" +require "cli_parser" module Homebrew module_function extend Search - def install - raise FormulaUnspecifiedError if ARGV.named.empty? + def install_args + Homebrew::CLI::Parser.new do + formulae_options = {} + usage_banner <<~EOS + `install` [] formula - if ARGV.include? "--head" - raise "Specify `--HEAD` in uppercase to build from trunk." + Install . + + is usually the name of the formula to install, but it can be specified + in several different ways. See [SPECIFYING FORMULAE](#specifying-formulae). + EOS + + switch :debug, + description: "If brewing fails, open an interactive debugging session with access to IRB "\ + "or a shell inside the temporary build directory" + flag "--env=", + description: "If `std` is passed, use the standard build environment instead of superenv."\ + "If `super` is passed, use superenv even if the formula specifies the "\ + "standard build environment." + switch "--ignore-dependencies", + description: "Skip installing any dependencies of any kind. If they are not already "\ + "present, the formula will probably fail to install." + switch "--only-dependencies", + description: "Install the dependencies with specified options but do not install the "\ + "specified formula." + flag "--cc=", + description: "Attempt to compile using provided . should be the "\ + "name of the compiler's executable, for instance `gcc-7` for GCC 7. "\ + "In order to use LLVM's clang, use `llvm_clang`. To specify the "\ + "Apple-provided clang, use `clang`. This parameter will only accept "\ + "compilers that are provided by Homebrew or bundled with macOS. "\ + "Please do not file issues if you encounter errors while using this flag." + switch "-s", "--build-from-source", + description: "Compile the specified from source even if a bottle is provided. "\ + "Dependencies will still be installed from bottles if they are available." + switch "--force-bottle", + description: "Install from a bottle if it exists for the current or newest version of "\ + "macOS, even if it would not normally be used for installation." + switch "--include-test", + description: "Install testing dependencies required to run `brew test`." + switch "--devel", + description: "If defines it, install the development version." + switch "--HEAD", + description: "If defines it, install the HEAD version, aka master, trunk, unstable." + switch "--fetch-HEAD" + switch "--keep-tmp", + description: "Dont delele the temporary files created during installation." + switch "--build-bottle", + description: "Prepare the formula for eventual bottling during installation." + switch :force, + description: "Install without checking for previously installed keg-only or "\ + "non-migrated versions." + switch :verbose, + description: "Print the verification and postinstall steps." + switch "--display-times", + description: "Print install times for each formula at the end of the run." + switch "-i", "--interactive", + description: "Download and patch , then open a shell. This allows the user to "\ + "run `./configure --help` and otherwise determine how to turn the software "\ + "package into a Homebrew package." + switch "-g", "--git", + description: "Create a Git repository, useful for creating patches to the software." + ARGV.formulae.each do |f| + next if f.options.empty? + f.options.each do |option| + formulae_options[option.flag] = option.description + end + end + formulae_options.each do |option, description| + if option.end_with? "=" + flag option, + description: description + else + switch option, + description: description + end + end end + end - unless ARGV.force? + def install + install_args.parse + raise FormulaUnspecifiedError if args.remaining.empty? + + unless args.force? ARGV.named.each do |name| next if File.exist?(name) if name !~ HOMEBREW_TAP_FORMULA_REGEX && name !~ HOMEBREW_CASK_TAP_CASK_REGEX @@ -108,14 +186,14 @@ module Homebrew formulae = [] unless ARGV.casks.empty? - args = [] - args << "--force" if ARGV.force? - args << "--debug" if ARGV.debug? - args << "--verbose" if ARGV.verbose? + cask_args = [] + cask_args << "--force" if args.force? + cask_args << "--debug" if args.debug? + cask_args << "--verbose" if args.verbose? ARGV.casks.each do |c| - ohai "brew cask install #{c} #{args.join " "}" - system("#{HOMEBREW_PREFIX}/bin/brew", "cask", "install", c, *args) + ohai "brew cask install #{c} #{cask_args.join " "}" + system("#{HOMEBREW_PREFIX}/bin/brew", "cask", "install", c, *cask_args) end end @@ -125,7 +203,7 @@ module Homebrew ARGV.formulae.each do |f| # head-only without --HEAD is an error - if !ARGV.build_head? && f.stable.nil? && f.devel.nil? + if !Homebrew.args.HEAD? && f.stable.nil? && f.devel.nil? raise <<~EOS #{f.full_name} is a head-only formula Install with `brew install --HEAD #{f.full_name}` @@ -133,33 +211,33 @@ module Homebrew end # devel-only without --devel is an error - if !ARGV.build_devel? && f.stable.nil? && f.head.nil? + if !args.devel? && f.stable.nil? && f.head.nil? raise <<~EOS #{f.full_name} is a devel-only formula Install with `brew install --devel #{f.full_name}` EOS end - if ARGV.build_stable? && f.stable.nil? + if !(args.HEAD? || args.devel?) && f.stable.nil? raise "#{f.full_name} has no stable download, please choose --devel or --HEAD" end # --HEAD, fail with no head defined - if ARGV.build_head? && f.head.nil? + if args.head? && f.head.nil? raise "No head is defined for #{f.full_name}" end # --devel, fail with no devel defined - if ARGV.build_devel? && f.devel.nil? + if args.devel? && f.devel.nil? raise "No devel block is defined for #{f.full_name}" end installed_head_version = f.latest_head_version new_head_installed = installed_head_version && - !f.head_version_outdated?(installed_head_version, fetch_head: ARGV.fetch_head?) + !f.head_version_outdated?(installed_head_version, fetch_head: args.fetch_HEAD?) prefix_installed = f.prefix.exist? && !f.prefix.children.empty? - if f.keg_only? && f.any_version_installed? && f.optlinked? && !ARGV.force? + if f.keg_only? && f.any_version_installed? && f.optlinked? && !args.force? # keg-only install is only possible when no other version is # linked to opt, because installing without any warnings can break # dependencies. Therefore before performing other checks we need to be @@ -170,7 +248,7 @@ module Homebrew #{f.full_name} #{optlinked_version} is already installed To upgrade to #{f.version}, run `brew upgrade #{f.name}` EOS - elsif ARGV.only_deps? + elsif args.only_dependencies? formulae << f else opoo <<~EOS @@ -178,12 +256,12 @@ module Homebrew To reinstall #{f.pkg_version}, run `brew reinstall #{f.name}` EOS end - elsif (ARGV.build_head? && new_head_installed) || prefix_installed + elsif (args.HEAD? && new_head_installed) || prefix_installed # After we're sure that --force flag is passed for linked to opt # keg-only we need to be sure that the version we're attempting to # install is not already installed. - installed_version = if ARGV.build_head? + installed_version = if args.HEAD? f.latest_head_version else f.pkg_version @@ -202,7 +280,7 @@ module Homebrew #{msg}, it's just not linked You can use `brew link #{f}` to link this version. EOS - elsif ARGV.only_deps? + elsif args.only_dependencies? msg = nil formulae << f else @@ -221,7 +299,7 @@ module Homebrew EOS end opoo msg - elsif f.migration_needed? && !ARGV.force? + elsif f.migration_needed? && !args.force? # Check if the formula we try to install is the same as installed # but not migrated one. If --force passed then install anyway. opoo <<~EOS @@ -317,11 +395,11 @@ module Homebrew fi = FormulaInstaller.new(f) fi.options = build_options.used_options fi.invalid_option_names = build_options.invalid_option_names - fi.ignore_deps = ARGV.ignore_deps? - fi.only_deps = ARGV.only_deps? - fi.build_bottle = ARGV.build_bottle? - fi.interactive = ARGV.interactive? - fi.git = ARGV.git? + fi.ignore_deps = args.ignore_dependencies? + fi.only_deps = args.only_dependencies? + fi.build_bottle = args.build_bottle? + fi.interactive = args.interactive? + fi.git = args.git? fi.prelude fi.install fi.finish From 5084831a2b33a4a04604e9d16f49187f9ddfd2a8 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sun, 27 Jan 2019 12:49:41 +0000 Subject: [PATCH 071/199] vendor-install: use Mavericks portable Ruby. This is not universal so is smaller (8MB vs 12MB). It also performs 5-10% faster at: https://rubybench.org/ruby/ruby/releases?result_type=array_sample_100k___50k --- Library/Homebrew/cmd/vendor-install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/cmd/vendor-install.sh b/Library/Homebrew/cmd/vendor-install.sh index 5bc2e7bf0d..83c460ea45 100644 --- a/Library/Homebrew/cmd/vendor-install.sh +++ b/Library/Homebrew/cmd/vendor-install.sh @@ -16,9 +16,9 @@ if [[ -n "$HOMEBREW_MACOS" ]] then if [[ "$HOMEBREW_PROCESSOR" = "Intel" ]] then - ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby-2.3.7.leopard_64.bottle.tar.gz" - ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.7/portable-ruby-2.3.7.leopard_64.bottle.tar.gz" - ruby_SHA="033ac518bb14abdb1bb47d968dc9e967c3ae2035499383a21a79b49d523065d1" + ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby-2.3.7.mavericks.bottle.tar.gz" + ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.7/portable-ruby-2.3.7.mavericks.bottle.tar.gz" + ruby_SHA="539ae571968fc74d4ec3a839cb33edc5786c219a5e6ae7fb6a09ec5fc1b04e4e" fi elif [[ -n "$HOMEBREW_LINUX" ]] then From efd69b16ed3c29cc1f65b010e43515495257ff00 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sun, 27 Jan 2019 16:25:40 +0000 Subject: [PATCH 072/199] audit: no longer need openssl/curl HTTP mirrors. Mavericks' `curl` can download these fine over HTTPS. --- Library/Homebrew/dev-cmd/audit.rb | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index a5afaf6789..e0965add21 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -1122,20 +1122,9 @@ module Homebrew end def audit_urls - urls = [url] + mirrors - - curl_openssl_or_deps = ResourceAuditor.curl_openssl_and_deps.include?(owner.name) - - if spec_name == :stable && curl_openssl_or_deps - problem "should not use xz tarballs" if url.end_with?(".xz") - - unless urls.find { |u| u.start_with?("http://") } - problem "should always include at least one HTTP mirror" - end - end - return unless @online + urls = [url] + mirrors urls.each do |url| next if !@strict && mirrors.include?(url) From d22c2eca9e4e19785b549d1eeedc933cd91c461a Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 27 Jan 2019 21:34:24 +0100 Subject: [PATCH 073/199] Refactor `ConflictsWith` to be a `DelegateClass(Hash)`. --- Library/Homebrew/cask/cask.rb | 2 +- Library/Homebrew/cask/dsl/conflicts_with.rb | 29 +++++++++------------ Library/Homebrew/cask/installer.rb | 2 +- Library/Homebrew/test/cask/dsl_spec.rb | 2 +- 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/Library/Homebrew/cask/cask.rb b/Library/Homebrew/cask/cask.rb index f279630487..38c0ceb09a 100644 --- a/Library/Homebrew/cask/cask.rb +++ b/Library/Homebrew/cask/cask.rb @@ -133,7 +133,7 @@ module Cask end, "caveats" => caveats, "depends_on" => depends_on, - "conflicts_with" => conflicts_with.to_h, + "conflicts_with" => conflicts_with, "container" => container, "auto_updates" => auto_updates, } diff --git a/Library/Homebrew/cask/dsl/conflicts_with.rb b/Library/Homebrew/cask/dsl/conflicts_with.rb index e9db95fd27..2505743a60 100644 --- a/Library/Homebrew/cask/dsl/conflicts_with.rb +++ b/Library/Homebrew/cask/dsl/conflicts_with.rb @@ -1,33 +1,28 @@ +require "extend/hash_validator" +using HashValidator + module Cask class DSL - class ConflictsWith - VALID_KEYS = Set.new [ + class ConflictsWith < DelegateClass(Hash) + VALID_KEYS = [ :formula, :cask, :macos, :arch, :x11, :java, - ] + ].freeze - attr_reader *VALID_KEYS + def initialize(**pairs) + pairs.assert_valid_keys!(*VALID_KEYS) - def initialize(pairs = {}) - @pairs = pairs + super(Hash[pairs.map { |k, v| [k, Set.new([*v])] }]) - VALID_KEYS.each do |key| - instance_variable_set("@#{key}", Set.new) - end - - pairs.each do |key, value| - raise "invalid conflicts_with key: '#{key.inspect}'" unless VALID_KEYS.include?(key) - - instance_variable_set("@#{key}", instance_variable_get("@#{key}").merge([*value])) - end + self.default = Set.new end - def to_h - Hash[VALID_KEYS.map { |key| [key, instance_variable_get("@#{key}").to_a] }] + def to_json(generator) + Hash[map { |k, v| [k, v.to_a] }].to_json(generator) end end end diff --git a/Library/Homebrew/cask/installer.rb b/Library/Homebrew/cask/installer.rb index 0e43cca4fb..407f5a9b39 100644 --- a/Library/Homebrew/cask/installer.rb +++ b/Library/Homebrew/cask/installer.rb @@ -104,7 +104,7 @@ module Cask def check_conflicts return unless @cask.conflicts_with - @cask.conflicts_with.cask.each do |conflicting_cask| + @cask.conflicts_with[:cask].each do |conflicting_cask| begin conflicting_cask = CaskLoader.load(conflicting_cask) if conflicting_cask.installed? diff --git a/Library/Homebrew/test/cask/dsl_spec.rb b/Library/Homebrew/test/cask/dsl_spec.rb index 60a33f951c..0532907f08 100644 --- a/Library/Homebrew/test/cask/dsl_spec.rb +++ b/Library/Homebrew/test/cask/dsl_spec.rb @@ -401,7 +401,7 @@ describe Cask::DSL, :cask do let(:token) { "with-conflicts-with" } it "allows conflicts_with stanza to be specified" do - expect(cask.conflicts_with.formula).not_to be nil + expect(cask.conflicts_with[:formula]).to be_empty end end From 4320b1478c000f2f7eb41ece959742dab3dd9136 Mon Sep 17 00:00:00 2001 From: Steven Peters Date: Sun, 27 Jan 2019 16:11:02 -0800 Subject: [PATCH 074/199] How-to-Create-and-Maintain-a-Tap.md add missing ) --- docs/How-to-Create-and-Maintain-a-Tap.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/How-to-Create-and-Maintain-a-Tap.md b/docs/How-to-Create-and-Maintain-a-Tap.md index 835517aa51..82d06ad821 100644 --- a/docs/How-to-Create-and-Maintain-a-Tap.md +++ b/docs/How-to-Create-and-Maintain-a-Tap.md @@ -23,7 +23,7 @@ a tap with a `Formula` subdirectory. ## Naming your formulae to avoid clashes -If your formulae have the same name as Homebrew/homebrew-core formulae they cannot be installed side-by-side. If you wish to create a different version of a formula that's in Homebrew/homebrew-core (e.g. with `option`s) consider giving it a different name e.g. `nginx-full` for more fully-featured `nginx` formula. This will allow both `nginx` and `nginx-full` to be installed at the same time (but not linked if there are conflicts and one of them is not declared to be `keg_only`. +If your formulae have the same name as Homebrew/homebrew-core formulae they cannot be installed side-by-side. If you wish to create a different version of a formula that's in Homebrew/homebrew-core (e.g. with `option`s) consider giving it a different name e.g. `nginx-full` for more fully-featured `nginx` formula. This will allow both `nginx` and `nginx-full` to be installed at the same time (but not linked if there are conflicts and one of them is not declared to be `keg_only`). ### Installing From a2b4ea08b371d66daea832a4784bf74515d717ed Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Mon, 28 Jan 2019 05:25:08 +0000 Subject: [PATCH 075/199] Bump rubocop-rspec from 1.31.0 to 1.32.0 in /Library/Homebrew/vendor Bumps [rubocop-rspec](https://github.com/rubocop-hq/rubocop-rspec) from 1.31.0 to 1.32.0. - [Release notes](https://github.com/rubocop-hq/rubocop-rspec/releases) - [Changelog](https://github.com/rubocop-hq/rubocop-rspec/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop-hq/rubocop-rspec/compare/v1.31.0...v1.32.0) Signed-off-by: dependabot[bot] --- Library/Homebrew/vendor/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/vendor/Gemfile.lock b/Library/Homebrew/vendor/Gemfile.lock index 78fb3a2126..4b76916791 100644 --- a/Library/Homebrew/vendor/Gemfile.lock +++ b/Library/Homebrew/vendor/Gemfile.lock @@ -27,7 +27,7 @@ GEM rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) unicode-display_width (~> 1.4.0) - rubocop-rspec (1.31.0) + rubocop-rspec (1.32.0) rubocop (>= 0.60.0) ruby-macho (2.1.0) ruby-progressbar (1.10.0) From c2bbd9df7e6d0860dc144cc12d44ed5d75efcb21 Mon Sep 17 00:00:00 2001 From: Claudia Date: Mon, 28 Jan 2019 08:10:37 +0100 Subject: [PATCH 076/199] Remove unneeded `curl_openssl_or_deps` invocation This fixes a regression introduced in #5626 [1], which removed `curl_openssl_or_deps` and left a single call in the code. [1]: https://github.com/Homebrew/brew/pull/5626 --- Library/Homebrew/dev-cmd/audit.rb | 2 +- Library/Homebrew/utils/curl.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index e0965add21..61f14f28bb 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -1134,7 +1134,7 @@ module Homebrew # pull request. next if url =~ %r{^https://dl.bintray.com/homebrew/mirror/} - if http_content_problem = curl_check_http_content(url, require_http: curl_openssl_or_deps) + if http_content_problem = curl_check_http_content(url) problem http_content_problem end elsif strategy <= GitDownloadStrategy diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index 8c68a4ac38..5b0c5a66db 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -69,12 +69,12 @@ def curl_output(*args, **options) print_stderr: false) end -def curl_check_http_content(url, user_agents: [:default], check_content: false, strict: false, require_http: false) +def curl_check_http_content(url, user_agents: [:default], check_content: false, strict: false) return unless url.start_with? "http" details = nil user_agent = nil - hash_needed = url.start_with?("http:") && !require_http + hash_needed = url.start_with?("http:") user_agents.each do |ua| details = curl_http_content_headers_and_checksum(url, hash_needed: hash_needed, user_agent: ua) user_agent = ua From d284090a62b7a9eb5b68e16f77717a15054c4e5b Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 28 Jan 2019 14:03:51 +0000 Subject: [PATCH 077/199] brew vendor-gems: commit updates. --- .../vendor/bundle-standalone/bundler/setup.rb | 2 +- .../cop/rspec/factory_bot/create_list.rb | 150 ------------ .../config/default.yml | 5 + .../lib/rubocop-rspec.rb | 0 .../rubocop/cop/rspec/align_left_let_brace.rb | 0 .../cop/rspec/align_right_let_brace.rb | 0 .../lib/rubocop/cop/rspec/any_instance.rb | 0 .../lib/rubocop/cop/rspec/around_block.rb | 0 .../lib/rubocop/cop/rspec/be.rb | 0 .../lib/rubocop/cop/rspec/be_eql.rb | 0 .../lib/rubocop/cop/rspec/before_after_all.rb | 0 .../capybara/current_path_expectation.rb | 0 .../cop/rspec/capybara/feature_methods.rb | 0 .../lib/rubocop/cop/rspec/context_wording.rb | 0 .../lib/rubocop/cop/rspec/cop.rb | 0 .../lib/rubocop/cop/rspec/describe_class.rb | 0 .../lib/rubocop/cop/rspec/describe_method.rb | 0 .../lib/rubocop/cop/rspec/describe_symbol.rb | 0 .../lib/rubocop/cop/rspec/described_class.rb | 0 .../rubocop/cop/rspec/empty_example_group.rb | 0 .../rspec/empty_line_after_example_group.rb | 0 .../cop/rspec/empty_line_after_final_let.rb | 0 .../cop/rspec/empty_line_after_hook.rb | 0 .../cop/rspec/empty_line_after_subject.rb | 0 .../lib/rubocop/cop/rspec/example_length.rb | 0 .../cop/rspec/example_without_description.rb | 0 .../lib/rubocop/cop/rspec/example_wording.rb | 0 .../lib/rubocop/cop/rspec/expect_actual.rb | 0 .../lib/rubocop/cop/rspec/expect_change.rb | 0 .../lib/rubocop/cop/rspec/expect_in_hook.rb | 0 .../lib/rubocop/cop/rspec/expect_output.rb | 0 .../attribute_defined_statically.rb | 0 .../cop/rspec/factory_bot/create_list.rb | 214 ++++++++++++++++++ .../lib/rubocop/cop/rspec/file_path.rb | 0 .../lib/rubocop/cop/rspec/focus.rb | 4 +- .../lib/rubocop/cop/rspec/hook_argument.rb | 0 .../cop/rspec/hooks_before_examples.rb | 0 .../lib/rubocop/cop/rspec/implicit_expect.rb | 0 .../lib/rubocop/cop/rspec/implicit_subject.rb | 0 .../lib/rubocop/cop/rspec/instance_spy.rb | 0 .../rubocop/cop/rspec/instance_variable.rb | 0 .../cop/rspec/invalid_predicate_matcher.rb | 0 .../lib/rubocop/cop/rspec/it_behaves_like.rb | 0 .../rubocop/cop/rspec/iterated_expectation.rb | 0 .../lib/rubocop/cop/rspec/leading_subject.rb | 0 .../rubocop/cop/rspec/let_before_examples.rb | 0 .../lib/rubocop/cop/rspec/let_setup.rb | 0 .../lib/rubocop/cop/rspec/message_chain.rb | 0 .../rubocop/cop/rspec/message_expectation.rb | 0 .../lib/rubocop/cop/rspec/message_spies.rb | 0 .../rspec/missing_example_group_argument.rb | 0 .../rubocop/cop/rspec/multiple_describes.rb | 0 .../cop/rspec/multiple_expectations.rb | 0 .../rubocop/cop/rspec/multiple_subjects.rb | 0 .../lib/rubocop/cop/rspec/named_subject.rb | 0 .../lib/rubocop/cop/rspec/nested_groups.rb | 0 .../lib/rubocop/cop/rspec/not_to_not.rb | 0 .../rubocop/cop/rspec/overwriting_setup.rb | 0 .../lib/rubocop/cop/rspec/pending.rb | 4 +- .../rubocop/cop/rspec/predicate_matcher.rb | 0 .../rubocop/cop/rspec/rails/http_status.rb | 0 .../lib/rubocop/cop/rspec/receive_counts.rb | 11 +- .../lib/rubocop/cop/rspec/receive_never.rb | 0 .../rubocop/cop/rspec/repeated_description.rb | 0 .../lib/rubocop/cop/rspec/repeated_example.rb | 0 .../lib/rubocop/cop/rspec/return_from_stub.rb | 0 .../lib/rubocop/cop/rspec/scattered_let.rb | 0 .../lib/rubocop/cop/rspec/scattered_setup.rb | 0 .../lib/rubocop/cop/rspec/shared_context.rb | 0 .../lib/rubocop/cop/rspec/shared_examples.rb | 0 .../rspec/single_argument_message_chain.rb | 0 .../lib/rubocop/cop/rspec/subject_stub.rb | 0 .../cop/rspec/unspecified_exception.rb | 0 .../lib/rubocop/cop/rspec/verified_doubles.rb | 0 .../lib/rubocop/cop/rspec/void_expect.rb | 0 .../lib/rubocop/cop/rspec/yield.rb | 77 +++++++ .../lib/rubocop/cop/rspec_cops.rb | 1 + .../lib/rubocop/rspec.rb | 0 .../lib/rubocop/rspec/align_let_brace.rb | 0 .../rubocop/rspec/blank_line_separation.rb | 0 .../lib/rubocop/rspec/concept.rb | 0 .../lib/rubocop/rspec/config_formatter.rb | 0 .../rubocop/rspec/description_extractor.rb | 0 .../lib/rubocop/rspec/example.rb | 0 .../lib/rubocop/rspec/example_group.rb | 0 .../lib/rubocop/rspec/final_end_location.rb | 0 .../lib/rubocop/rspec/hook.rb | 0 .../lib/rubocop/rspec/inject.rb | 0 .../lib/rubocop/rspec/language.rb | 0 .../rubocop/rspec/language/node_pattern.rb | 0 .../lib/rubocop/rspec/node.rb | 0 .../lib/rubocop/rspec/top_level_describe.rb | 0 .../lib/rubocop/rspec/util.rb | 0 .../lib/rubocop/rspec/version.rb | 2 +- .../lib/rubocop/rspec/wording.rb | 0 95 files changed, 310 insertions(+), 160 deletions(-) delete mode 100644 Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/factory_bot/create_list.rb rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/config/default.yml (98%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop-rspec.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/align_left_let_brace.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/align_right_let_brace.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/any_instance.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/around_block.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/be.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/be_eql.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/before_after_all.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/capybara/feature_methods.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/context_wording.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/cop.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/describe_class.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/describe_method.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/describe_symbol.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/described_class.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/empty_example_group.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/empty_line_after_example_group.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/empty_line_after_final_let.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/empty_line_after_hook.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/empty_line_after_subject.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/example_length.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/example_without_description.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/example_wording.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/expect_actual.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/expect_change.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/expect_in_hook.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/expect_output.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb (100%) create mode 100644 Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/factory_bot/create_list.rb rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/file_path.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/focus.rb (89%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/hook_argument.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/hooks_before_examples.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/implicit_expect.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/implicit_subject.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/instance_spy.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/instance_variable.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/invalid_predicate_matcher.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/it_behaves_like.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/iterated_expectation.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/leading_subject.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/let_before_examples.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/let_setup.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/message_chain.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/message_expectation.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/message_spies.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/missing_example_group_argument.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/multiple_describes.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/multiple_expectations.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/multiple_subjects.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/named_subject.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/nested_groups.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/not_to_not.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/overwriting_setup.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/pending.rb (91%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/predicate_matcher.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/rails/http_status.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/receive_counts.rb (91%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/receive_never.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/repeated_description.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/repeated_example.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/return_from_stub.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/scattered_let.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/scattered_setup.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/shared_context.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/shared_examples.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/single_argument_message_chain.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/subject_stub.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/unspecified_exception.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/verified_doubles.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec/void_expect.rb (100%) create mode 100644 Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/yield.rb rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/cop/rspec_cops.rb (99%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/rspec.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/rspec/align_let_brace.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/rspec/blank_line_separation.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/rspec/concept.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/rspec/config_formatter.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/rspec/description_extractor.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/rspec/example.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/rspec/example_group.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/rspec/final_end_location.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/rspec/hook.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/rspec/inject.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/rspec/language.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/rspec/language/node_pattern.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/rspec/node.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/rspec/top_level_describe.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/rspec/util.rb (100%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/rspec/version.rb (83%) rename Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/{rubocop-rspec-1.31.0 => rubocop-rspec-1.32.0}/lib/rubocop/rspec/wording.rb (100%) diff --git a/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb b/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb index 72b134a667..15ec44a4a3 100644 --- a/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb @@ -22,5 +22,5 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rainbow-3.0.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.10.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.4.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.63.1/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.31.0/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.32.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.1.0/lib" diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/factory_bot/create_list.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/factory_bot/create_list.rb deleted file mode 100644 index 6769da2e5b..0000000000 --- a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/factory_bot/create_list.rb +++ /dev/null @@ -1,150 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - module FactoryBot - # Checks for create_list usage. - # - # This cop can be configured using the `EnforcedStyle` option - # - # @example `EnforcedStyle: create_list` - # # bad - # 3.times { create :user } - # - # # good - # create_list :user, 3 - # - # # good - # 3.times { |n| create :user, created_at: n.months.ago } - # - # @example `EnforcedStyle: n_times` - # # bad - # create_list :user, 3 - # - # # good - # 3.times { create :user } - class CreateList < Cop - include ConfigurableEnforcedStyle - - MSG_CREATE_LIST = 'Prefer create_list.'.freeze - MSG_N_TIMES = 'Prefer %s.times.'.freeze - - def_node_matcher :n_times_block_without_arg?, <<-PATTERN - (block - (send (int _) :times) - (args) - ... - ) - PATTERN - - def_node_matcher :factory_call, <<-PATTERN - (send ${(const nil? {:FactoryGirl :FactoryBot}) nil?} :create (sym $_) $...) - PATTERN - - def_node_matcher :factory_list_call, <<-PATTERN - (send ${(const nil? {:FactoryGirl :FactoryBot}) nil?} :create_list (sym $_) (int $_) $...) - PATTERN - - def on_block(node) - return unless style == :create_list - return unless n_times_block_without_arg?(node) - return unless contains_only_factory?(node.body) - - add_offense(node.send_node, - location: :expression, message: MSG_CREATE_LIST) - end - - def on_send(node) - return unless style == :n_times - - factory_list_call(node) do |_receiver, _factory, count, _| - add_offense( - node, - location: :selector, - message: format(MSG_N_TIMES, number: count) - ) - end - end - - def autocorrect(node) - if style == :create_list - autocorrect_n_times_to_create_list(node) - else - autocorrect_create_list_to_n_times(node) - end - end - - private - - def contains_only_factory?(node) - if node.block_type? - factory_call(node.send_node) - else - factory_call(node) - end - end - - def autocorrect_n_times_to_create_list(node) - block = node.parent - count = block.receiver.source - replacement = factory_call_replacement(block.body, count) - - lambda do |corrector| - corrector.replace(block.loc.expression, replacement) - end - end - - def autocorrect_create_list_to_n_times(node) - replacement = generate_n_times_block(node) - lambda do |corrector| - corrector.replace(node.loc.expression, replacement) - end - end - - def generate_n_times_block(node) - receiver, factory, count, options = *factory_list_call(node) - - arguments = ":#{factory}" - options = build_options_string(options) - arguments += ", #{options}" unless options.empty? - - replacement = format_receiver(receiver) - replacement += format_method_call(node, 'create', arguments) - "#{count}.times { #{replacement} }" - end - - def factory_call_replacement(body, count) - receiver, factory, options = *factory_call(body) - - arguments = ":#{factory}, #{count}" - options = build_options_string(options) - arguments += ", #{options}" unless options.empty? - - replacement = format_receiver(receiver) - replacement += format_method_call(body, 'create_list', arguments) - replacement - end - - def build_options_string(options) - options.map(&:source).join(', ') - end - - def format_method_call(node, method, arguments) - if node.parenthesized? - "#{method}(#{arguments})" - else - "#{method} #{arguments}" - end - end - - def format_receiver(receiver) - return '' unless receiver - - "#{receiver.source}." - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/config/default.yml b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/config/default.yml similarity index 98% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/config/default.yml rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/config/default.yml index d710aa7e81..95cc2345ab 100644 --- a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/config/default.yml +++ b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/config/default.yml @@ -417,6 +417,11 @@ RSpec/VoidExpect: Enabled: true StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VoidExpect +RSpec/Yield: + Description: This cop checks for calling a block within a stub. + Enabled: true + StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Yield + Capybara/CurrentPathExpectation: Description: Checks that no expectations are set on Capybara's `current_path`. Enabled: true diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop-rspec.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop-rspec.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop-rspec.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop-rspec.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/align_left_let_brace.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/align_left_let_brace.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/align_left_let_brace.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/align_left_let_brace.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/align_right_let_brace.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/align_right_let_brace.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/align_right_let_brace.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/align_right_let_brace.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/any_instance.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/any_instance.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/any_instance.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/any_instance.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/around_block.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/around_block.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/around_block.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/around_block.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/be.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/be.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/be.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/be.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/be_eql.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/be_eql.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/be_eql.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/be_eql.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/before_after_all.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/before_after_all.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/before_after_all.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/before_after_all.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/capybara/feature_methods.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/capybara/feature_methods.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/capybara/feature_methods.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/capybara/feature_methods.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/context_wording.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/context_wording.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/context_wording.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/context_wording.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/cop.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/cop.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/cop.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/cop.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/describe_class.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/describe_class.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/describe_class.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/describe_class.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/describe_method.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/describe_method.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/describe_method.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/describe_method.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/describe_symbol.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/describe_symbol.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/describe_symbol.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/describe_symbol.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/described_class.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/described_class.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/described_class.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/described_class.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/empty_example_group.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/empty_example_group.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/empty_example_group.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/empty_example_group.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/empty_line_after_example_group.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/empty_line_after_example_group.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/empty_line_after_example_group.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/empty_line_after_example_group.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/empty_line_after_final_let.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/empty_line_after_final_let.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/empty_line_after_final_let.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/empty_line_after_final_let.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/empty_line_after_hook.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/empty_line_after_hook.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/empty_line_after_hook.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/empty_line_after_hook.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/empty_line_after_subject.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/empty_line_after_subject.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/empty_line_after_subject.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/empty_line_after_subject.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/example_length.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/example_length.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/example_length.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/example_length.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/example_without_description.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/example_without_description.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/example_without_description.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/example_without_description.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/example_wording.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/example_wording.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/example_wording.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/example_wording.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/expect_actual.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/expect_actual.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/expect_actual.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/expect_actual.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/expect_change.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/expect_change.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/expect_change.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/expect_change.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/expect_in_hook.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/expect_in_hook.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/expect_in_hook.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/expect_in_hook.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/expect_output.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/expect_output.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/expect_output.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/expect_output.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/factory_bot/create_list.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/factory_bot/create_list.rb new file mode 100644 index 0000000000..9b0f79f82a --- /dev/null +++ b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/factory_bot/create_list.rb @@ -0,0 +1,214 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module RSpec + module FactoryBot + # Checks for create_list usage. + # + # This cop can be configured using the `EnforcedStyle` option + # + # @example `EnforcedStyle: create_list` + # # bad + # 3.times { create :user } + # + # # good + # create_list :user, 3 + # + # # good + # 3.times { |n| create :user, created_at: n.months.ago } + # + # @example `EnforcedStyle: n_times` + # # bad + # create_list :user, 3 + # + # # good + # 3.times { create :user } + class CreateList < Cop + include ConfigurableEnforcedStyle + + MSG_CREATE_LIST = 'Prefer create_list.'.freeze + MSG_N_TIMES = 'Prefer %s.times.'.freeze + + def_node_matcher :n_times_block_without_arg?, <<-PATTERN + (block + (send (int _) :times) + (args) + ... + ) + PATTERN + + def_node_matcher :factory_call, <<-PATTERN + (send ${(const nil? {:FactoryGirl :FactoryBot}) nil?} :create (sym $_) $...) + PATTERN + + def_node_matcher :factory_list_call, <<-PATTERN + (send ${(const nil? {:FactoryGirl :FactoryBot}) nil?} :create_list (sym $_) (int $_) $...) + PATTERN + + def on_block(node) + return unless style == :create_list + return unless n_times_block_without_arg?(node) + return unless contains_only_factory?(node.body) + + add_offense(node.send_node, + location: :expression, message: MSG_CREATE_LIST) + end + + def on_send(node) + return unless style == :n_times + + factory_list_call(node) do |_receiver, _factory, count, _| + add_offense( + node, + location: :selector, + message: format(MSG_N_TIMES, number: count) + ) + end + end + + def autocorrect(node) + if style == :create_list + CreateListCorrector.new(node) + else + TimesCorrector.new(node) + end + end + + private + + def contains_only_factory?(node) + if node.block_type? + factory_call(node.send_node) + else + factory_call(node) + end + end + + # :nodoc + class Corrector + private + + def build_options_string(options) + options.map(&:source).join(', ') + end + + def format_method_call(node, method, arguments) + if node.block_type? || node.parenthesized? + "#{method}(#{arguments})" + else + "#{method} #{arguments}" + end + end + + def format_receiver(receiver) + return '' unless receiver + + "#{receiver.source}." + end + end + + # :nodoc + class TimesCorrector < Corrector + def initialize(node) + @node = node + end + + def call(corrector) + replacement = generate_n_times_block(node) + corrector.replace(node.loc.expression, replacement) + end + + private + + attr_reader :node + + def generate_n_times_block(node) + factory, count, *options = node.arguments + + arguments = factory.source + options = build_options_string(options) + arguments += ", #{options}" unless options.empty? + + replacement = format_receiver(node.receiver) + replacement += format_method_call(node, 'create', arguments) + "#{count.source}.times { #{replacement} }" + end + end + + # :nodoc: + class CreateListCorrector < Corrector + def initialize(node) + @node = node.parent + end + + def call(corrector) + replacement = if node.body.block_type? + call_with_block_replacement(node) + else + call_replacement(node) + end + + corrector.replace(node.loc.expression, replacement) + end + + private + + attr_reader :node + + def call_with_block_replacement(node) + block = node.body + arguments = build_arguments(block, node.receiver.source) + replacement = format_receiver(block.send_node.receiver) + replacement += format_method_call(block, 'create_list', arguments) + replacement += format_block(block) + replacement + end + + def build_arguments(node, count) + factory, *options = *node.send_node.arguments + + arguments = ":#{factory.value}, #{count}" + options = build_options_string(options) + arguments += ", #{options}" unless options.empty? + arguments + end + + def call_replacement(node) + block = node.body + factory, *options = *block.arguments + + arguments = "#{factory.source}, #{node.receiver.source}" + options = build_options_string(options) + arguments += ", #{options}" unless options.empty? + + replacement = format_receiver(block.receiver) + replacement += format_method_call(block, 'create_list', arguments) + replacement + end + + def format_block(node) + if node.body.begin_type? + format_multiline_block(node) + else + format_singeline_block(node) + end + end + + def format_multiline_block(node) + indent = ' ' * node.body.loc.column + indent_end = ' ' * node.parent.loc.column + " do #{node.arguments.source}\n" \ + "#{indent}#{node.body.source}\n" \ + "#{indent_end}end" + end + + def format_singeline_block(node) + " { #{node.arguments.source} #{node.body.source} }" + end + end + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/file_path.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/file_path.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/file_path.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/file_path.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/focus.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/focus.rb similarity index 89% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/focus.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/focus.rb index 0322aae8d2..bc63581ec9 100644 --- a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/focus.rb +++ b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/focus.rb @@ -36,8 +36,8 @@ module RuboCop FOCUS_TRUE = s(:pair, FOCUS_SYMBOL, s(:true)) def_node_matcher :metadata, <<-PATTERN - {(send nil? #{FOCUSABLE_SELECTORS} ... (hash $...)) - (send nil? #{FOCUSABLE_SELECTORS} $...)} + {(send {(const nil? :RSpec) nil?} #{FOCUSABLE_SELECTORS} ... (hash $...)) + (send {(const nil? :RSpec) nil?} #{FOCUSABLE_SELECTORS} $...)} PATTERN def_node_matcher :focused_block?, focused.send_pattern diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/hook_argument.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/hook_argument.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/hook_argument.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/hook_argument.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/hooks_before_examples.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/hooks_before_examples.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/hooks_before_examples.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/hooks_before_examples.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/implicit_expect.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/implicit_expect.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/implicit_expect.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/implicit_expect.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/implicit_subject.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/implicit_subject.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/implicit_subject.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/implicit_subject.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/instance_spy.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/instance_spy.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/instance_spy.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/instance_spy.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/instance_variable.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/instance_variable.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/instance_variable.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/instance_variable.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/invalid_predicate_matcher.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/invalid_predicate_matcher.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/invalid_predicate_matcher.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/invalid_predicate_matcher.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/it_behaves_like.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/it_behaves_like.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/it_behaves_like.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/it_behaves_like.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/iterated_expectation.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/iterated_expectation.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/iterated_expectation.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/iterated_expectation.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/leading_subject.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/leading_subject.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/leading_subject.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/leading_subject.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/let_before_examples.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/let_before_examples.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/let_before_examples.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/let_before_examples.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/let_setup.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/let_setup.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/let_setup.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/let_setup.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/message_chain.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/message_chain.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/message_chain.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/message_chain.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/message_expectation.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/message_expectation.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/message_expectation.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/message_expectation.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/message_spies.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/message_spies.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/message_spies.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/message_spies.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/missing_example_group_argument.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/missing_example_group_argument.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/missing_example_group_argument.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/missing_example_group_argument.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/multiple_describes.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/multiple_describes.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/multiple_describes.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/multiple_describes.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/multiple_expectations.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/multiple_expectations.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/multiple_expectations.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/multiple_expectations.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/multiple_subjects.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/multiple_subjects.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/multiple_subjects.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/multiple_subjects.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/named_subject.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/named_subject.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/named_subject.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/named_subject.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/nested_groups.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/nested_groups.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/nested_groups.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/nested_groups.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/not_to_not.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/not_to_not.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/not_to_not.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/not_to_not.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/overwriting_setup.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/overwriting_setup.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/overwriting_setup.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/overwriting_setup.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/pending.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/pending.rb similarity index 91% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/pending.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/pending.rb index c1b3c84dfd..356bc3dd37 100644 --- a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/pending.rb +++ b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/pending.rb @@ -37,8 +37,8 @@ module RuboCop PENDING_SYMBOL = s(:sym, :pending) def_node_matcher :metadata, <<-PATTERN - {(send nil? #{SKIPPABLE_SELECTORS} ... (hash $...)) - (send nil? #{SKIPPABLE_SELECTORS} $...)} + {(send {(const nil? :RSpec) nil?} #{SKIPPABLE_SELECTORS} ... (hash $...)) + (send {(const nil? :RSpec) nil?} #{SKIPPABLE_SELECTORS} $...)} PATTERN def_node_matcher :pending_block?, PENDING_EXAMPLES.send_pattern diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/predicate_matcher.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/predicate_matcher.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/predicate_matcher.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/predicate_matcher.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/rails/http_status.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/rails/http_status.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/rails/http_status.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/rails/http_status.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/receive_counts.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/receive_counts.rb similarity index 91% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/receive_counts.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/receive_counts.rb index e3c90fe204..f6e9fbc1f1 100644 --- a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/receive_counts.rb +++ b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/receive_counts.rb @@ -30,8 +30,12 @@ module RuboCop (send $(send _ {:exactly :at_least :at_most} (int {1 2})) :times) PATTERN + def_node_search :stub?, '(send nil? :receive ...)' + def on_send(node) receive_counts(node) do |offending_node| + return unless stub?(offending_node.receiver) + offending_range = range(node, offending_node) add_offense( @@ -48,10 +52,9 @@ module RuboCop node.method_name, node.first_argument.source.to_i ) - corrector.replace( - range(node.parent, node), - replacement - ) + + original = range(node.parent, node) + corrector.replace(original, replacement) end end diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/receive_never.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/receive_never.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/receive_never.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/receive_never.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/repeated_description.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/repeated_description.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/repeated_description.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/repeated_description.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/repeated_example.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/repeated_example.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/repeated_example.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/repeated_example.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/return_from_stub.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/return_from_stub.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/return_from_stub.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/return_from_stub.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/scattered_let.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/scattered_let.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/scattered_let.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/scattered_let.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/scattered_setup.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/scattered_setup.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/scattered_setup.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/scattered_setup.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/shared_context.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/shared_context.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/shared_context.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/shared_context.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/shared_examples.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/shared_examples.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/shared_examples.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/shared_examples.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/single_argument_message_chain.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/single_argument_message_chain.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/single_argument_message_chain.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/single_argument_message_chain.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/subject_stub.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/subject_stub.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/subject_stub.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/subject_stub.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/unspecified_exception.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/unspecified_exception.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/unspecified_exception.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/unspecified_exception.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/verified_doubles.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/verified_doubles.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/verified_doubles.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/verified_doubles.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/void_expect.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/void_expect.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec/void_expect.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/void_expect.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/yield.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/yield.rb new file mode 100644 index 0000000000..906333c58f --- /dev/null +++ b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec/yield.rb @@ -0,0 +1,77 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module RSpec + # This cop checks for calling a block within a stub. + # + # @example + # # bad + # allow(foo).to receive(:bar) { |&block| block.call(1) } + # + # # good + # expect(foo).to be(:bar).and_yield(1) + class Yield < Cop + include RangeHelp + + MSG = 'Use `.and_yield`.'.freeze + + def_node_search :method_on_stub?, '(send nil? :receive ...)' + + def_node_matcher :block_arg, '(args (blockarg $_))' + + def_node_matcher :block_call?, '(send (lvar %) :call ...)' + + def on_block(node) + return unless method_on_stub?(node.send_node) + + block_arg(node.arguments) do |block| + if calling_block?(node.body, block) + add_offense(node, location: block_range(node)) + end + end + end + + def autocorrect(node) + lambda do |corrector| + node_range = range_with_surrounding_space( + range: block_range(node), side: :left + ) + corrector.replace(node_range, generate_replacement(node.body)) + end + end + + private + + def calling_block?(node, block) + if node.begin_type? + node.each_child_node.all? { |child| block_call?(child, block) } + else + block_call?(node, block) + end + end + + def block_range(node) + block_start = node.loc.begin.begin_pos + block_end = node.loc.end.end_pos + range_between(block_start, block_end) + end + + def generate_replacement(node) + if node.begin_type? + node.children.map { |child| convert_block_to_yield(child) }.join + else + convert_block_to_yield(node) + end + end + + def convert_block_to_yield(node) + args = node.arguments + replacement = '.and_yield' + replacement += "(#{args.map(&:source).join(', ')})" if args.any? + replacement + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec_cops.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec_cops.rb similarity index 99% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec_cops.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec_cops.rb index 42eb3057ed..db6352521e 100644 --- a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/cop/rspec_cops.rb +++ b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/cop/rspec_cops.rb @@ -75,3 +75,4 @@ require_relative 'rspec/subject_stub' require_relative 'rspec/unspecified_exception' require_relative 'rspec/verified_doubles' require_relative 'rspec/void_expect' +require_relative 'rspec/yield' diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/align_let_brace.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/align_let_brace.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/align_let_brace.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/align_let_brace.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/blank_line_separation.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/blank_line_separation.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/blank_line_separation.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/blank_line_separation.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/concept.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/concept.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/concept.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/concept.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/config_formatter.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/config_formatter.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/config_formatter.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/config_formatter.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/description_extractor.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/description_extractor.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/description_extractor.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/description_extractor.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/example.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/example.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/example.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/example.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/example_group.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/example_group.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/example_group.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/example_group.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/final_end_location.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/final_end_location.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/final_end_location.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/final_end_location.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/hook.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/hook.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/hook.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/hook.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/inject.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/inject.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/inject.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/inject.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/language.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/language.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/language.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/language.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/language/node_pattern.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/language/node_pattern.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/language/node_pattern.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/language/node_pattern.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/node.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/node.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/node.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/node.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/top_level_describe.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/top_level_describe.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/top_level_describe.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/top_level_describe.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/util.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/util.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/util.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/util.rb diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/version.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/version.rb similarity index 83% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/version.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/version.rb index 3015943a4b..30412de4db 100644 --- a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/version.rb +++ b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/version.rb @@ -4,7 +4,7 @@ module RuboCop module RSpec # Version information for the RSpec RuboCop plugin. module Version - STRING = '1.31.0'.freeze + STRING = '1.32.0'.freeze end end end diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/wording.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/wording.rb similarity index 100% rename from Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib/rubocop/rspec/wording.rb rename to Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/rubocop-rspec-1.32.0/lib/rubocop/rspec/wording.rb From d5adf87cf44c18081edb895996242faa6e340634 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 28 Jan 2019 16:08:23 +0000 Subject: [PATCH 078/199] cleanup: better handle edge cases. - don't complain about "skipping" kegs when `brew cleanup` runs automatically - better handle orphaned directories - output a better error message when a keg cannot be removed Fixes #4989 Fixes #5627 Fixes https://github.com/Homebrew/homebrew-core/pull/35958#issuecomment-458031634 --- Library/Homebrew/cleanup.rb | 13 ++++++++----- Library/Homebrew/formula.rb | 10 ++++++---- Library/Homebrew/keg.rb | 2 ++ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Library/Homebrew/cleanup.rb b/Library/Homebrew/cleanup.rb index 0b13099781..386d2e5da7 100644 --- a/Library/Homebrew/cleanup.rb +++ b/Library/Homebrew/cleanup.rb @@ -178,13 +178,13 @@ module Homebrew return false unless periodic_clean_due? ohai "`brew cleanup` has not been run in #{CLEANUP_DEFAULT_DAYS} days, running now..." - clean! + clean!(quiet: true) end - def clean! + def clean!(quiet: false) if args.empty? Formula.installed.sort_by(&:name).each do |formula| - cleanup_formula(formula) + cleanup_formula(formula, quiet: quiet) end cleanup_cache cleanup_logs @@ -221,8 +221,9 @@ module Homebrew @unremovable_kegs ||= [] end - def cleanup_formula(formula) - formula.eligible_kegs_for_cleanup.each(&method(:cleanup_keg)) + def cleanup_formula(formula, quiet: false) + formula.eligible_kegs_for_cleanup(quiet: quiet) + .each(&method(:cleanup_keg)) cleanup_cache(Pathname.glob(cache/"#{formula.name}--*")) rm_ds_store([formula.rack]) cleanup_lockfiles(FormulaLock.new(formula.name).path) @@ -275,6 +276,8 @@ module Homebrew # Skip incomplete downloads which are still in progress. next end + elsif download.directory? + FileUtils.rm_rf download else download.unlink end diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 106154944c..4cf7b26eae 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1924,7 +1924,7 @@ class Formula end # @private - def eligible_kegs_for_cleanup + def eligible_kegs_for_cleanup(quiet: false) eligible_for_cleanup = [] if installed? eligible_kegs = if head? && (head_prefix = latest_head_prefix) @@ -1945,9 +1945,9 @@ class Formula unless eligible_kegs.empty? eligible_kegs.each do |keg| if keg.linked? - opoo "Skipping (old) #{keg} due to it being linked" + opoo "Skipping (old) #{keg} due to it being linked" unless quiet elsif pinned? && keg == Keg.new(@pin.path.resolved_path) - opoo "Skipping (old) #{keg} due to it being pinned" + opoo "Skipping (old) #{keg} due to it being pinned" unless quiet else eligible_for_cleanup << keg end @@ -1957,7 +1957,9 @@ class Formula # If the cellar only has one version installed, don't complain # that we can't tell which one to keep. Don't complain at all if the # only installed version is a pinned formula. - opoo "Skipping #{full_name}: most recent version #{pkg_version} not installed" + unless quiet + opoo "Skipping #{full_name}: most recent version #{pkg_version} not installed" + end end eligible_for_cleanup end diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index 63098cc774..aa62e8594f 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -310,6 +310,8 @@ class Keg remove_opt_record if optlinked? remove_old_aliases remove_oldname_opt_record + rescue Errno::ENOTEMPTY + ofail "Could not remove #{path}! Check its permissions." end def unlink(mode = OpenStruct.new) From f8c574bbc08d4361bbb85a66194941f7f96a17cc Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 28 Jan 2019 16:36:06 +0000 Subject: [PATCH 079/199] docs/Shell-Completion: read both types of bash completions. And guard against either of them being missing. Fixes #5610 --- docs/Shell-Completion.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/Shell-Completion.md b/docs/Shell-Completion.md index 97961420a3..394b70624d 100644 --- a/docs/Shell-Completion.md +++ b/docs/Shell-Completion.md @@ -12,13 +12,19 @@ To make Homebrew's completions available in `bash`, you must source the definiti ```sh if type brew 2&>/dev/null; then - source "$(brew --prefix)/etc/bash_completion.d/*" -else - echo "run: brew install git bash-completion" + for COMPLETION in $(brew --prefix)/etc/bash_completion.d/* + do + [[ -f $COMPLETION ]] && source "$COMPLETION" + done + if [[ -f $(brew --prefix)/etc/profile.d/bash_completion.sh ]]; + then + source "$(brew --prefix)/etc/profile.d/bash_completion.sh" + fi fi ``` ## Configuring Completions in `zsh` + To make Homebrew's completions available in `zsh`, you must get the Homebrew-managed zsh site-functions on your `FPATH` before initialising `zsh`'s completion facility. Add the following to your `~/.zshrc` file: ```sh @@ -42,4 +48,5 @@ Additionally, if you receive "zsh compinit: insecure directories" warnings when ``` ## Configuring Completions in `fish` + No configuration is needed in `fish`. Friendly! From 28fa8a7c97da99ec8e8726c2d7fb35347765db00 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 28 Jan 2019 19:31:21 +0000 Subject: [PATCH 080/199] version: add CPU tests. Add a new API inspired by discussion in https://github.com/Homebrew/homebrew-core/pull/36435 to query if a given CPU option is supported by a version of macOS. --- Library/Homebrew/extend/os/mac/hardware.rb | 4 ++-- Library/Homebrew/hardware.rb | 2 +- Library/Homebrew/os/mac/version.rb | 11 +++++++++++ Library/Homebrew/test/os/mac/version_spec.rb | 5 +++++ Library/Homebrew/version/null.rb | 9 +++++++++ 5 files changed, 28 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/extend/os/mac/hardware.rb b/Library/Homebrew/extend/os/mac/hardware.rb index 975e308d4a..25e9d0c58c 100644 --- a/Library/Homebrew/extend/os/mac/hardware.rb +++ b/Library/Homebrew/extend/os/mac/hardware.rb @@ -1,6 +1,6 @@ module Hardware - def self.oldest_cpu - if MacOS.version >= :mojave + def self.oldest_cpu(version = MacOS.version) + if version >= :mojave :nehalem else generic_oldest_cpu diff --git a/Library/Homebrew/hardware.rb b/Library/Homebrew/hardware.rb index b687b841a7..9f48c4b971 100644 --- a/Library/Homebrew/hardware.rb +++ b/Library/Homebrew/hardware.rb @@ -134,7 +134,7 @@ module Hardware end end - def oldest_cpu + def oldest_cpu(_version = nil) if Hardware::CPU.intel? if Hardware::CPU.is_64_bit? :core2 diff --git a/Library/Homebrew/os/mac/version.rb b/Library/Homebrew/os/mac/version.rb index 8adf848d2f..4527bdafe9 100644 --- a/Library/Homebrew/os/mac/version.rb +++ b/Library/Homebrew/os/mac/version.rb @@ -38,6 +38,17 @@ module OS def pretty_name to_sym.to_s.split("_").map(&:capitalize).join(" ") end + + # For OS::Mac::Version compatability + def requires_nehalem_cpu? + Hardware.oldest_cpu(self) == :nehalem + end + # https://en.wikipedia.org/wiki/Nehalem_(microarchitecture) + # Ensure any extra methods are also added to version/null.rb + alias requires_sse4? requires_nehalem_cpu? + alias requires_sse41? requires_nehalem_cpu? + alias requires_sse42? requires_nehalem_cpu? + alias requires_popcnt? requires_nehalem_cpu? end end end diff --git a/Library/Homebrew/test/os/mac/version_spec.rb b/Library/Homebrew/test/os/mac/version_spec.rb index cb45a14001..a74f541461 100644 --- a/Library/Homebrew/test/os/mac/version_spec.rb +++ b/Library/Homebrew/test/os/mac/version_spec.rb @@ -46,4 +46,9 @@ describe OS::Mac::Version do expect(described_class.new("10.14").pretty_name).to eq("Mojave") expect(described_class.new("10.10").pretty_name).to eq("Yosemite") end + + specify "#requires_nehalem_cpu?" do + expect(described_class.new("10.14").requires_nehalem_cpu?).to be true + expect(described_class.new("10.12").requires_nehalem_cpu?).to be false + end end diff --git a/Library/Homebrew/version/null.rb b/Library/Homebrew/version/null.rb index 9549ba3284..230907754a 100644 --- a/Library/Homebrew/version/null.rb +++ b/Library/Homebrew/version/null.rb @@ -26,6 +26,15 @@ class Version true end + # For OS::Mac::Version compatability + def requires_nehalem_cpu? + false + end + alias_method :requires_sse4?, :requires_nehalem_cpu? + alias_method :requires_sse41?, :requires_nehalem_cpu? + alias_method :requires_sse42?, :requires_nehalem_cpu? + alias_method :requires_popcnt?, :requires_nehalem_cpu? + def to_f Float::NAN end From 5a95d80b5ef30444cade112b8f871db4a843dfd7 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 29 Jan 2019 08:29:39 +0000 Subject: [PATCH 081/199] cmd/install: fix --keep-tmp description. --- Library/Homebrew/cmd/install.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 847dfba57c..930dba1153 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -132,7 +132,7 @@ module Homebrew description: "If defines it, install the HEAD version, aka master, trunk, unstable." switch "--fetch-HEAD" switch "--keep-tmp", - description: "Dont delele the temporary files created during installation." + description: "Dont delete the temporary files created during installation." switch "--build-bottle", description: "Prepare the formula for eventual bottling during installation." switch :force, From 1226470b0758b6d25fade7bef7e2ff1352f458c5 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 29 Jan 2019 08:30:07 +0000 Subject: [PATCH 082/199] cmd/install: tweak formula option code/output. --- Library/Homebrew/cmd/install.rb | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 930dba1153..f2406747fe 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -148,19 +148,17 @@ module Homebrew "package into a Homebrew package." switch "-g", "--git", description: "Create a Git repository, useful for creating patches to the software." + ARGV.formulae.each do |f| next if f.options.empty? - f.options.each do |option| - formulae_options[option.flag] = option.description - end - end - formulae_options.each do |option, description| - if option.end_with? "=" - flag option, - description: description - else - switch option, - description: description + f.options.each do |o| + name = o.flag + description = "`#{f.name}`: #{o.description}" + if name.end_with? "=" + flag name, description: description + else + switch name, description: description + end end end end From 9126a5cf8dbee31eae9df92d25c58c3337e55ed6 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 29 Jan 2019 08:30:22 +0000 Subject: [PATCH 083/199] cmd/install: fix missing formula handling. --- Library/Homebrew/cmd/install.rb | 374 ++++++++++++++++---------------- 1 file changed, 186 insertions(+), 188 deletions(-) diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index f2406747fe..c2f062d686 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -180,210 +180,208 @@ module Homebrew end end - begin - formulae = [] + formulae = [] - unless ARGV.casks.empty? - cask_args = [] - cask_args << "--force" if args.force? - cask_args << "--debug" if args.debug? - cask_args << "--verbose" if args.verbose? + unless ARGV.casks.empty? + cask_args = [] + cask_args << "--force" if args.force? + cask_args << "--debug" if args.debug? + cask_args << "--verbose" if args.verbose? - ARGV.casks.each do |c| - ohai "brew cask install #{c} #{cask_args.join " "}" - system("#{HOMEBREW_PREFIX}/bin/brew", "cask", "install", c, *cask_args) - end + ARGV.casks.each do |c| + ohai "brew cask install #{c} #{cask_args.join " "}" + system("#{HOMEBREW_PREFIX}/bin/brew", "cask", "install", c, *cask_args) + end + end + + # if the user's flags will prevent bottle only-installations when no + # developer tools are available, we need to stop them early on + FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed? + + ARGV.formulae.each do |f| + # head-only without --HEAD is an error + if !Homebrew.args.HEAD? && f.stable.nil? && f.devel.nil? + raise <<~EOS + #{f.full_name} is a head-only formula + Install with `brew install --HEAD #{f.full_name}` + EOS end - # if the user's flags will prevent bottle only-installations when no - # developer tools are available, we need to stop them early on - FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed? + # devel-only without --devel is an error + if !args.devel? && f.stable.nil? && f.head.nil? + raise <<~EOS + #{f.full_name} is a devel-only formula + Install with `brew install --devel #{f.full_name}` + EOS + end - ARGV.formulae.each do |f| - # head-only without --HEAD is an error - if !Homebrew.args.HEAD? && f.stable.nil? && f.devel.nil? - raise <<~EOS - #{f.full_name} is a head-only formula - Install with `brew install --HEAD #{f.full_name}` + if !(args.HEAD? || args.devel?) && f.stable.nil? + raise "#{f.full_name} has no stable download, please choose --devel or --HEAD" + end + + # --HEAD, fail with no head defined + if args.head? && f.head.nil? + raise "No head is defined for #{f.full_name}" + end + + # --devel, fail with no devel defined + if args.devel? && f.devel.nil? + raise "No devel block is defined for #{f.full_name}" + end + + installed_head_version = f.latest_head_version + new_head_installed = installed_head_version && + !f.head_version_outdated?(installed_head_version, fetch_head: args.fetch_HEAD?) + prefix_installed = f.prefix.exist? && !f.prefix.children.empty? + + if f.keg_only? && f.any_version_installed? && f.optlinked? && !args.force? + # keg-only install is only possible when no other version is + # linked to opt, because installing without any warnings can break + # dependencies. Therefore before performing other checks we need to be + # sure --force flag is passed. + if f.outdated? + optlinked_version = Keg.for(f.opt_prefix).version + onoe <<~EOS + #{f.full_name} #{optlinked_version} is already installed + To upgrade to #{f.version}, run `brew upgrade #{f.name}` EOS - end - - # devel-only without --devel is an error - if !args.devel? && f.stable.nil? && f.head.nil? - raise <<~EOS - #{f.full_name} is a devel-only formula - Install with `brew install --devel #{f.full_name}` - EOS - end - - if !(args.HEAD? || args.devel?) && f.stable.nil? - raise "#{f.full_name} has no stable download, please choose --devel or --HEAD" - end - - # --HEAD, fail with no head defined - if args.head? && f.head.nil? - raise "No head is defined for #{f.full_name}" - end - - # --devel, fail with no devel defined - if args.devel? && f.devel.nil? - raise "No devel block is defined for #{f.full_name}" - end - - installed_head_version = f.latest_head_version - new_head_installed = installed_head_version && - !f.head_version_outdated?(installed_head_version, fetch_head: args.fetch_HEAD?) - prefix_installed = f.prefix.exist? && !f.prefix.children.empty? - - if f.keg_only? && f.any_version_installed? && f.optlinked? && !args.force? - # keg-only install is only possible when no other version is - # linked to opt, because installing without any warnings can break - # dependencies. Therefore before performing other checks we need to be - # sure --force flag is passed. - if f.outdated? - optlinked_version = Keg.for(f.opt_prefix).version - onoe <<~EOS - #{f.full_name} #{optlinked_version} is already installed - To upgrade to #{f.version}, run `brew upgrade #{f.name}` - EOS - elsif args.only_dependencies? - formulae << f - else - opoo <<~EOS - #{f.full_name} #{f.pkg_version} is already installed and up-to-date - To reinstall #{f.pkg_version}, run `brew reinstall #{f.name}` - EOS - end - elsif (args.HEAD? && new_head_installed) || prefix_installed - # After we're sure that --force flag is passed for linked to opt - # keg-only we need to be sure that the version we're attempting to - # install is not already installed. - - installed_version = if args.HEAD? - f.latest_head_version - else - f.pkg_version - end - - msg = "#{f.full_name} #{installed_version} is already installed" - linked_not_equals_installed = f.linked_version != installed_version - if f.linked? && linked_not_equals_installed - msg = <<~EOS - #{msg} - The currently linked version is #{f.linked_version} - You can use `brew switch #{f} #{installed_version}` to link this version. - EOS - elsif !f.linked? || f.keg_only? - msg = <<~EOS - #{msg}, it's just not linked - You can use `brew link #{f}` to link this version. - EOS - elsif args.only_dependencies? - msg = nil - formulae << f - else - msg = <<~EOS - #{msg} and up-to-date - To reinstall #{f.pkg_version}, run `brew reinstall #{f.name}` - EOS - end - opoo msg if msg - elsif !f.any_version_installed? && old_formula = f.old_installed_formulae.first - msg = "#{old_formula.full_name} #{old_formula.installed_version} already installed" - if !old_formula.linked? && !old_formula.keg_only? - msg = <<~EOS - #{msg}, it's just not linked. - You can use `brew link #{old_formula.full_name}` to link this version. - EOS - end - opoo msg - elsif f.migration_needed? && !args.force? - # Check if the formula we try to install is the same as installed - # but not migrated one. If --force passed then install anyway. - opoo <<~EOS - #{f.oldname} already installed, it's just not migrated - You can migrate formula with `brew migrate #{f}` - Or you can force install it with `brew install #{f} --force` - EOS - else - # If none of the above is true and the formula is linked, then - # FormulaInstaller will handle this case. + elsif args.only_dependencies? formulae << f + else + opoo <<~EOS + #{f.full_name} #{f.pkg_version} is already installed and up-to-date + To reinstall #{f.pkg_version}, run `brew reinstall #{f.name}` + EOS + end + elsif (args.HEAD? && new_head_installed) || prefix_installed + # After we're sure that --force flag is passed for linked to opt + # keg-only we need to be sure that the version we're attempting to + # install is not already installed. + + installed_version = if args.HEAD? + f.latest_head_version + else + f.pkg_version end - # Even if we don't install this formula mark it as no longer just - # installed as a dependency. - next unless f.opt_prefix.directory? - - keg = Keg.new(f.opt_prefix.resolved_path) - tab = Tab.for_keg(keg) - unless tab.installed_on_request - tab.installed_on_request = true - tab.write + msg = "#{f.full_name} #{installed_version} is already installed" + linked_not_equals_installed = f.linked_version != installed_version + if f.linked? && linked_not_equals_installed + msg = <<~EOS + #{msg} + The currently linked version is #{f.linked_version} + You can use `brew switch #{f} #{installed_version}` to link this version. + EOS + elsif !f.linked? || f.keg_only? + msg = <<~EOS + #{msg}, it's just not linked + You can use `brew link #{f}` to link this version. + EOS + elsif args.only_dependencies? + msg = nil + formulae << f + else + msg = <<~EOS + #{msg} and up-to-date + To reinstall #{f.pkg_version}, run `brew reinstall #{f.name}` + EOS end - end - - return if formulae.empty? - - Install.perform_preinstall_checks - - formulae.each do |f| - Migrator.migrate_if_needed(f) - install_formula(f) - Cleanup.install_formula_clean!(f) - end - Homebrew.messages.display_messages - rescue FormulaUnreadableError, FormulaClassUnavailableError, - TapFormulaUnreadableError, TapFormulaClassUnavailableError => e - # Need to rescue before `FormulaUnavailableError` (superclass of this) - # is handled, as searching for a formula doesn't make sense here (the - # formula was found, but there's a problem with its implementation). - ofail e.message - rescue FormulaUnavailableError => e - if e.name == "updog" - ofail "What's updog?" - return - end - - ofail e.message - if (reason = MissingFormula.reason(e.name)) - $stderr.puts reason - return - end - - ohai "Searching for similarly named formulae..." - formulae_search_results = search_formulae(e.name) - case formulae_search_results.length - when 0 - ofail "No similarly named formulae found." - when 1 - puts "This similarly named formula was found:" - puts formulae_search_results - puts "To install it, run:\n brew install #{formulae_search_results.first}" + opoo msg if msg + elsif !f.any_version_installed? && old_formula = f.old_installed_formulae.first + msg = "#{old_formula.full_name} #{old_formula.installed_version} already installed" + if !old_formula.linked? && !old_formula.keg_only? + msg = <<~EOS + #{msg}, it's just not linked. + You can use `brew link #{old_formula.full_name}` to link this version. + EOS + end + opoo msg + elsif f.migration_needed? && !args.force? + # Check if the formula we try to install is the same as installed + # but not migrated one. If --force passed then install anyway. + opoo <<~EOS + #{f.oldname} already installed, it's just not migrated + You can migrate formula with `brew migrate #{f}` + Or you can force install it with `brew install #{f} --force` + EOS else - puts "These similarly named formulae were found:" - puts Formatter.columns(formulae_search_results) - puts "To install one of them, run (for example):\n brew install #{formulae_search_results.first}" + # If none of the above is true and the formula is linked, then + # FormulaInstaller will handle this case. + formulae << f end - # Do not search taps if the formula name is qualified - return if e.name.include?("/") + # Even if we don't install this formula mark it as no longer just + # installed as a dependency. + next unless f.opt_prefix.directory? - ohai "Searching taps..." - taps_search_results = search_taps(e.name)[:formulae] - case taps_search_results.length - when 0 - ofail "No formulae found in taps." - when 1 - puts "This formula was found in a tap:" - puts taps_search_results - puts "To install it, run:\n brew install #{taps_search_results.first}" - else - puts "These formulae were found in taps:" - puts Formatter.columns(taps_search_results) - puts "To install one of them, run (for example):\n brew install #{taps_search_results.first}" + keg = Keg.new(f.opt_prefix.resolved_path) + tab = Tab.for_keg(keg) + unless tab.installed_on_request + tab.installed_on_request = true + tab.write end end + + return if formulae.empty? + + Install.perform_preinstall_checks + + formulae.each do |f| + Migrator.migrate_if_needed(f) + install_formula(f) + Cleanup.install_formula_clean!(f) + end + Homebrew.messages.display_messages + rescue FormulaUnreadableError, FormulaClassUnavailableError, + TapFormulaUnreadableError, TapFormulaClassUnavailableError => e + # Need to rescue before `FormulaUnavailableError` (superclass of this) + # is handled, as searching for a formula doesn't make sense here (the + # formula was found, but there's a problem with its implementation). + ofail e.message + rescue FormulaUnavailableError => e + if e.name == "updog" + ofail "What's updog?" + return + end + + ofail e.message + if (reason = MissingFormula.reason(e.name)) + $stderr.puts reason + return + end + + ohai "Searching for similarly named formulae..." + formulae_search_results = search_formulae(e.name) + case formulae_search_results.length + when 0 + ofail "No similarly named formulae found." + when 1 + puts "This similarly named formula was found:" + puts formulae_search_results + puts "To install it, run:\n brew install #{formulae_search_results.first}" + else + puts "These similarly named formulae were found:" + puts Formatter.columns(formulae_search_results) + puts "To install one of them, run (for example):\n brew install #{formulae_search_results.first}" + end + + # Do not search taps if the formula name is qualified + return if e.name.include?("/") + + ohai "Searching taps..." + taps_search_results = search_taps(e.name)[:formulae] + case taps_search_results.length + when 0 + ofail "No formulae found in taps." + when 1 + puts "This formula was found in a tap:" + puts taps_search_results + puts "To install it, run:\n brew install #{taps_search_results.first}" + else + puts "These formulae were found in taps:" + puts Formatter.columns(taps_search_results) + puts "To install one of them, run (for example):\n brew install #{taps_search_results.first}" + end end def install_formula(f) From fd74ce2de65ef16e30b833f3e9fe448d3bd10efd Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 29 Jan 2019 08:30:41 +0000 Subject: [PATCH 084/199] cmd: remove misrendered markdown link. --- Library/Homebrew/cmd/gist-logs.rb | 4 ++-- Library/Homebrew/cmd/install.rb | 4 ++-- docs/Manpage.md | 4 ++-- manpages/brew.1 | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/cmd/gist-logs.rb b/Library/Homebrew/cmd/gist-logs.rb index 5331bc6dfa..28875abfca 100644 --- a/Library/Homebrew/cmd/gist-logs.rb +++ b/Library/Homebrew/cmd/gist-logs.rb @@ -2,7 +2,7 @@ #: Upload logs for a failed build of to a new Gist. #: #: is usually the name of the formula to install, but it can be specified -#: in several different ways. See [SPECIFYING FORMULAE](#specifying-formulae). +#: in several different ways. #: #: If `--with-hostname` is passed, include the hostname in the Gist. #: @@ -32,7 +32,7 @@ module Homebrew Upload logs for a failed build of to a new Gist. is usually the name of the formula to install, but it can be specified - in several different ways. See [SPECIFYING FORMULAE](#specifying-formulae). + in several different ways. If no logs are found, an error message is presented. EOS diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index c2f062d686..aed12ec825 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -2,7 +2,7 @@ #: Install . #: #: is usually the name of the formula to install, but it can be specified -#: in several different ways. See [SPECIFYING FORMULAE](#specifying-formulae). +#: in several different ways. #: #: If `--debug` (or `-d`) is passed and brewing fails, open an interactive debugging #: session with access to IRB or a shell inside the temporary build directory. @@ -95,7 +95,7 @@ module Homebrew Install . is usually the name of the formula to install, but it can be specified - in several different ways. See [SPECIFYING FORMULAE](#specifying-formulae). + in several different ways. EOS switch :debug, diff --git a/docs/Manpage.md b/docs/Manpage.md index 5076d1957f..f2ee48de30 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -182,7 +182,7 @@ these flags should only appear after a command. Upload logs for a failed build of *`formula`* to a new Gist. *`formula`* is usually the name of the formula to install, but it can be specified - in several different ways. See [SPECIFYING FORMULAE](#specifying-formulae). + in several different ways. If `--with-hostname` is passed, include the hostname in the Gist. @@ -240,7 +240,7 @@ these flags should only appear after a command. Install *`formula`*. *`formula`* is usually the name of the formula to install, but it can be specified - in several different ways. See [SPECIFYING FORMULAE](#specifying-formulae). + in several different ways. If `--debug` (or `-d`) is passed and brewing fails, open an interactive debugging session with access to IRB or a shell inside the temporary build directory. diff --git a/manpages/brew.1 b/manpages/brew.1 index bf59b91d7c..3a146d6d19 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -184,7 +184,7 @@ If \fB\-\-force\-bottle\fR is passed, download a bottle if it exists for the cur Upload logs for a failed build of \fIformula\fR to a new Gist\. . .IP -\fIformula\fR is usually the name of the formula to install, but it can be specified in several different ways\. See \fISPECIFYING FORMULAE\fR\. +\fIformula\fR is usually the name of the formula to install, but it can be specified in several different ways\. . .IP If \fB\-\-with\-hostname\fR is passed, include the hostname in the Gist\. @@ -252,7 +252,7 @@ See the docs for examples of using the JSON output: \fIhttps://docs\.brew\.sh/Qu Install \fIformula\fR\. . .IP -\fIformula\fR is usually the name of the formula to install, but it can be specified in several different ways\. See \fISPECIFYING FORMULAE\fR\. +\fIformula\fR is usually the name of the formula to install, but it can be specified in several different ways\. . .IP If \fB\-\-debug\fR (or \fB\-d\fR) is passed and brewing fails, open an interactive debugging session with access to IRB or a shell inside the temporary build directory\. From 24eb8e8e54ec7f44c2aa6ca55af6f0ac8fe35390 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 29 Jan 2019 08:31:45 +0000 Subject: [PATCH 085/199] Remove (now) unused invalid_option_names. This is handled by `OptionParser` now instead in `cmd/install`. --- Library/Homebrew/build_options.rb | 16 ---------------- Library/Homebrew/cmd/install.rb | 1 - Library/Homebrew/formula_installer.rb | 7 +------ Library/Homebrew/reinstall.rb | 1 - Library/Homebrew/test/build_options_spec.rb | 13 ------------- 5 files changed, 1 insertion(+), 37 deletions(-) diff --git a/Library/Homebrew/build_options.rb b/Library/Homebrew/build_options.rb index 331a624e68..bc7b278a67 100644 --- a/Library/Homebrew/build_options.rb +++ b/Library/Homebrew/build_options.rb @@ -99,22 +99,6 @@ class BuildOptions @options - @args end - # @private - def invalid_options - @args - @options - BuildOptions.formula_install_options - end - - # @private - def invalid_option_names - invalid_options.map(&:flag).sort - end - - def self.formula_install_options - @formula_install_options ||= ARGV.formula_install_option_names.map do |option_name| - Option.new option_name[2..-1] - end - end - private def option_defined?(name) diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index aed12ec825..308362701d 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -390,7 +390,6 @@ module Homebrew fi = FormulaInstaller.new(f) fi.options = build_options.used_options - fi.invalid_option_names = build_options.invalid_option_names fi.ignore_deps = args.ignore_dependencies? fi.only_deps = args.only_dependencies? fi.build_bottle = args.build_bottle? diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index ba0fd8bb34..4ff9e5bd57 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -33,7 +33,7 @@ class FormulaInstaller end attr_reader :formula - attr_accessor :options, :build_bottle, :invalid_option_names + attr_accessor :options, :build_bottle attr_accessor :installed_as_dependency, :installed_on_request, :link_keg mode_attr_accessor :show_summary_heading, :show_header mode_attr_accessor :build_from_source, :force_bottle, :include_test @@ -58,7 +58,6 @@ class FormulaInstaller @installed_as_dependency = false @installed_on_request = true @options = Options.new - @invalid_option_names = [] @requirement_messages = [] @poured_bottle = false @pour_failed = false @@ -267,10 +266,6 @@ class FormulaInstaller opoo "#{formula.full_name}: #{old_flag} was deprecated; using #{new_flag} instead!" end - invalid_option_names.each do |option| - opoo "#{formula.full_name}: this formula has no #{option} option so it will be ignored!" - end - options = display_options(formula) if show_header? oh1 "Installing #{Formatter.identifier(formula.full_name)} #{options}".strip diff --git a/Library/Homebrew/reinstall.rb b/Library/Homebrew/reinstall.rb index 98bdd0b137..fd131e84cc 100644 --- a/Library/Homebrew/reinstall.rb +++ b/Library/Homebrew/reinstall.rb @@ -20,7 +20,6 @@ module Homebrew fi = FormulaInstaller.new(f) fi.options = options - fi.invalid_option_names = build_options.invalid_option_names fi.build_bottle = ARGV.build_bottle? || (!f.bottle_defined? && f.build.bottle?) fi.interactive = ARGV.interactive? fi.git = ARGV.git? diff --git a/Library/Homebrew/test/build_options_spec.rb b/Library/Homebrew/test/build_options_spec.rb index 8c118c5515..8c60e128ec 100644 --- a/Library/Homebrew/test/build_options_spec.rb +++ b/Library/Homebrew/test/build_options_spec.rb @@ -37,17 +37,4 @@ describe BuildOptions do specify "#unused_options" do expect(subject.unused_options).to include("--without-baz") end - - specify "#invalid_options" do - expect(subject.invalid_options).to be_empty - expect(bad_build.invalid_options).to include("--without-bas") - expect(bad_build.invalid_options).to include("--without-abc") - expect(bad_build.invalid_options).not_to include("--with-foo") - expect(bad_build.invalid_options).not_to include("--with-baz") - end - - specify "#invalid_option_names" do - expect(subject.invalid_option_names).to be_empty - expect(bad_build.invalid_option_names).to eq(%w[--without-abc --without-bas]) - end end From ad4b3b0e7f93ec53b68ce11a29bea0ba48097f15 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 29 Jan 2019 04:10:16 -0500 Subject: [PATCH 086/199] Fix printf error on bash launch --- Library/Homebrew/brew.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index ff112c1221..c24f47fcaf 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -58,7 +58,7 @@ git() { numeric() { # Condense the exploded argument into a single return value. # shellcheck disable=SC2086,SC2183 - printf "%01d%02d%02d%02d" ${1//./ } + printf "%01d%02d%02d%02d" ${1//[.rc]/ } } HOMEBREW_VERSION="$(git -C "$HOMEBREW_REPOSITORY" describe --tags --dirty --abbrev=7 2>/dev/null)" From 36016f18a83aafe321ebc3db974226b4e0527fc0 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 29 Jan 2019 09:38:20 +0000 Subject: [PATCH 087/199] cmd/install: fix style. --- Library/Homebrew/cmd/install.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 308362701d..d11455c5fd 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -88,7 +88,6 @@ module Homebrew def install_args Homebrew::CLI::Parser.new do - formulae_options = {} usage_banner <<~EOS `install` [] formula @@ -230,8 +229,10 @@ module Homebrew end installed_head_version = f.latest_head_version - new_head_installed = installed_head_version && - !f.head_version_outdated?(installed_head_version, fetch_head: args.fetch_HEAD?) + if installed_head_version && + !f.head_version_outdated?(installed_head_version, fetch_head: args.fetch_HEAD?) + new_head_installed = true + end prefix_installed = f.prefix.exist? && !f.prefix.children.empty? if f.keg_only? && f.any_version_installed? && f.optlinked? && !args.force? @@ -333,7 +334,7 @@ module Homebrew end Homebrew.messages.display_messages rescue FormulaUnreadableError, FormulaClassUnavailableError, - TapFormulaUnreadableError, TapFormulaClassUnavailableError => e + TapFormulaUnreadableError, TapFormulaClassUnavailableError => e # Need to rescue before `FormulaUnavailableError` (superclass of this) # is handled, as searching for a formula doesn't make sense here (the # formula was found, but there's a problem with its implementation). From 49d3849507aed7c5ff770376add40ac44963b589 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 29 Jan 2019 10:48:39 +0000 Subject: [PATCH 088/199] cmd/install_spec: test new invalid option behaviour. --- Library/Homebrew/test/cmd/install_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/test/cmd/install_spec.rb b/Library/Homebrew/test/cmd/install_spec.rb index f6bcb874a7..78302efcb0 100644 --- a/Library/Homebrew/test/cmd/install_spec.rb +++ b/Library/Homebrew/test/cmd/install_spec.rb @@ -166,12 +166,12 @@ describe "brew install", :integration_test do .and be_a_success end - it "ignores invalid options" do + it "rejects invalid options" do setup_test_formula "testball1" - expect { brew "install", "testball1", "--with-fo" } - .to output(/testball1: this formula has no \-\-with\-fo option so it will be ignored!/).to_stderr - .and output(/Downloading file/).to_stdout - .and be_a_success + expect { brew "install", "testball1", "--invalid" } + .to output(/Error: invalid option: --invalid/).to_stderr + .and not_to_output.to_stdout + .and be_a_failure end it "succeeds when a non-fatal requirement isn't satisfied" do From a6a3ed1ceee6a74a089c7a40e692c58c73c42489 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Sat, 27 Oct 2018 23:44:32 +0530 Subject: [PATCH 089/199] fetch: Use CLI::Parser to parse args --- Library/Homebrew/cmd/fetch.rb | 41 ++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb index 892c6426d3..b165a97ff8 100644 --- a/Library/Homebrew/cmd/fetch.rb +++ b/Library/Homebrew/cmd/fetch.rb @@ -24,14 +24,49 @@ require "formula" require "fetch" +require "cli_parser" module Homebrew module_function + def fetch_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `fetch` [] + + Download the source packages for the given . + For tarballs, also print SHA-256 checksums. + EOS + switch "--HEAD", + description: "Fetch HEAD version instead of stable version." + switch "--devel", + description: "Fetch devel version instead of stable version." + switch :verbose, + description: "Do a verbose VCS checkout, if the URL represents a VCS. This is useful for "\ + "seeing if an existing VCS cache has been updated." + switch :force, + description: "Remove a previously cached version and re-fetch." + switch "--retry", + description: "Retry if a download fails or re-download if the checksum of a previously cached "\ + "version no longer matches." + switch "--deps", + description: "Download dependencies for any listed ." + switch "-s", "--build-from-source", + description: "Download the source rather than a bottle." + switch "--force-bottle", + description: "Download a bottle if it exists for the current or newest version of macOS, "\ + "even if it would not be used during installation." + switch :verbose + switch :debug + end + end + def fetch + fetch_args.parse + raise FormulaUnspecifiedError if ARGV.named.empty? - if ARGV.include? "--deps" + if args.deps? bucket = [] ARGV.formulae.each do |f| bucket << f @@ -100,7 +135,7 @@ module Homebrew def retry_fetch?(f) @fetch_failed ||= Set.new - if ARGV.include?("--retry") && @fetch_failed.add?(f) + if args.retry? && @fetch_failed.add?(f) ohai "Retrying download" f.clear_cache true @@ -111,7 +146,7 @@ module Homebrew end def fetch_fetchable(f) - f.clear_cache if ARGV.force? + f.clear_cache if args.force? already_fetched = f.cached_download.exist? From fe8f3218d30e4b3813364683d21f52ad77057af3 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 29 Jan 2019 11:35:04 +0000 Subject: [PATCH 090/199] cmd/fetch: add missing `--build-bottle` argument. --- Library/Homebrew/cmd/fetch.rb | 8 +++++--- docs/Manpage.md | 4 ++-- manpages/brew.1 | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb index b165a97ff8..3b870b3640 100644 --- a/Library/Homebrew/cmd/fetch.rb +++ b/Library/Homebrew/cmd/fetch.rb @@ -15,8 +15,8 @@ #: #: If `--deps` is passed, also download dependencies for any listed . #: -#: If `--build-from-source` (or `-s`) is passed, download the source rather than a -#: bottle. +#: If `--build-from-source` (or `-s`) or `--build-bottle` is passed, download the +#: source rather than a bottle. #: #: If `--force-bottle` is passed, download a bottle if it exists for the #: current or newest version of macOS, even if it would not be used during @@ -52,7 +52,9 @@ module Homebrew switch "--deps", description: "Download dependencies for any listed ." switch "-s", "--build-from-source", - description: "Download the source rather than a bottle." + description: "Download the source for rather than a bottle." + switch "--build-bottle", + description: "Download the source (for eventual bottling) rather than a bottle." switch "--force-bottle", description: "Download a bottle if it exists for the current or newest version of macOS, "\ "even if it would not be used during installation." diff --git a/docs/Manpage.md b/docs/Manpage.md index 2c7117f1a7..347651074a 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -171,8 +171,8 @@ these flags should only appear after a command. If `--deps` is passed, also download dependencies for any listed *`formulae`*. - If `--build-from-source` (or `-s`) is passed, download the source rather than a - bottle. + If `--build-from-source` (or `-s`) or `--build-bottle` is passed, download the + source rather than a bottle. If `--force-bottle` is passed, download a bottle if it exists for the current or newest version of macOS, even if it would not be used during diff --git a/manpages/brew.1 b/manpages/brew.1 index 4aa57bc90c..43d412423e 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -174,7 +174,7 @@ If \fB\-\-retry\fR is passed, retry if a download fails or re\-download if the c If \fB\-\-deps\fR is passed, also download dependencies for any listed \fIformulae\fR\. . .IP -If \fB\-\-build\-from\-source\fR (or \fB\-s\fR) is passed, download the source rather than a bottle\. +If \fB\-\-build\-from\-source\fR (or \fB\-s\fR) or \fB\-\-build\-bottle\fR is passed, download the source rather than a bottle\. . .IP If \fB\-\-force\-bottle\fR is passed, download a bottle if it exists for the current or newest version of macOS, even if it would not be used during installation\. From c3ba863a30e9b21e42453e103155492d114adc2e Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Tue, 29 Jan 2019 18:35:22 +0530 Subject: [PATCH 091/199] cmd/install: Add description for `--fetch-HEAD` option --- Library/Homebrew/cmd/install.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index d11455c5fd..efe9d892c3 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -129,7 +129,10 @@ module Homebrew description: "If defines it, install the development version." switch "--HEAD", description: "If defines it, install the HEAD version, aka master, trunk, unstable." - switch "--fetch-HEAD" + switch "--fetch-HEAD", + description: "Fetch the upstream repository to detect if the HEAD installation of the "\ + "formula is outdated. Otherwise, the repository's HEAD will be checked for "\ + "updates when a new stable or devel version has been released." switch "--keep-tmp", description: "Dont delete the temporary files created during installation." switch "--build-bottle", From 22c2b06fa583f3ebaf33f6cbb7055e6b1dbc2cd0 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Tue, 29 Jan 2019 19:52:06 +0530 Subject: [PATCH 092/199] cmd/upgrade: Use CLI::Parser to parse args --- Library/Homebrew/cmd/upgrade.rb | 47 ++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 7a9fad981c..68ab9f7c81 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -23,10 +23,37 @@ require "formula_installer" require "development_tools" require "messages" require "cleanup" +require "cli_parser" module Homebrew module_function + def upgrade_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `upgrade` [] [] [] + + Upgrade outdated, unpinned brews (with existing install options). + Options for the `install` command are also valid here. + + If are given, upgrade only the specified brews (unless they + are pinned; see `pin`, `unpin`). + EOS + switch "--fetch-HEAD", + description: "Fetch the upstream repository to detect if the HEAD installation of the "\ + "formula is outdated. Otherwise, the repository's HEAD will be checked for "\ + "updates when a new stable or devel version has been released." + switch "--ignore-pinned", + description: "Set a 0 exit code even if pinned formulae are not upgraded." + switch "--build-bottle", + description: "Prepare the formula for eventual bottling during installation." + switch "--display-times", + description: "Print install times for each formula at the end of the run." + switch :verbose + switch :debug + end + end + def upgrade if ARGV.include?("--cleanup") odisabled("'brew upgrade --cleanup'") @@ -40,13 +67,13 @@ module Homebrew if ARGV.named.empty? outdated = Formula.installed.select do |f| - f.outdated?(fetch_head: ARGV.fetch_head?) + f.outdated?(fetch_head: args.fetch_HEAD?) end exit 0 if outdated.empty? else outdated = ARGV.resolved_formulae.select do |f| - f.outdated?(fetch_head: ARGV.fetch_head?) + f.outdated?(fetch_head: args.fetch_HEAD?) end (ARGV.resolved_formulae - outdated).each do |f| @@ -65,7 +92,7 @@ module Homebrew outdated -= pinned formulae_to_install = outdated.map(&:latest_formula) - if !pinned.empty? && !ARGV.include?("--ignore-pinned") + if !pinned.empty? && !args.ignore_pinned? ofail "Not upgrading #{pinned.count} pinned #{"package".pluralize(pinned.count)}:" puts pinned.map { |f| "#{f.full_specified_name} #{f.pkg_version}" } * ", " end @@ -144,7 +171,7 @@ module Homebrew fi = FormulaInstaller.new(f) fi.options = options - fi.build_bottle = ARGV.build_bottle? || (!f.bottle_defined? && f.build.bottle?) + fi.build_bottle = args.build_bottle? || (!f.bottle_defined? && f.build.bottle?) fi.installed_on_request = !ARGV.named.empty? fi.link_keg ||= keg_was_linked if keg_had_linked_opt if tab @@ -203,7 +230,7 @@ module Homebrew next if formulae_to_upgrade.include?(f) next if formulae_pinned.include?(f) - if f.outdated?(fetch_head: ARGV.fetch_head?) + if f.outdated?(fetch_head: args.fetch_HEAD?) if f.pinned? formulae_pinned << f else @@ -247,7 +274,7 @@ module Homebrew checker = LinkageChecker.new(keg, cache_db: db) if checker.broken_library_linkage? - if f.outdated?(fetch_head: ARGV.fetch_head?) + if f.outdated?(fetch_head: args.fetch_HEAD?) # Outdated formulae = pinned formulae (see function above) formulae_pinned_and_outdated << f else @@ -295,7 +322,7 @@ module Homebrew return if kegs.empty? - oh1 "Checking dependents for outdated formulae" if ARGV.verbose? + oh1 "Checking dependents for outdated formulae" if args.verbose? upgradable, pinned = upgradable_dependents(kegs, formulae).map(&:to_a) upgradable.sort! { |a, b| depends_on(a, b) } @@ -310,7 +337,7 @@ module Homebrew # Print the upgradable dependents. if upgradable.empty? - ohai "No dependents to upgrade" if ARGV.verbose? + ohai "No dependents to upgrade" if args.verbose? else ohai "Upgrading #{upgradable.count} #{"dependent".pluralize(upgradable.count)}:" formulae_upgrades = upgradable.map do |f| @@ -328,7 +355,7 @@ module Homebrew # Assess the dependents tree again. kegs = formulae_with_runtime_dependencies - oh1 "Checking dependents for broken library links" if ARGV.verbose? + oh1 "Checking dependents for broken library links" if args.verbose? reinstallable, pinned = broken_dependents(kegs, formulae).map(&:to_a) reinstallable.sort! { |a, b| depends_on(a, b) } @@ -343,7 +370,7 @@ module Homebrew # Print the broken dependents. if reinstallable.empty? - ohai "No broken dependents to reinstall" if ARGV.verbose? + ohai "No broken dependents to reinstall" if args.verbose? else ohai "Reinstalling #{reinstallable.count} broken #{"dependent".pluralize(reinstallable.count)} from source:" puts reinstallable.map(&:full_specified_name).join(", ") From 9eabcdad7d9633069bd412d86a1283d642d21571 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 29 Jan 2019 19:25:13 +0000 Subject: [PATCH 093/199] Make install/reinstall/upgrade options more consistent. --- Library/Homebrew/cli_parser.rb | 15 ++++++ Library/Homebrew/cmd/install.rb | 20 ++----- Library/Homebrew/cmd/reinstall.rb | 48 ++++++++++++++--- Library/Homebrew/cmd/upgrade.rb | 57 +++++++++++++++----- Library/Homebrew/test/cmd/reinstall_spec.rb | 5 +- docs/Manpage.md | 58 ++++++++++++++++++--- manpages/brew.1 | 53 ++++++++++++++++--- 7 files changed, 203 insertions(+), 53 deletions(-) diff --git a/Library/Homebrew/cli_parser.rb b/Library/Homebrew/cli_parser.rb index da63133dfb..1fa11a1d47 100644 --- a/Library/Homebrew/cli_parser.rb +++ b/Library/Homebrew/cli_parser.rb @@ -148,6 +148,21 @@ module Homebrew .gsub(/\*(.*?)\*/m, "#{Tty.underline}\\1#{Tty.reset}") end + def formula_options + ARGV.formulae.each do |f| + next if f.options.empty? + f.options.each do |o| + name = o.flag + description = "`#{f.name}`: #{o.description}" + if name.end_with? "=" + flag name, description: description + else + switch name, description: description + end + end + end + end + private def enable_switch(*names) diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 3870330617..46b4820f90 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -41,7 +41,7 @@ #: If `--devel` is passed, and defines it, install the development version. #: #: If `--HEAD` is passed, and defines it, install the HEAD version, -#: aka master, trunk, unstable. +#: aka. master, trunk, unstable. #: #: If `--keep-tmp` is passed, the temporary files created during installation #: are not deleted. @@ -85,7 +85,7 @@ module Homebrew def install_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `install` [] formula + `install` [] Install . @@ -124,7 +124,7 @@ module Homebrew switch "--devel", description: "If defines it, install the development version." switch "--HEAD", - description: "If defines it, install the HEAD version, aka master, trunk, unstable." + description: "If defines it, install the HEAD version, aka. master, trunk, unstable." switch "--fetch-HEAD", description: "Fetch the upstream repository to detect if the HEAD installation of the "\ "formula is outdated. Otherwise, the repository's HEAD will be checked for "\ @@ -146,19 +146,7 @@ module Homebrew "package into a Homebrew package." switch "-g", "--git", description: "Create a Git repository, useful for creating patches to the software." - - ARGV.formulae.each do |f| - next if f.options.empty? - f.options.each do |o| - name = o.flag - description = "`#{f.name}`: #{o.description}" - if name.end_with? "=" - flag name, description: description - else - switch name, description: description - end - end - end + formula_options end end diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index 123e97d7ab..0b0abe0a7d 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -1,8 +1,30 @@ -#: * `reinstall` [`--display-times`] : -#: Uninstall and then install (with existing install options). +#: * `reinstall` [`--debug`] [`--build-from-source`|`--force-bottle`] [`--keep-tmp`] [`--force`] [`--verbose`] [`--display-times`] : +#: Uninstall and then install (with existing and any appended install options). +#: +#: If `--debug` (or `-d`) is passed and brewing fails, open an interactive debugging +#: session with access to IRB or a shell inside the temporary build directory. +#: +#: If `--build-from-source` (or `-s`) is passed, compile the specified from +#: source even if a bottle is provided. Dependencies will still be installed +#: from bottles if they are available. +#: +#: If `--force-bottle` is passed, install from a bottle if it exists for the +#: current or newest version of macOS, even if it would not normally be used +#: for installation. +#: +#: If `--keep-tmp` is passed, the temporary files created during installation +#: are not deleted. +#: +#: If `--force` (or `-f`) is passed, install without checking for previously +#: installed keg-only or non-migrated versions +#: +#: If `--verbose` (or `-v`) is passed, print the verification and postinstall steps. #: #: If `--display-times` is passed, install times for each formula are printed #: at the end of the run. +#: +#: Installation options specific to may be appended to the command, +#: and can be listed with `brew options` . require "formula_installer" require "development_tools" @@ -17,16 +39,28 @@ module Homebrew def reinstall_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `reinstall` [] : + `reinstall` [] - Uninstall and then install (with existing install options). + Uninstall and then install (with existing and any appended install options). EOS + switch :debug, + description: "If brewing fails, open an interactive debugging session with access to IRB "\ + "or a shell inside the temporary build directory" switch "-s", "--build-from-source", - description: "Compile the formula> from source even if a bottle is available." + description: "Compile from source even if a bottle is available." + switch "--force-bottle", + description: "Install from a bottle if it exists for the current or newest version of "\ + "macOS, even if it would not normally be used for installation." + switch "--keep-tmp", + description: "Dont delete the temporary files created during installation." + switch :force, + description: "Install without checking for previously installed keg-only or "\ + "non-migrated versions." + switch :verbose, + description: "Print the verification and postinstall steps." switch "--display-times", description: "Print install times for each formula at the end of the run." - switch :verbose - switch :debug + formula_options end end diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 68ab9f7c81..798a7e6418 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -1,7 +1,19 @@ -#: * `upgrade` [] [`--fetch-HEAD`] [`--ignore-pinned`] [`--display-times`] []: -#: Upgrade outdated, unpinned brews (with existing install options). +#: * `upgrade` [`--debug`] [`--build-from-source`|`--force-bottle`] [`--fetch-HEAD`] [`--ignore-pinned`] [`--keep-tmp`] [`--force`] [`--verbose`] [`--display-times`] [] [ ...]: +#: Upgrade outdated, unpinned brews (with existing and any appended install options). #: -#: Options for the `install` command are also valid here. +#: If are given, upgrade only the specified brews (unless they +#: are pinned; see `pin`, `unpin`). +#: +#: If `--debug` (or `-d`) is passed and brewing fails, open an interactive debugging +#: session with access to IRB or a shell inside the temporary build directory. +#: +#: If `--build-from-source` (or `-s`) is passed, compile the specified from +#: source even if a bottle is provided. Dependencies will still be installed +#: from bottles if they are available. +#: +#: If `--force-bottle` is passed, install from a bottle if it exists for the +#: current or newest version of macOS, even if it would not normally be used +#: for installation. #: #: If `--fetch-HEAD` is passed, fetch the upstream repository to detect if #: the HEAD installation of the formula is outdated. Otherwise, the @@ -11,11 +23,19 @@ #: If `--ignore-pinned` is passed, set a 0 exit code even if pinned formulae #: are not upgraded. #: +#: If `--keep-tmp` is passed, the temporary files created during installation +#: are not deleted. +#: +#: If `--force` (or `-f`) is passed, install without checking for previously +#: installed keg-only or non-migrated versions +#: +#: If `--verbose` (or `-v`) is passed, print the verification and postinstall steps. +#: #: If `--display-times` is passed, install times for each formula are printed #: at the end of the run. #: -#: If are given, upgrade only the specified brews (unless they -#: are pinned; see `pin`, `unpin`). +#: Additional options specific to may be appended to the command, +#: and can be listed with `brew options` . require "install" require "reinstall" @@ -31,26 +51,37 @@ module Homebrew def upgrade_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `upgrade` [] [] [] + `upgrade` [] - Upgrade outdated, unpinned brews (with existing install options). - Options for the `install` command are also valid here. + Upgrade outdated, unpinned brews (with existing and any appended install options). - If are given, upgrade only the specified brews (unless they + If are given, upgrade only the specified brews (unless they are pinned; see `pin`, `unpin`). EOS + switch :debug, + description: "If brewing fails, open an interactive debugging session with access to IRB "\ + "or a shell inside the temporary build directory" + switch "-s", "--build-from-source", + description: "Compile from source even if a bottle is available." + switch "--force-bottle", + description: "Install from a bottle if it exists for the current or newest version of "\ + "macOS, even if it would not normally be used for installation." switch "--fetch-HEAD", description: "Fetch the upstream repository to detect if the HEAD installation of the "\ "formula is outdated. Otherwise, the repository's HEAD will be checked for "\ "updates when a new stable or devel version has been released." switch "--ignore-pinned", description: "Set a 0 exit code even if pinned formulae are not upgraded." - switch "--build-bottle", - description: "Prepare the formula for eventual bottling during installation." + switch "--keep-tmp", + description: "Dont delete the temporary files created during installation." + switch :force, + description: "Install without checking for previously installed keg-only or "\ + "non-migrated versions." + switch :verbose, + description: "Print the verification and postinstall steps." switch "--display-times", description: "Print install times for each formula at the end of the run." - switch :verbose - switch :debug + formula_options end end diff --git a/Library/Homebrew/test/cmd/reinstall_spec.rb b/Library/Homebrew/test/cmd/reinstall_spec.rb index ab64d5e0cf..178a0588d4 100644 --- a/Library/Homebrew/test/cmd/reinstall_spec.rb +++ b/Library/Homebrew/test/cmd/reinstall_spec.rb @@ -21,8 +21,9 @@ describe "brew reinstall", :integration_test do end it "reinstalls a Formula even when one of the options is invalid" do - expect { brew "reinstall", "testball", "--with-fo" } - .to output(/Error: invalid option: --with-fo/).to_stderr + expect { brew "reinstall", "testball", "--invalid" } + .to output(/Error: invalid option: --invalid/).to_stderr + .and not_to_output.to_stdout .and be_a_failure end diff --git a/docs/Manpage.md b/docs/Manpage.md index 553a347314..c7e86cb8a7 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -279,7 +279,7 @@ these flags should only appear after a command. If `--devel` is passed, and *`formula`* defines it, install the development version. If `--HEAD` is passed, and *`formula`* defines it, install the HEAD version, - aka master, trunk, unstable. + aka. master, trunk, unstable. If `--keep-tmp` is passed, the temporary files created during installation are not deleted. @@ -414,12 +414,34 @@ these flags should only appear after a command. If `--syntax` is passed, also syntax-check all of Homebrew's Ruby files. - * `reinstall` [`--display-times`] *`formula`*: - Uninstall and then install *`formula`* (with existing install options). + * `reinstall` [`--debug`] [`--build-from-source`|`--force-bottle`] [`--keep-tmp`] [`--force`] [`--verbose`] [`--display-times`] *`formula`*: + Uninstall and then install *`formula`* (with existing and any appended install options). + + If `--debug` (or `-d`) is passed and brewing fails, open an interactive debugging + session with access to IRB or a shell inside the temporary build directory. + + If `--build-from-source` (or `-s`) is passed, compile the specified *`formula`* from + source even if a bottle is provided. Dependencies will still be installed + from bottles if they are available. + + If `--force-bottle` is passed, install from a bottle if it exists for the + current or newest version of macOS, even if it would not normally be used + for installation. + + If `--keep-tmp` is passed, the temporary files created during installation + are not deleted. + + If `--force` (or `-f`) is passed, install without checking for previously + installed keg-only or non-migrated versions + + If `--verbose` (or `-v`) is passed, print the verification and postinstall steps. If `--display-times` is passed, install times for each formula are printed at the end of the run. + Installation options specific to *`formula`* may be appended to the command, + and can be listed with `brew options` *`formula`*. + * `search`, `-S`: Display all locally available formulae (including tapped ones). No online search is performed. @@ -588,10 +610,22 @@ these flags should only appear after a command. `repositories`) using `git`(1) to their latest `origin/master`. Note this will destroy all your uncommitted or committed changes. - * `upgrade` [*`install-options`*] [`--fetch-HEAD`] [`--ignore-pinned`] [`--display-times`] [*`formulae`*]: - Upgrade outdated, unpinned brews (with existing install options). + * `upgrade` [`--debug`] [`--build-from-source`|`--force-bottle`] [`--fetch-HEAD`] [`--ignore-pinned`] [`--keep-tmp`] [`--force`] [`--verbose`] [`--display-times`] [*`formula`*] [*`options`* ...]: + Upgrade outdated, unpinned brews (with existing and any appended install options). - Options for the `install` command are also valid here. + If *`formula`* are given, upgrade only the specified brews (unless they + are pinned; see `pin`, `unpin`). + + If `--debug` (or `-d`) is passed and brewing fails, open an interactive debugging + session with access to IRB or a shell inside the temporary build directory. + + If `--build-from-source` (or `-s`) is passed, compile the specified *`formula`* from + source even if a bottle is provided. Dependencies will still be installed + from bottles if they are available. + + If `--force-bottle` is passed, install from a bottle if it exists for the + current or newest version of macOS, even if it would not normally be used + for installation. If `--fetch-HEAD` is passed, fetch the upstream repository to detect if the HEAD installation of the formula is outdated. Otherwise, the @@ -601,11 +635,19 @@ these flags should only appear after a command. If `--ignore-pinned` is passed, set a 0 exit code even if pinned formulae are not upgraded. + If `--keep-tmp` is passed, the temporary files created during installation + are not deleted. + + If `--force` (or `-f`) is passed, install without checking for previously + installed keg-only or non-migrated versions + + If `--verbose` (or `-v`) is passed, print the verification and postinstall steps. + If `--display-times` is passed, install times for each formula are printed at the end of the run. - If *`formulae`* are given, upgrade only the specified brews (unless they - are pinned; see `pin`, `unpin`). + Additional options specific to *`formula`* may be appended to the command, + and can be listed with `brew options` *`formula`*. * `uses` [`--installed`] [`--recursive`] [`--include-build`] [`--include-test`] [`--include-optional`] [`--skip-recommended`] [`--devel`|`--HEAD`] *`formulae`*: Show the formulae that specify *`formulae`* as a dependency. When given diff --git a/manpages/brew.1 b/manpages/brew.1 index 74f920374a..00fcb0a118 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -285,7 +285,7 @@ If \fB\-\-include\-test\fR is passed, install testing dependencies\. These are o If \fB\-\-devel\fR is passed, and \fIformula\fR defines it, install the development version\. . .IP -If \fB\-\-HEAD\fR is passed, and \fIformula\fR defines it, install the HEAD version, aka master, trunk, unstable\. +If \fB\-\-HEAD\fR is passed, and \fIformula\fR defines it, install the HEAD version, aka\. master, trunk, unstable\. . .IP If \fB\-\-keep\-tmp\fR is passed, the temporary files created during installation are not deleted\. @@ -426,12 +426,33 @@ If \fB\-\-aliases\fR is passed, also verify any alias symlinks in each tap\. If \fB\-\-syntax\fR is passed, also syntax\-check all of Homebrew\'s Ruby files\. . .TP -\fBreinstall\fR [\fB\-\-display\-times\fR] \fIformula\fR -Uninstall and then install \fIformula\fR (with existing install options)\. +\fBreinstall\fR [\fB\-\-debug\fR] [\fB\-\-build\-from\-source\fR|\fB\-\-force\-bottle\fR] [\fB\-\-keep\-tmp\fR] [\fB\-\-force\fR] [\fB\-\-verbose\fR] [\fB\-\-display\-times\fR] \fIformula\fR +Uninstall and then install \fIformula\fR (with existing and any appended install options)\. +. +.IP +If \fB\-\-debug\fR (or \fB\-d\fR) is passed and brewing fails, open an interactive debugging session with access to IRB or a shell inside the temporary build directory\. +. +.IP +If \fB\-\-build\-from\-source\fR (or \fB\-s\fR) is passed, compile the specified \fIformula\fR from source even if a bottle is provided\. Dependencies will still be installed from bottles if they are available\. +. +.IP +If \fB\-\-force\-bottle\fR is passed, install from a bottle if it exists for the current or newest version of macOS, even if it would not normally be used for installation\. +. +.IP +If \fB\-\-keep\-tmp\fR is passed, the temporary files created during installation are not deleted\. +. +.IP +If \fB\-\-force\fR (or \fB\-f\fR) is passed, install without checking for previously installed keg\-only or non\-migrated versions +. +.IP +If \fB\-\-verbose\fR (or \fB\-v\fR) is passed, print the verification and postinstall steps\. . .IP If \fB\-\-display\-times\fR is passed, install times for each formula are printed at the end of the run\. . +.IP +Installation options specific to \fIformula\fR may be appended to the command, and can be listed with \fBbrew options\fR \fIformula\fR\. +. .TP \fBsearch\fR, \fB\-S\fR Display all locally available formulae (including tapped ones)\. No online search is performed\. @@ -601,11 +622,20 @@ If \fB\-\-force\fR (or \fB\-f\fR) is specified then always do a slower, full upd Fetches and resets Homebrew and all tap repositories (or the specified \fBrepositories\fR) using \fBgit\fR(1) to their latest \fBorigin/master\fR\. Note this will destroy all your uncommitted or committed changes\. . .TP -\fBupgrade\fR [\fIinstall\-options\fR] [\fB\-\-fetch\-HEAD\fR] [\fB\-\-ignore\-pinned\fR] [\fB\-\-display\-times\fR] [\fIformulae\fR] -Upgrade outdated, unpinned brews (with existing install options)\. +\fBupgrade\fR [\fB\-\-debug\fR] [\fB\-\-build\-from\-source\fR|\fB\-\-force\-bottle\fR] [\fB\-\-fetch\-HEAD\fR] [\fB\-\-ignore\-pinned\fR] [\fB\-\-keep\-tmp\fR] [\fB\-\-force\fR] [\fB\-\-verbose\fR] [\fB\-\-display\-times\fR] [\fIformula\fR] [\fIoptions\fR \.\.\.] +Upgrade outdated, unpinned brews (with existing and any appended install options)\. . .IP -Options for the \fBinstall\fR command are also valid here\. +If \fIformula\fR are given, upgrade only the specified brews (unless they are pinned; see \fBpin\fR, \fBunpin\fR)\. +. +.IP +If \fB\-\-debug\fR (or \fB\-d\fR) is passed and brewing fails, open an interactive debugging session with access to IRB or a shell inside the temporary build directory\. +. +.IP +If \fB\-\-build\-from\-source\fR (or \fB\-s\fR) is passed, compile the specified \fIformula\fR from source even if a bottle is provided\. Dependencies will still be installed from bottles if they are available\. +. +.IP +If \fB\-\-force\-bottle\fR is passed, install from a bottle if it exists for the current or newest version of macOS, even if it would not normally be used for installation\. . .IP If \fB\-\-fetch\-HEAD\fR is passed, fetch the upstream repository to detect if the HEAD installation of the formula is outdated\. Otherwise, the repository\'s HEAD will be checked for updates when a new stable or devel version has been released\. @@ -614,10 +644,19 @@ If \fB\-\-fetch\-HEAD\fR is passed, fetch the upstream repository to detect if t If \fB\-\-ignore\-pinned\fR is passed, set a 0 exit code even if pinned formulae are not upgraded\. . .IP +If \fB\-\-keep\-tmp\fR is passed, the temporary files created during installation are not deleted\. +. +.IP +If \fB\-\-force\fR (or \fB\-f\fR) is passed, install without checking for previously installed keg\-only or non\-migrated versions +. +.IP +If \fB\-\-verbose\fR (or \fB\-v\fR) is passed, print the verification and postinstall steps\. +. +.IP If \fB\-\-display\-times\fR is passed, install times for each formula are printed at the end of the run\. . .IP -If \fIformulae\fR are given, upgrade only the specified brews (unless they are pinned; see \fBpin\fR, \fBunpin\fR)\. +Additional options specific to \fIformula\fR may be appended to the command, and can be listed with \fBbrew options\fR \fIformula\fR\. . .TP \fBuses\fR [\fB\-\-installed\fR] [\fB\-\-recursive\fR] [\fB\-\-include\-build\fR] [\fB\-\-include\-test\fR] [\fB\-\-include\-optional\fR] [\fB\-\-skip\-recommended\fR] [\fB\-\-devel\fR|\fB\-\-HEAD\fR] \fIformulae\fR From 867b155479be4a50e02580e05df770aec84438be Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 29 Jan 2019 19:39:41 +0000 Subject: [PATCH 094/199] Add missing conflicts to command options. --- Library/Homebrew/cmd/deps.rb | 1 + Library/Homebrew/cmd/desc.rb | 1 + Library/Homebrew/cmd/fetch.rb | 2 ++ Library/Homebrew/cmd/info.rb | 1 + Library/Homebrew/cmd/install.rb | 3 +++ Library/Homebrew/cmd/options.rb | 1 + Library/Homebrew/cmd/outdated.rb | 1 + Library/Homebrew/cmd/reinstall.rb | 1 + Library/Homebrew/cmd/unpack.rb | 1 + Library/Homebrew/cmd/upgrade.rb | 1 + Library/Homebrew/cmd/uses.rb | 1 + Library/Homebrew/dev-cmd/bump-formula-pr.rb | 1 + Library/Homebrew/dev-cmd/create.rb | 1 + Library/Homebrew/dev-cmd/test.rb | 1 + 14 files changed, 17 insertions(+) diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index b2f038c286..dd51f8913b 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -98,6 +98,7 @@ module Homebrew "debugging the `--installed`/`--all` display mode." switch :verbose switch :debug + conflicts "--installed", "--all" end end diff --git a/Library/Homebrew/cmd/desc.rb b/Library/Homebrew/cmd/desc.rb index 2ce5514fc4..5e9c972272 100644 --- a/Library/Homebrew/cmd/desc.rb +++ b/Library/Homebrew/cmd/desc.rb @@ -37,6 +37,7 @@ module Homebrew description: "Search just the descriptions for provided . If is flanked by slashes, "\ "it is interpreted as a regular expression." switch :verbose + conflicts "--search=", "--name=", "--description=" end end diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb index 3b870b3640..84a8e2bc24 100644 --- a/Library/Homebrew/cmd/fetch.rb +++ b/Library/Homebrew/cmd/fetch.rb @@ -60,6 +60,8 @@ module Homebrew "even if it would not be used during installation." switch :verbose switch :debug + conflicts "--devel", "--HEAD" + conflicts "--build-from-source", "--build-bottle", "--force-bottle" end end diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb index ce72549531..3693a6cba9 100644 --- a/Library/Homebrew/cmd/info.rb +++ b/Library/Homebrew/cmd/info.rb @@ -79,6 +79,7 @@ module Homebrew switch :verbose, description: "See more verbose analytics data." switch :debug + conflicts "--all", "--installed" end end diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 46b4820f90..46a4bef490 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -146,6 +146,9 @@ module Homebrew "package into a Homebrew package." switch "-g", "--git", description: "Create a Git repository, useful for creating patches to the software." + conflicts "--ignore-dependencies", "--only-dependencies" + conflicts "--devel", "--HEAD" + conflicts "--build-from-source", "--build-bottle", "--force-bottle" formula_options end end diff --git a/Library/Homebrew/cmd/options.rb b/Library/Homebrew/cmd/options.rb index d113e6ef38..8fa65c3a1a 100644 --- a/Library/Homebrew/cmd/options.rb +++ b/Library/Homebrew/cmd/options.rb @@ -29,6 +29,7 @@ module Homebrew switch "--installed", description: "Show options for all installed formulae." switch :debug + conflicts "--all", "--installed" end end diff --git a/Library/Homebrew/cmd/outdated.rb b/Library/Homebrew/cmd/outdated.rb index 63afc3666d..6477dc2b8d 100644 --- a/Library/Homebrew/cmd/outdated.rb +++ b/Library/Homebrew/cmd/outdated.rb @@ -46,6 +46,7 @@ module Homebrew "formula is outdated. Otherwise, the repository's HEAD will be checked for "\ "updates when a new stable or devel version has been released." switch :debug + conflicts "--quiet", "--verbose", "--json=" end end diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index 0b0abe0a7d..d1d7a0f05c 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -60,6 +60,7 @@ module Homebrew description: "Print the verification and postinstall steps." switch "--display-times", description: "Print install times for each formula at the end of the run." + conflicts "--build-from-source", "--force-bottle" formula_options end end diff --git a/Library/Homebrew/cmd/unpack.rb b/Library/Homebrew/cmd/unpack.rb index a13351f50a..f091df6d78 100644 --- a/Library/Homebrew/cmd/unpack.rb +++ b/Library/Homebrew/cmd/unpack.rb @@ -34,6 +34,7 @@ module Homebrew switch :force switch :verbose switch :debug + conflicts "--git", "--patch" end end diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 798a7e6418..71c6b81e7e 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -81,6 +81,7 @@ module Homebrew description: "Print the verification and postinstall steps." switch "--display-times", description: "Print install times for each formula at the end of the run." + conflicts "--build-from-source", "--force-bottle" formula_options end end diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb index f5d4a73ef1..654211dbad 100644 --- a/Library/Homebrew/cmd/uses.rb +++ b/Library/Homebrew/cmd/uses.rb @@ -59,6 +59,7 @@ module Homebrew switch "--HEAD", description: "Show usage of by HEAD build." switch :debug + conflicts "--devel", "--HEAD" end end diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 95d64c0202..26c077fed1 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -104,6 +104,7 @@ module Homebrew switch :quiet switch :verbose switch :debug + conflicts "--no-audit", "--strict" conflicts "--url", "--tag" end end diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb index 69b3a7e12e..1f219c29b1 100644 --- a/Library/Homebrew/dev-cmd/create.rb +++ b/Library/Homebrew/dev-cmd/create.rb @@ -59,6 +59,7 @@ module Homebrew switch :force switch :verbose switch :debug + conflicts "--autotools", "--cmake", "--meson" end end diff --git a/Library/Homebrew/dev-cmd/test.rb b/Library/Homebrew/dev-cmd/test.rb index 1198bd73d3..cdd4837ec9 100644 --- a/Library/Homebrew/dev-cmd/test.rb +++ b/Library/Homebrew/dev-cmd/test.rb @@ -41,6 +41,7 @@ module Homebrew description: "Keep the temporary files created for the test." switch :verbose switch :debug + conflicts "--devel", "--HEAD" end end From de5b35876f31f540f1f7e02d6eb18dd88355702f Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Wed, 30 Jan 2019 04:01:00 +0100 Subject: [PATCH 095/199] Use Mechanize to parse Content-Disposition. --- .gitignore | 19 ++ Library/Homebrew/download_strategy.rb | 20 +- Library/Homebrew/vendor/Gemfile | 1 + Library/Homebrew/vendor/Gemfile.lock | 29 +++ .../vendor/bundle-standalone/bundler/setup.rb | 16 ++ .../http/content_disposition_parser.rb | 191 ++++++++++++++++++ .../mechanize-2.7.6/lib/mechanize/version.rb | 3 + 7 files changed, 276 insertions(+), 3 deletions(-) create mode 100644 Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/mechanize-2.7.6/lib/mechanize/http/content_disposition_parser.rb create mode 100644 Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/mechanize-2.7.6/lib/mechanize/version.rb diff --git a/.gitignore b/.gitignore index c464927386..3a4d0f5a61 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ **/vendor/bundle **/vendor/ruby **/vendor/bundle-standalone/ruby/*/bin +**/vendor/bundle-standalone/ruby/*/build_info/ **/vendor/bundle-standalone/ruby/*/cache **/vendor/bundle-standalone/ruby/*/extensions **/vendor/bundle-standalone/ruby/*/gems/*/* @@ -93,15 +94,33 @@ # Ignore rubocop's (and other) dependencies we don't wish to vendor **/vendor/bundle-standalone/ruby/*/gems/ast-*/ +**/vendor/bundle-standalone/ruby/*/gems/connection_pool-*/lib +**/vendor/bundle-standalone/ruby/*/gems/domain_name-*/lib +**/vendor/bundle-standalone/ruby/*/gems/http-cookie-*/lib **/vendor/bundle-standalone/ruby/*/gems/jaro_winkler-*/ +**/vendor/bundle-standalone/ruby/*/gems/mime-types-data-*/lib +**/vendor/bundle-standalone/ruby/*/gems/mime-types-*/lib +**/vendor/bundle-standalone/ruby/*/gems/mini_portile2-*/lib **/vendor/bundle-standalone/ruby/*/gems/minitest-*/lib +**/vendor/bundle-standalone/ruby/*/gems/net-http-digest_auth-*/lib +**/vendor/bundle-standalone/ruby/*/gems/net-http-persistent-*/lib +**/vendor/bundle-standalone/ruby/*/gems/nokogiri-*/lib +**/vendor/bundle-standalone/ruby/*/gems/ntlm-http-*/lib **/vendor/bundle-standalone/ruby/*/gems/parallel-*/ **/vendor/bundle-standalone/ruby/*/gems/parser-*/ **/vendor/bundle-standalone/ruby/*/gems/powerpack-*/ **/vendor/bundle-standalone/ruby/*/gems/rainbow-*/ **/vendor/bundle-standalone/ruby/*/gems/rubocop-0*/ **/vendor/bundle-standalone/ruby/*/gems/ruby-progressbar-*/ +**/vendor/bundle-standalone/ruby/*/gems/unf_ext-*/lib +**/vendor/bundle-standalone/ruby/*/gems/unf-*/lib **/vendor/bundle-standalone/ruby/*/gems/unicode-display_width-*/ +**/vendor/bundle-standalone/ruby/*/gems/webrobots-*/lib + +# Only include the `Mechanize::HTTP::ContentDispositionParser`. +**/vendor/bundle-standalone/ruby/*/gems/mechanize-*/lib +!**/vendor/bundle-standalone/ruby/*/gems/mechanize-*/lib/mechanize/http/content_disposition_parser.rb +!**/vendor/bundle-standalone/ruby/*/gems/mechanize-*/lib/mechanize/version.rb # Ignore `bin` contents (again). /bin diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 71a4b58ad8..3e86038a75 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -5,6 +5,9 @@ require "unpack_strategy" require "lazy_object" require "cgi" +require "mechanize/version" +require "mechanize/http/content_disposition_parser" + class AbstractDownloadStrategy extend Forwardable include FileUtils @@ -363,9 +366,20 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy end end - filenames = - lines.map { |line| line[/^Content\-Disposition:\s*(?:inline|attachment);\s*filename=(["']?)([^;]+)\1/i, 2] } - .compact + content_disposition_parser = Mechanize::HTTP::ContentDispositionParser.new + + parse_content_disposition = lambda do |line| + next unless content_disposition = content_disposition_parser.parse(line, true) + + if filename_with_encoding = content_disposition.parameters["filename*"] + encoding, encoded_filename = filename_with_encoding.split("''", 2) + URI.decode_www_form_component(encoded_filename).encode(encoding) + else + content_disposition.filename + end + end + + filenames = lines.map(&parse_content_disposition).compact time = lines.map { |line| line[/^Last\-Modified:\s*(.+)/i, 1] } diff --git a/Library/Homebrew/vendor/Gemfile b/Library/Homebrew/vendor/Gemfile index 271f3ccfa1..043c518a8f 100644 --- a/Library/Homebrew/vendor/Gemfile +++ b/Library/Homebrew/vendor/Gemfile @@ -3,6 +3,7 @@ source "https://rubygems.org" gem "activesupport" gem "concurrent-ruby" gem "backports" +gem "mechanize" gem "plist" gem "ruby-macho" gem "rubocop-rspec" diff --git a/Library/Homebrew/vendor/Gemfile.lock b/Library/Homebrew/vendor/Gemfile.lock index 4b76916791..cbb0bd6da9 100644 --- a/Library/Homebrew/vendor/Gemfile.lock +++ b/Library/Homebrew/vendor/Gemfile.lock @@ -9,10 +9,34 @@ GEM ast (2.4.0) backports (3.11.4) concurrent-ruby (1.1.4) + connection_pool (2.2.2) + domain_name (0.5.20180417) + unf (>= 0.0.5, < 1.0.0) + http-cookie (1.0.3) + domain_name (~> 0.5) i18n (1.5.3) concurrent-ruby (~> 1.0) jaro_winkler (1.5.2) + mechanize (2.7.6) + domain_name (~> 0.5, >= 0.5.1) + http-cookie (~> 1.0) + mime-types (>= 1.17.2) + net-http-digest_auth (~> 1.1, >= 1.1.1) + net-http-persistent (>= 2.5.2) + nokogiri (~> 1.6) + ntlm-http (~> 0.1, >= 0.1.1) + webrobots (>= 0.0.9, < 0.2) + mime-types (3.2.2) + mime-types-data (~> 3.2015) + mime-types-data (3.2018.0812) + mini_portile2 (2.4.0) minitest (5.11.3) + net-http-digest_auth (1.4.1) + net-http-persistent (3.0.0) + connection_pool (~> 2.2) + nokogiri (1.10.1) + mini_portile2 (~> 2.4.0) + ntlm-http (0.1.1) parallel (1.13.0) parser (2.6.0.0) ast (~> 2.4.0) @@ -34,7 +58,11 @@ GEM thread_safe (0.3.6) tzinfo (1.2.5) thread_safe (~> 0.1) + unf (0.1.4) + unf_ext + unf_ext (0.0.7.5) unicode-display_width (1.4.1) + webrobots (0.1.2) PLATFORMS ruby @@ -43,6 +71,7 @@ DEPENDENCIES activesupport backports concurrent-ruby + mechanize plist rubocop rubocop-rspec diff --git a/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb b/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb index 15ec44a4a3..11e6185af5 100644 --- a/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb @@ -12,8 +12,24 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/activesupport-5.2.2/l $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ast-2.4.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/backports-3.11.4/lib" $:.unshift "#{path}/" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/connection_pool-2.2.2/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-18/2.3.0/unf_ext-0.0.7.5" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unf_ext-0.0.7.5/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unf-0.1.4/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/domain_name-0.5.20180417/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/http-cookie-1.0.3/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-18/2.3.0/jaro_winkler-1.5.2" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/jaro_winkler-1.5.2/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mime-types-data-3.2018.0812/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mime-types-3.2.2/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/net-http-digest_auth-1.4.1/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/net-http-persistent-3.0.0/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mini_portile2-2.4.0/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-18/2.3.0/nokogiri-1.10.1" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/nokogiri-1.10.1/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ntlm-http-0.1.1/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/webrobots-0.1.2/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mechanize-2.7.6/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel-1.13.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parser-2.6.0.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/plist-3.5.0/lib" diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/mechanize-2.7.6/lib/mechanize/http/content_disposition_parser.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/mechanize-2.7.6/lib/mechanize/http/content_disposition_parser.rb new file mode 100644 index 0000000000..e1ee752536 --- /dev/null +++ b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/mechanize-2.7.6/lib/mechanize/http/content_disposition_parser.rb @@ -0,0 +1,191 @@ +# coding: BINARY + +require 'strscan' +require 'time' + +class Mechanize::HTTP + ContentDisposition = Struct.new :type, :filename, :creation_date, + :modification_date, :read_date, :size, :parameters +end + +## +# Parser Content-Disposition headers that loosely follows RFC 2183. +# +# Beyond RFC 2183, this parser allows: +# +# * Missing disposition-type +# * Multiple semicolons +# * Whitespace around semicolons + +class Mechanize::HTTP::ContentDispositionParser + + attr_accessor :scanner # :nodoc: + + @parser = nil + + ## + # Parses the disposition type and params in the +content_disposition+ + # string. The "Content-Disposition:" must be removed. + + def self.parse content_disposition + @parser ||= self.new + @parser.parse content_disposition + end + + ## + # Creates a new parser Content-Disposition headers + + def initialize + @scanner = nil + end + + ## + # Parses the +content_disposition+ header. If +header+ is set to true the + # "Content-Disposition:" portion will be parsed + + def parse content_disposition, header = false + return nil if content_disposition.empty? + + @scanner = StringScanner.new content_disposition + + if header then + return nil unless @scanner.scan(/Content-Disposition/i) + return nil unless @scanner.scan(/:/) + spaces + end + + type = rfc_2045_token + @scanner.scan(/;+/) + + if @scanner.peek(1) == '=' then + @scanner.pos = 0 + type = nil + end + + disposition = Mechanize::HTTP::ContentDisposition.new type + + spaces + + return nil unless parameters = parse_parameters + + disposition.filename = parameters.delete 'filename' + disposition.creation_date = parameters.delete 'creation-date' + disposition.modification_date = parameters.delete 'modification-date' + disposition.read_date = parameters.delete 'read-date' + disposition.size = parameters.delete 'size' + disposition.parameters = parameters + + disposition + end + + ## + # Extracts disposition-parm and returns a Hash. + + def parse_parameters + parameters = {} + + while true do + return nil unless param = rfc_2045_token + param.downcase! + return nil unless @scanner.scan(/=/) + + value = case param + when /^filename$/ then + rfc_2045_value + when /^(creation|modification|read)-date$/ then + Time.rfc822 rfc_2045_quoted_string + when /^size$/ then + rfc_2045_value.to_i(10) + else + rfc_2045_value + end + + return nil unless value + + parameters[param] = value + + spaces + + break if @scanner.eos? or not @scanner.scan(/;+/) + + spaces + end + + parameters + end + + ## + # quoted-string = <"> *(qtext/quoted-pair) <"> + # qtext = , "\" & CR, + # and including linear-white-space + # quoted-pair = "\" CHAR + # + # Parses an RFC 2045 quoted-string + + def rfc_2045_quoted_string + return nil unless @scanner.scan(/"/) + + text = '' + + while true do + chunk = @scanner.scan(/[\000-\014\016-\041\043-\133\135-\177]+/) # not \r " + + if chunk then + text << chunk + + if @scanner.peek(1) == '\\' then + @scanner.get_byte + return nil if @scanner.eos? + text << @scanner.get_byte + elsif @scanner.scan(/\r\n[\t ]+/) then + text << " " + end + else + if '\\"' == @scanner.peek(2) then + @scanner.skip(/\\/) + text << @scanner.get_byte + elsif '"' == @scanner.peek(1) then + @scanner.get_byte + break + else + return nil + end + end + end + + text + end + + ## + # token := 1* + # + # Parses an RFC 2045 token + + def rfc_2045_token + @scanner.scan(/[^\000-\037\177()<>@,;:\\"\/\[\]?= ]+/) + end + + ## + # value := token / quoted-string + # + # Parses an RFC 2045 value + + def rfc_2045_value + if @scanner.peek(1) == '"' then + rfc_2045_quoted_string + else + rfc_2045_token + end + end + + ## + # 1*SP + # + # Parses spaces + + def spaces + @scanner.scan(/ +/) + end + +end + diff --git a/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/mechanize-2.7.6/lib/mechanize/version.rb b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/mechanize-2.7.6/lib/mechanize/version.rb new file mode 100644 index 0000000000..89dbfaf8a6 --- /dev/null +++ b/Library/Homebrew/vendor/bundle-standalone/ruby/2.3.0/gems/mechanize-2.7.6/lib/mechanize/version.rb @@ -0,0 +1,3 @@ +class Mechanize + VERSION = "2.7.6" +end From 51a260cf1cb467265b645f2ed7a99e7ac76fee12 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 13:18:02 +0000 Subject: [PATCH 096/199] deps: accept formula options. Also, cleanup usage of ``. As requested in comments of #5587. --- Library/Homebrew/cmd/deps.rb | 34 +++++++++++++++++++--------------- docs/Manpage.md | 15 +++++++++------ manpages/brew.1 | 13 ++++++++----- 3 files changed, 36 insertions(+), 26 deletions(-) diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index dd51f8913b..e4d661659d 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -1,13 +1,13 @@ -#: * `deps` [`--1`] [`-n`] [`--union`] [`--full-name`] [`--installed`] [`--include-build`] [`--include-optional`] [`--skip-recommended`] [`--include-requirements`] : -#: Show dependencies for . When given multiple formula arguments, -#: show the intersection of dependencies for . +#: * `deps` [`--1`] [`-n`] [`--union`] [`--full-name`] [`--installed`] [`--include-build`] [`--include-optional`] [`--skip-recommended`] [`--include-requirements`] : +#: Show dependencies for . When given multiple formula arguments, +#: show the intersection of dependencies for every formula. #: #: If `--1` is passed, only show dependencies one level down, instead of #: recursing. #: #: If `-n` is passed, show dependencies in topological order. #: -#: If `--union` is passed, show the union of dependencies for , +#: If `--union` is passed, show the union of dependencies for , #: instead of the intersection. #: #: If `--full-name` is passed, list dependencies by their full name. @@ -16,13 +16,13 @@ #: currently installed. #: #: By default, `deps` shows required and recommended dependencies for -#: . To include the `:build` type dependencies, pass `--include-build`. +#: . To include the `:build` type dependencies, pass `--include-build`. #: Similarly, pass `--include-optional` to include `:optional` dependencies or #: `--include-test` to include (non-recursive) `:test` dependencies. #: To skip `:recommended` type dependencies, pass `--skip-recommended`. #: To include requirements in addition to dependencies, pass `--include-requirements`. #: -#: * `deps` `--tree` [`--1`] [] [`--annotate`] (|`--installed`): +#: * `deps` `--tree` [`--1`] [] [`--annotate`] (|`--installed`): #: Show dependencies as a tree. When given multiple formula arguments, output #: individual trees for every formula. #: @@ -45,6 +45,9 @@ #: The placeholder is any combination of options `--include-build`, #: `--include-optional`, `--include-test`, and `--skip-recommended` as #: documented above. +#: +#: Additional options specific to may be appended to the command, +#: and can be listed with `brew options` . # The undocumented `--for-each` option will switch into the mode used by `deps --all`, # but only list dependencies for specified formula, one specified formula per line. @@ -62,17 +65,17 @@ module Homebrew def deps_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `deps` [] + `deps` [] - Show dependencies for . When given multiple formula arguments, - show the intersection of dependencies for . + Show dependencies for . When given multiple formula arguments, + show the intersection of dependencies for . EOS switch "--1", description: "Only show dependencies one level down, instead of recursing." switch "-n", description: "Show dependencies in topological order." switch "--union", - description: "Show the union of dependencies for , instead of the intersection." + description: "Show the union of dependencies for , instead of the intersection." switch "--full-name", description: "List dependencies by their full name." switch "--installed", @@ -80,15 +83,15 @@ module Homebrew switch "--all", description: "List all the dependencies for all available formuale." switch "--include-build", - description: "Show `:build` type dependencies for ." + description: "Show `:build` type dependencies for ." switch "--include-optional", - description: "Show `:optional` dependecies for ." + description: "Show `:optional` dependecies for ." switch "--include-test", - description: "Show `:test` dependencies for (non-recursive)." + description: "Show `:test` dependencies for (non-recursive)." switch "--skip-recommended", - description: "Skip `:recommended` type dependencies for ." + description: "Skip `:recommended` type dependencies for ." switch "--include-requirements", - description: "Include requirements in addition to dependencies for ." + description: "Include requirements in addition to dependencies for ." switch "--tree", description: "Show dependencies as a tree. When given multiple formula arguments "\ "output individual trees for every formula." @@ -99,6 +102,7 @@ module Homebrew switch :verbose switch :debug conflicts "--installed", "--all" + formula_options end end diff --git a/docs/Manpage.md b/docs/Manpage.md index c7e86cb8a7..0e9dcfdc09 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -79,16 +79,16 @@ these flags should only appear after a command. a bug report, you will likely be asked for this information if you do not provide it. - * `deps` [`--1`] [`-n`] [`--union`] [`--full-name`] [`--installed`] [`--include-build`] [`--include-optional`] [`--skip-recommended`] [`--include-requirements`] *`formulae`*: - Show dependencies for *`formulae`*. When given multiple formula arguments, - show the intersection of dependencies for *`formulae`*. + * `deps` [`--1`] [`-n`] [`--union`] [`--full-name`] [`--installed`] [`--include-build`] [`--include-optional`] [`--skip-recommended`] [`--include-requirements`] *`formula`*: + Show dependencies for *`formula`*. When given multiple formula arguments, + show the intersection of dependencies for every formula. If `--1` is passed, only show dependencies one level down, instead of recursing. If `-n` is passed, show dependencies in topological order. - If `--union` is passed, show the union of dependencies for *`formulae`*, + If `--union` is passed, show the union of dependencies for *`formula`*, instead of the intersection. If `--full-name` is passed, list dependencies by their full name. @@ -97,13 +97,13 @@ these flags should only appear after a command. currently installed. By default, `deps` shows required and recommended dependencies for - *`formulae`*. To include the `:build` type dependencies, pass `--include-build`. + *`formula`*. To include the `:build` type dependencies, pass `--include-build`. Similarly, pass `--include-optional` to include `:optional` dependencies or `--include-test` to include (non-recursive) `:test` dependencies. To skip `:recommended` type dependencies, pass `--skip-recommended`. To include requirements in addition to dependencies, pass `--include-requirements`. - * `deps` `--tree` [`--1`] [*`filters`*] [`--annotate`] (*`formulae`*|`--installed`): + * `deps` `--tree` [`--1`] [*`filters`*] [`--annotate`] (*`formula`*|`--installed`): Show dependencies as a tree. When given multiple formula arguments, output individual trees for every formula. @@ -127,6 +127,9 @@ these flags should only appear after a command. `--include-optional`, `--include-test`, and `--skip-recommended` as documented above. + Additional options specific to *`formula`* may be appended to the command, + and can be listed with `brew options` *`formula`*. + * `desc` *`formula`*: Display *`formula`*'s name and one-line description. diff --git a/manpages/brew.1 b/manpages/brew.1 index 00fcb0a118..0998c376f2 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -88,8 +88,8 @@ 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 -\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] [\fB\-\-include\-requirements\fR] \fIformulae\fR -Show dependencies for \fIformulae\fR\. When given multiple formula arguments, show the intersection of dependencies for \fIformulae\fR\. +\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] [\fB\-\-include\-requirements\fR] \fIformula\fR +Show dependencies for \fIformula\fR\. When given multiple formula arguments, show the intersection of dependencies for every formula\. . .IP If \fB\-\-1\fR is passed, only show dependencies one level down, instead of recursing\. @@ -98,7 +98,7 @@ If \fB\-\-1\fR is passed, only show dependencies one level down, instead of recu If \fB\-n\fR is passed, show dependencies in topological order\. . .IP -If \fB\-\-union\fR is passed, show the union of dependencies for \fIformulae\fR, instead of the intersection\. +If \fB\-\-union\fR is passed, show the union of dependencies for \fIformula\fR, instead of the intersection\. . .IP If \fB\-\-full\-name\fR is passed, list dependencies by their full name\. @@ -107,10 +107,10 @@ If \fB\-\-full\-name\fR is passed, list dependencies by their full name\. If \fB\-\-installed\fR is passed, only list those dependencies that are currently installed\. . .IP -By default, \fBdeps\fR shows required and recommended dependencies for \fIformulae\fR\. To include the \fB:build\fR type dependencies, pass \fB\-\-include\-build\fR\. Similarly, pass \fB\-\-include\-optional\fR to include \fB:optional\fR dependencies or \fB\-\-include\-test\fR to include (non\-recursive) \fB:test\fR dependencies\. To skip \fB:recommended\fR type dependencies, pass \fB\-\-skip\-recommended\fR\. To include requirements in addition to dependencies, pass \fB\-\-include\-requirements\fR\. +By default, \fBdeps\fR shows required and recommended dependencies for \fIformula\fR\. To include the \fB:build\fR type dependencies, pass \fB\-\-include\-build\fR\. Similarly, pass \fB\-\-include\-optional\fR to include \fB:optional\fR dependencies or \fB\-\-include\-test\fR to include (non\-recursive) \fB:test\fR dependencies\. To skip \fB:recommended\fR type dependencies, pass \fB\-\-skip\-recommended\fR\. To include requirements in addition to dependencies, pass \fB\-\-include\-requirements\fR\. . .TP -\fBdeps\fR \fB\-\-tree\fR [\fB\-\-1\fR] [\fIfilters\fR] [\fB\-\-annotate\fR] (\fIformulae\fR|\fB\-\-installed\fR) +\fBdeps\fR \fB\-\-tree\fR [\fB\-\-1\fR] [\fIfilters\fR] [\fB\-\-annotate\fR] (\fIformula\fR|\fB\-\-installed\fR) Show dependencies as a tree\. When given multiple formula arguments, output individual trees for every formula\. . .IP @@ -132,6 +132,9 @@ Show dependencies for installed or all available formulae\. Every line of output .IP The \fIfilters\fR placeholder is any combination of options \fB\-\-include\-build\fR, \fB\-\-include\-optional\fR, \fB\-\-include\-test\fR, and \fB\-\-skip\-recommended\fR as documented above\. . +.IP +Additional options specific to \fIformula\fR may be appended to the command, and can be listed with \fBbrew options\fR \fIformula\fR\. +. .TP \fBdesc\fR \fIformula\fR Display \fIformula\fR\'s name and one\-line description\. From 0fff6e0c09f2d1bdf9d1486b193840f0b1bc356e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:33:30 +0000 Subject: [PATCH 097/199] man: improve manpage output. --- Library/Homebrew/dev-cmd/man.rb | 89 +++++++++++++++------------------ 1 file changed, 40 insertions(+), 49 deletions(-) diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index 135081e227..c63b32857c 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -11,24 +11,8 @@ require "formula" require "erb" require "ostruct" require "cli_parser" -require "dev-cmd/audit" -require "dev-cmd/bottle" -require "dev-cmd/bump-formula-pr" -require "dev-cmd/create" -require "dev-cmd/edit" -require "dev-cmd/extract" -require "dev-cmd/formula" -require "dev-cmd/irb" -require "dev-cmd/linkage" -require "dev-cmd/mirror" -require "dev-cmd/prof" -require "dev-cmd/pull" -require "dev-cmd/release-notes" -require "dev-cmd/ruby" -require "dev-cmd/tap-new" -require "dev-cmd/test" -require "dev-cmd/tests" -require "dev-cmd/update-test" +# Require all commands +Dir.glob("#{HOMEBREW_LIBRARY_PATH}/{dev-,}cmd/*.rb").each { |cmd| require cmd } module Homebrew module_function @@ -83,22 +67,14 @@ module Homebrew convert_man_page(cask_markup, TARGET_MAN_PATH/"brew-cask.1") end - def path_glob_commands(glob) - Pathname.glob(glob) - .sort_by { |source_file| sort_key_for_path(source_file) } - .map(&:read).map(&:lines) - .map { |lines| lines.grep(/^#:/).map { |line| line.slice(2..-1) }.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[:commands] = generate_cmd_manpages("#{HOMEBREW_LIBRARY_PATH}/cmd/*.{rb,sh}") + variables[:developer_commands] = generate_cmd_manpages("#{HOMEBREW_LIBRARY_PATH}/dev-cmd/{*.rb,sh}") + variables[:global_options] = global_options_manpage - variables[:developer_commands] = generate_cmd_manpages("#{HOMEBREW_LIBRARY_PATH}/dev-cmd/*.{rb,sh}") - variables[:global_options] = global_options_manpage_lines readme = HOMEBREW_REPOSITORY/"README.md" variables[:lead_maintainer] = readme.read[/(Homebrew's lead maintainer .*\.)/, 1] @@ -119,9 +95,6 @@ module Homebrew readme.read[/(Former maintainers .*\.)/, 1] .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') - variables[:homebrew_bundle] = help_output(:bundle) - variables[:homebrew_services] = help_output(:services) - ERB.new(template, nil, ">").result(variables.instance_eval { binding }) end @@ -162,6 +135,7 @@ module Homebrew odie "Got no output from ronn!" unless ronn_output if format_flag == "--markdown" ronn_output = ronn_output.gsub(%r{(.*?)}, "*`\\1`*") + .gsub(/\n\n\n+/, "\n\n") elsif format_flag == "--roff" ronn_output = ronn_output.gsub(%r{(.*?)}, "\\fB\\1\\fR") .gsub(%r{(.*?)}, "\\fI\\1\\fR") @@ -171,12 +145,6 @@ module Homebrew end end - def help_output(command) - tap = Tap.fetch("Homebrew/homebrew-#{command}") - tap.install unless tap.installed? - command_help_lines(which("brew-#{command}.rb", Tap.cmd_directories)) - end - def target_path_to_format(target) case target.basename when /\.md$/ then ["--markdown", "markdown"] @@ -190,38 +158,61 @@ module Homebrew cmd_paths = Pathname.glob(glob).sort man_page_lines = [] man_args = Homebrew.args - cmd_paths.each do |cmd_path| - begin - cmd_parser = Homebrew.send(cmd_arg_parser(cmd_path)) - man_page_lines << cmd_manpage_lines(cmd_parser).join - rescue NoMethodError - man_page_lines << path_glob_commands(cmd_path.to_s).first + # preserve existing manpage order + cmd_paths.sort_by(&method(:sort_key_for_path)) + .each do |cmd_path| + cmd_args_method_name = cmd_arg_parser(cmd_path) + + cmd_man_page_lines = begin + cmd_parser = Homebrew.send(cmd_args_method_name) + next if cmd_parser.hide_from_man_page + cmd_parser_manpage_lines(cmd_parser).join + rescue NoMethodError => e + raise if e.name != cmd_args_method_name + nil end + cmd_man_page_lines ||= cmd_comment_manpage_lines(cmd_path) + + man_page_lines << cmd_man_page_lines end Homebrew.args = man_args - man_page_lines + man_page_lines.compact.join("\n") end def cmd_arg_parser(cmd_path) "#{cmd_path.basename.to_s.gsub(".rb", "").tr("-", "_")}_args".to_sym end - def cmd_manpage_lines(cmd_parser) + def cmd_parser_manpage_lines(cmd_parser) lines = [format_usage_banner(cmd_parser.usage_banner_text)] lines += cmd_parser.processed_options.map do |short, long, _, desc| next if !long.nil? && cmd_parser.global_option?(cmd_parser.option_to_name(long)) generate_option_doc(short, long, desc) + end.reject(&:blank?) + lines + end + + def cmd_comment_manpage_lines(cmd_path) + comment_lines = cmd_path.read.lines.grep(/^#:/) + return if comment_lines.empty? + return if comment_lines.first.include?("@hide_from_man_page") + lines = [format_usage_banner(comment_lines.first).chomp] + comment_lines.slice(1..-1) + .each do |line| + line = line.slice(4..-1) + next unless line + lines << line.gsub(/^ +(-+[a-z-]+) */, "* `\\1`:\n ") end lines end - def global_options_manpage_lines + def global_options_manpage lines = ["These options are applicable across all sub-commands.\n"] lines += Homebrew::CLI::Parser.global_options.values.map do |names, _, desc| short, long = names generate_option_doc(short, long, desc) end - lines + lines.join("\n") end def generate_option_doc(short, long, desc) @@ -238,6 +229,6 @@ module Homebrew end def format_usage_banner(usage_banner) - usage_banner.sub(/^/, "### ") + usage_banner&.sub(/^(#: *\* )?/, "### ") end end From 8fca70e76bdd643e246c103057c77c94f79fed8f Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:29:21 +0000 Subject: [PATCH 098/199] --cache: use CLI::Parser. --- Library/Homebrew/cmd/--cache.rb | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/cmd/--cache.rb b/Library/Homebrew/cmd/--cache.rb index 9298bdb455..812a093319 100644 --- a/Library/Homebrew/cmd/--cache.rb +++ b/Library/Homebrew/cmd/--cache.rb @@ -1,15 +1,29 @@ -#: * `--cache`: -#: Display Homebrew's download cache. See also `HOMEBREW_CACHE`. -#: -#: * `--cache` [`--build-from-source`|`-s`] [`--force-bottle`] : -#: Display the file or directory used to cache . - require "fetch" +require "cli_parser" module Homebrew module_function + def __cache_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `--cache` [] [] + + Display Homebrew's download cache. See also `HOMEBREW_CACHE`. + + If is provided, display the file or directory used to cache . + EOS + switch "-s", "--build-from-source", + description: "Show the cache file used when building from source." + switch "--force-bottle", + description: "Show the cache file used when pouring a bottle." + conflicts "--build-from-source", "--force-bottle" + end + end + def __cache + __cache_args.parse + if ARGV.named.empty? puts HOMEBREW_CACHE else From 93799ba71ab933966ad34b564024f6b70515269d Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:29:30 +0000 Subject: [PATCH 099/199] --cellar: use CLI::Parser. --- Library/Homebrew/cmd/--cellar.rb | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/Library/Homebrew/cmd/--cellar.rb b/Library/Homebrew/cmd/--cellar.rb index f35847ead6..94547416c1 100644 --- a/Library/Homebrew/cmd/--cellar.rb +++ b/Library/Homebrew/cmd/--cellar.rb @@ -1,15 +1,25 @@ -#: * `--cellar`: -#: Display Homebrew's Cellar path. *Default:* `$(brew --prefix)/Cellar`, or if -#: that directory doesn't exist, `$(brew --repository)/Cellar`. -#: -#: * `--cellar` : -#: Display the location in the cellar where would be installed, -#: without any sort of versioned directory as the last path. +require "cli_parser" module Homebrew module_function + def __cellar_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `--cache` [] + + Display Homebrew's Cellar path. *Default:* `$(brew --prefix)/Cellar`, or if + that directory doesn't exist, `$(brew --repository)/Cellar`. + + If is provided, display the location in the cellar where + would be installed, without any sort of versioned directory as the last path. + EOS + end + end + def __cellar + __cellar_args.parse + if ARGV.named.empty? puts HOMEBREW_CELLAR else From 515d4c023db0894a3d57c08c20ec31c9adddc057 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:29:37 +0000 Subject: [PATCH 100/199] --env: use CLI::Parser. --- Library/Homebrew/cmd/--env.rb | 48 +++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/Library/Homebrew/cmd/--env.rb b/Library/Homebrew/cmd/--env.rb index 3d45a8fec7..c0dc3c0dd3 100644 --- a/Library/Homebrew/cmd/--env.rb +++ b/Library/Homebrew/cmd/--env.rb @@ -1,36 +1,46 @@ -#: * `--env` [`--shell=`(|`auto`)|`--plain`]: -#: Show a summary of the Homebrew build environment as a plain list. -#: -#: Pass `--shell=` to generate a list of environment variables for the -#: specified shell, or `--shell=auto` to detect the current shell. -#: -#: If the command's output is sent through a pipe and no shell is specified, -#: the list is formatted for export to `bash`(1) unless `--plain` is passed. - require "extend/ENV" require "build_environment" require "utils/shell" +require "cli_parser" module Homebrew module_function + def __env_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `--env` [] + + Show a summary of the Homebrew build environment as a plain list. + + If the command's output is sent through a pipe and no shell is specified, + the list is formatted for export to `bash`(1) unless `--plain` is passed. + EOS + flag "--shell=", + description: "Generate a list of environment variables for the specified shell, " \ + "or `--shell=auto` to detect the current shell." + switch "--plain", + description: "Plain output even when piped." + end + end + def __env + __env_args.parse + ENV.activate_extensions! ENV.deps = ARGV.formulae if superenv? ENV.setup_build_environment ENV.universal_binary if ARGV.build_universal? - shell_value = ARGV.value("shell") - - if ARGV.include?("--plain") - shell = nil - elsif shell_value.nil? + shell = if args.plain? + nil + elsif args.shell.nil? # legacy behavior - shell = :bash unless $stdout.tty? - elsif shell_value == "auto" - shell = Utils::Shell.parent || Utils::Shell.preferred - elsif shell_value - shell = Utils::Shell.from_path(shell_value) + :bash unless $stdout.tty? + elsif args.shell == "auto" + Utils::Shell.parent || Utils::Shell.preferred + elsif args.shell + Utils::Shell.from_path(args.shell) end env_keys = build_env_keys(ENV) From b521ba0c7a6a9eddeb0b2f7b57fdd3163eb80bfd Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:29:43 +0000 Subject: [PATCH 101/199] --prefix: use CLI::Parser. --- Library/Homebrew/cmd/--prefix.rb | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/cmd/--prefix.rb b/Library/Homebrew/cmd/--prefix.rb index 4a5e0ba77c..fb98235dcf 100644 --- a/Library/Homebrew/cmd/--prefix.rb +++ b/Library/Homebrew/cmd/--prefix.rb @@ -1,13 +1,25 @@ -#: * `--prefix`: -#: Display Homebrew's install path. *Default:* `/usr/local` on macOS and `/home/linuxbrew/.linuxbrew` on Linux -#: -#: * `--prefix` : -#: Display the location in the cellar where is or would be installed. +require "cli_parser" module Homebrew module_function + def __prefix_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `--prefix` [] + + Display Homebrew's install path. *Default:* `/usr/local` on macOS and + `/home/linuxbrew/.linuxbrew` on Linux. + + If is provided, display the location in the cellar where + is or would be installed. + EOS + end + end + def __prefix + __prefix_args.parse + if ARGV.named.empty? puts HOMEBREW_PREFIX else From 7b905399432a5b798ce7886fca7897b597dbdc5e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:29:49 +0000 Subject: [PATCH 102/199] --repository: use CLI::Parser. --- Library/Homebrew/cmd/--repository.rb | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/cmd/--repository.rb b/Library/Homebrew/cmd/--repository.rb index 6f6f8d31ec..4ae25e5983 100644 --- a/Library/Homebrew/cmd/--repository.rb +++ b/Library/Homebrew/cmd/--repository.rb @@ -1,13 +1,23 @@ -#: * `--repository`: -#: Display where Homebrew's `.git` directory is located. -#: -#: * `--repository` `/`: -#: Display where tap `/`'s directory is located. +require "cli_parser" module Homebrew module_function + def __repository_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `--repository` [] + + Display where Homebrew's `.git` directory is located. + + If `/` are provided, display where tap `/`'s directory is located. + EOS + end + end + def __repository + __repository_args.parse + if ARGV.named.empty? puts HOMEBREW_REPOSITORY else From dbd8de71489c7cbc64d5ee5ee58917f96a69a447 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:29:54 +0000 Subject: [PATCH 103/199] --version: use CLI::Parser. --- Library/Homebrew/cmd/--version.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/cmd/--version.rb b/Library/Homebrew/cmd/--version.rb index a05369e25b..bd4a222821 100644 --- a/Library/Homebrew/cmd/--version.rb +++ b/Library/Homebrew/cmd/--version.rb @@ -1,10 +1,22 @@ -#: * `--version`: -#: Print the version number of Homebrew to standard output and exit. +require "cli_parser" module Homebrew module_function + def __version_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `--version` + + Print the version number of Homebrew, Homebrew/homebrew-core and Homebrew/homebrew-cask + (if tapped) to standard output and exit. + EOS + end + end + def __version + __version_args.parse + odie "This command does not take arguments." if ARGV.any? puts "Homebrew #{HOMEBREW_VERSION}" From 91446259401f7dcb348bb82cc0dc9d835164d705 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:30:18 +0000 Subject: [PATCH 104/199] log: use CLI::Parser. --- Library/Homebrew/cmd/log.rb | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/cmd/log.rb b/Library/Homebrew/cmd/log.rb index 898e921ba7..e1fd65b09c 100644 --- a/Library/Homebrew/cmd/log.rb +++ b/Library/Homebrew/cmd/log.rb @@ -1,13 +1,30 @@ -#: * `log` [] ...: -#: Show the git log for the given formulae. Options that `git-log`(1) -#: recognizes can be passed before the formula list. - require "formula" +require "cli_parser" module Homebrew module_function + def log_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `log` [] + + Show the `git log` for the given . + EOS + switch "-p", "-u", "--patch", + description: "Also output patch from commit." + switch "--stat", + description: "Also output diffstat from commit." + switch "--oneline", + description: "Output only one line per commit." + switch "-1", "--max-count=1", + description: "Output only one commit." + end + end + def log + log_args.parse + if ARGV.named.empty? git_log HOMEBREW_REPOSITORY else From 04f3ca78c0f40ad882aa186df2a51023a3d82fa2 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:30:45 +0000 Subject: [PATCH 105/199] update-report: use CLI::Parser. --- Library/Homebrew/cmd/update-report.rb | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb index 7bacd47ca2..92497f6972 100644 --- a/Library/Homebrew/cmd/update-report.rb +++ b/Library/Homebrew/cmd/update-report.rb @@ -1,7 +1,3 @@ -#: @hide_from_man_page -#: * `update_report` [`--preinstall`]: -#: The Ruby implementation of `brew update`. Never called manually. - require "formula_versions" require "migrator" require "formulary" @@ -19,7 +15,25 @@ module Homebrew end end + def update_report_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `update_report` [`--preinstall`] + + The Ruby implementation of `brew update`. Never called manually. + EOS + switch "--preinstall", + description: "Run in 'auto-update' mode (faster, less output)." + switch :force + switch :debug + switch :verbose + hide_from_man_page! + end + end + def update_report + update_report_args.parse + HOMEBREW_REPOSITORY.cd do analytics_message_displayed = Utils.popen_read("git", "config", "--local", "--get", "homebrew.analyticsmessage").chomp == "true" From 2a676dd94caef33322d4a757cf0a91c23602236a Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:31:33 +0000 Subject: [PATCH 106/199] shellenv: improve --help formatting. --- Library/Homebrew/cmd/shellenv.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Library/Homebrew/cmd/shellenv.sh b/Library/Homebrew/cmd/shellenv.sh index 57627dc243..e0aa7d4260 100644 --- a/Library/Homebrew/cmd/shellenv.sh +++ b/Library/Homebrew/cmd/shellenv.sh @@ -1,12 +1,10 @@ -#: * `shellenv`: -#: Prints export statements - run them in a shell and this installation of -#: Homebrew will be included into your PATH, MANPATH, and INFOPATH. +#: * `shellenv` #: -#: HOMEBREW_PREFIX, HOMEBREW_CELLAR and HOMEBREW_REPOSITORY are also exported -#: to save multiple queries of those variables. +#: Prints export statements - run them in a shell and this installation of Homebrew will be included into your `PATH`, `MANPATH` and `INFOPATH`. #: -#: Consider adding evaluating the output in your dotfiles (e.g. `~/.profile`) -#: with `eval $(brew shellenv)` +#: `HOMEBREW_PREFIX`, `HOMEBREW_CELLAR` and `HOMEBREW_REPOSITORY` are also exported to save multiple queries of those variables. +#: +#: Consider adding evaluating the output in your dotfiles (e.g. `~/.profile`) with `eval $(brew shellenv)` homebrew-shellenv() { echo "export HOMEBREW_PREFIX=\"$HOMEBREW_PREFIX\"" From 2b285f23c2bb32fca87fd54ef3698f0642f92f91 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:31:45 +0000 Subject: [PATCH 107/199] update-reset: improve --help formatting. --- Library/Homebrew/cmd/update-reset.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/cmd/update-reset.sh b/Library/Homebrew/cmd/update-reset.sh index 60aa47bed6..7e1d44b93d 100644 --- a/Library/Homebrew/cmd/update-reset.sh +++ b/Library/Homebrew/cmd/update-reset.sh @@ -1,7 +1,6 @@ -#: * `update-reset` []: -#: Fetches and resets Homebrew and all tap repositories (or the specified -#: `repositories`) using `git`(1) to their latest `origin/master`. Note this -#: will destroy all your uncommitted or committed changes. +#: * `update-reset` [] +#: +#: Fetches and resets Homebrew and all tap repositories (or any specified `repository`) using `git`(1) to their latest `origin/master`. Note this will destroy all your uncommitted or committed changes. homebrew-update-reset() { local DIR From 172326a0cf9fb06ead9d5f4ee156b03d45d6ed3e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:31:56 +0000 Subject: [PATCH 108/199] update: improve --help formatting. --- Library/Homebrew/cmd/update.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index eefe5df2a5..80384da032 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -1,12 +1,9 @@ -#: * `update` [`--merge`] [`--force`]: -#: Fetch the newest version of Homebrew and all formulae from GitHub using -#: `git`(1) and perform any necessary migrations. +#: * `update` [] #: -#: If `--merge` is specified then `git merge` is used to include updates -#: (rather than `git rebase`). +#: Fetch the newest version of Homebrew and all formulae from GitHub using `git`(1) and perform any necessary migrations. #: -#: If `--force` (or `-f`) is specified then always do a slower, full update check even -#: if unnecessary. +#: --merge `git merge` is used to include updates (rather than `git rebase`). +#: --force Always do a slower, full update check (even if unnecessary). # Don't need shellcheck to follow this `source`. # shellcheck disable=SC1090 From 96c1dffb7120844802cf228ed6c690c559ef6fcb Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:32:05 +0000 Subject: [PATCH 109/199] vendor-install: improve --help formatting. --- Library/Homebrew/cmd/vendor-install.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/cmd/vendor-install.sh b/Library/Homebrew/cmd/vendor-install.sh index 83c460ea45..afff156f6a 100644 --- a/Library/Homebrew/cmd/vendor-install.sh +++ b/Library/Homebrew/cmd/vendor-install.sh @@ -1,6 +1,7 @@ #: @hide_from_man_page -#: * `vendor-install` []: -#: Install vendor version of Homebrew dependencies. +#: * `vendor-install` [] +#: +#: Install Homebrew's portable Ruby. # Don't need shellcheck to follow this `source`. # shellcheck disable=SC1090 From 6cb7a00f2d09c69702fae8ea58f08509ab50c325 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:32:35 +0000 Subject: [PATCH 110/199] cmd: remove --help headers and tweak docs. --- Library/Homebrew/cmd/analytics.rb | 10 ---- Library/Homebrew/cmd/cat.rb | 3 -- Library/Homebrew/cmd/cleanup.rb | 17 +------ Library/Homebrew/cmd/command.rb | 3 -- Library/Homebrew/cmd/commands.rb | 6 --- Library/Homebrew/cmd/config.rb | 5 -- Library/Homebrew/cmd/deps.rb | 61 +---------------------- Library/Homebrew/cmd/desc.rb | 10 ---- Library/Homebrew/cmd/diy.rb | 10 ---- Library/Homebrew/cmd/doctor.rb | 15 ++---- Library/Homebrew/cmd/fetch.rb | 32 ++---------- Library/Homebrew/cmd/gist-logs.rb | 18 +------ Library/Homebrew/cmd/home.rb | 6 --- Library/Homebrew/cmd/info.rb | 40 +-------------- Library/Homebrew/cmd/install.rb | 75 +---------------------------- Library/Homebrew/cmd/leaves.rb | 3 -- Library/Homebrew/cmd/link.rb | 16 +----- Library/Homebrew/cmd/list.rb | 26 ++-------- Library/Homebrew/cmd/migrate.rb | 13 ++--- Library/Homebrew/cmd/missing.rb | 13 +---- Library/Homebrew/cmd/options.rb | 14 +----- Library/Homebrew/cmd/outdated.rb | 21 +------- Library/Homebrew/cmd/pin.rb | 10 ++-- Library/Homebrew/cmd/postinstall.rb | 3 -- Library/Homebrew/cmd/prune.rb | 4 +- Library/Homebrew/cmd/readall.rb | 15 +----- Library/Homebrew/cmd/reinstall.rb | 30 +----------- Library/Homebrew/cmd/search.rb | 21 +------- Library/Homebrew/cmd/sh.rb | 9 ---- Library/Homebrew/cmd/style.rb | 23 +-------- Library/Homebrew/cmd/switch.rb | 3 -- Library/Homebrew/cmd/tap-info.rb | 23 ++------- Library/Homebrew/cmd/tap-pin.rb | 6 +-- Library/Homebrew/cmd/tap-unpin.rb | 5 +- Library/Homebrew/cmd/tap.rb | 34 ------------- Library/Homebrew/cmd/uninstall.rb | 11 +---- Library/Homebrew/cmd/unlink.rb | 8 --- Library/Homebrew/cmd/unpack.rb | 19 ++------ Library/Homebrew/cmd/unpin.rb | 8 +-- Library/Homebrew/cmd/untap.rb | 3 -- Library/Homebrew/cmd/upgrade.rb | 43 +---------------- Library/Homebrew/cmd/uses.rb | 42 +++++----------- 42 files changed, 63 insertions(+), 674 deletions(-) diff --git a/Library/Homebrew/cmd/analytics.rb b/Library/Homebrew/cmd/analytics.rb index 9aeb179d0e..a6824e96cd 100644 --- a/Library/Homebrew/cmd/analytics.rb +++ b/Library/Homebrew/cmd/analytics.rb @@ -1,13 +1,3 @@ -#: * `analytics` [`state`]: -#: Display anonymous user behaviour analytics state. -#: Read more at . -#: -#: * `analytics` (`on`|`off`): -#: Turn on/off Homebrew's analytics. -#: -#: * `analytics` `regenerate-uuid`: -#: Regenerate UUID used in Homebrew's analytics. - require "cli_parser" module Homebrew diff --git a/Library/Homebrew/cmd/cat.rb b/Library/Homebrew/cmd/cat.rb index 5cf7077cc9..b7cfb1af96 100644 --- a/Library/Homebrew/cmd/cat.rb +++ b/Library/Homebrew/cmd/cat.rb @@ -1,6 +1,3 @@ -#: * `cat` : -#: Display the source to . - require "cli_parser" module Homebrew diff --git a/Library/Homebrew/cmd/cleanup.rb b/Library/Homebrew/cmd/cleanup.rb index 751eef4fea..5a6f957928 100644 --- a/Library/Homebrew/cmd/cleanup.rb +++ b/Library/Homebrew/cmd/cleanup.rb @@ -1,17 +1,3 @@ -#: * `cleanup` [`--prune=`] [`--dry-run`] [`-s`] [|]: -#: Remove stale lock files and outdated downloads for formulae and casks, -#: and remove old versions of installed formulae. If arguments are specified, -#: only do this for the specified formulae and casks. -#: -#: If `--prune=` is specified, remove all cache files older than . -#: -#: If `--dry-run` or `-n` is passed, show what would be removed, but do not -#: actually remove anything. -#: -#: If `-s` is passed, scrub the cache, including downloads for even the latest -#: versions. Note downloads for any installed formula or cask will still not -#: be deleted. If you want to delete those too: `rm -rf "$(brew --cache)"` - require "cleanup" require "cli_parser" @@ -21,8 +7,7 @@ module Homebrew def cleanup_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `cleanup` [] [|] - + `cleanup` [] [|] Remove stale lock files and outdated downloads for formulae and casks, and remove old versions of installed formulae. If arguments are specified, diff --git a/Library/Homebrew/cmd/command.rb b/Library/Homebrew/cmd/command.rb index 9d468ee582..08d5b51c80 100644 --- a/Library/Homebrew/cmd/command.rb +++ b/Library/Homebrew/cmd/command.rb @@ -1,6 +1,3 @@ -#: * `command` : -#: Display the path to the file which is used when invoking `brew` . - require "commands" require "cli_parser" diff --git a/Library/Homebrew/cmd/commands.rb b/Library/Homebrew/cmd/commands.rb index adb29038a1..66b4466331 100644 --- a/Library/Homebrew/cmd/commands.rb +++ b/Library/Homebrew/cmd/commands.rb @@ -1,9 +1,3 @@ -#: * `commands` [`--quiet` [`--include-aliases`]]: -#: Show a list of built-in and external commands. -#: -#: If `--quiet` is passed, list only the names of commands without the header. -#: With `--include-aliases`, the aliases of internal commands will be included. - require "cli_parser" module Homebrew diff --git a/Library/Homebrew/cmd/config.rb b/Library/Homebrew/cmd/config.rb index 44b6ec6198..492a6d47a8 100644 --- a/Library/Homebrew/cmd/config.rb +++ b/Library/Homebrew/cmd/config.rb @@ -1,8 +1,3 @@ -#: * `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. - require "system_config" require "cli_parser" diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index e4d661659d..239e300d47 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -1,60 +1,3 @@ -#: * `deps` [`--1`] [`-n`] [`--union`] [`--full-name`] [`--installed`] [`--include-build`] [`--include-optional`] [`--skip-recommended`] [`--include-requirements`] : -#: Show dependencies for . When given multiple formula arguments, -#: show the intersection of dependencies for every formula. -#: -#: If `--1` is passed, only show dependencies one level down, instead of -#: recursing. -#: -#: If `-n` is passed, show dependencies in topological order. -#: -#: If `--union` is passed, show the union of dependencies for , -#: instead of the intersection. -#: -#: If `--full-name` is passed, list dependencies by their full name. -#: -#: If `--installed` is passed, only list those dependencies that are -#: currently installed. -#: -#: By default, `deps` shows required and recommended dependencies for -#: . To include the `:build` type dependencies, pass `--include-build`. -#: Similarly, pass `--include-optional` to include `:optional` dependencies or -#: `--include-test` to include (non-recursive) `:test` dependencies. -#: To skip `:recommended` type dependencies, pass `--skip-recommended`. -#: To include requirements in addition to dependencies, pass `--include-requirements`. -#: -#: * `deps` `--tree` [`--1`] [] [`--annotate`] (|`--installed`): -#: Show dependencies as a tree. When given multiple formula arguments, output -#: individual trees for every formula. -#: -#: If `--1` is passed, only one level of children is displayed. -#: -#: If `--installed` is passed, output a tree for every installed formula. -#: -#: The placeholder is any combination of options `--include-build`, -#: `--include-optional`, `--include-test`, `--skip-recommended`, and -#: `--include-requirements` as documented above. -#: -#: If `--annotate` is passed, the build, optional, and recommended dependencies -#: are marked as such in the output. -#: -#: * `deps` [] (`--installed`|`--all`): -#: Show dependencies for installed or all available formulae. Every line of -#: output starts with the formula name, followed by a colon and all direct -#: dependencies of that formula. -#: -#: The placeholder is any combination of options `--include-build`, -#: `--include-optional`, `--include-test`, and `--skip-recommended` as -#: documented above. -#: -#: Additional options specific to may be appended to the command, -#: and can be listed with `brew options` . - -# The undocumented `--for-each` option will switch into the mode used by `deps --all`, -# but only list dependencies for specified formula, one specified formula per line. -# This is used for debugging the `--installed`/`--all` display mode. - -# encoding: UTF-8 - require "formula" require "ostruct" require "cli_parser" @@ -81,11 +24,11 @@ module Homebrew switch "--installed", description: "Only list those dependencies that are currently installed." switch "--all", - description: "List all the dependencies for all available formuale." + description: "List all the dependencies for all available formulae." switch "--include-build", description: "Show `:build` type dependencies for ." switch "--include-optional", - description: "Show `:optional` dependecies for ." + description: "Show `:optional` dependencies for ." switch "--include-test", description: "Show `:test` dependencies for (non-recursive)." switch "--skip-recommended", diff --git a/Library/Homebrew/cmd/desc.rb b/Library/Homebrew/cmd/desc.rb index 5e9c972272..32538e0b47 100644 --- a/Library/Homebrew/cmd/desc.rb +++ b/Library/Homebrew/cmd/desc.rb @@ -1,13 +1,3 @@ -#: * `desc` : -#: Display 's name and one-line description. -#: -#: * `desc` [`--search`|`--name`|`--description`] (|`/``/`): -#: Search both name and description (`--search` or `-s`), just the names -#: (`--name` or `-n`), or just the descriptions (`--description` or `-d`) for -#: . If is flanked by slashes, it is interpreted as a regular -#: expression. Formula descriptions are cached; the cache is created on the -#: first search, making that search slower than subsequent ones. - require "descriptions" require "search" require "description_cache_store" diff --git a/Library/Homebrew/cmd/diy.rb b/Library/Homebrew/cmd/diy.rb index f0c2f75f76..5b8c21f284 100644 --- a/Library/Homebrew/cmd/diy.rb +++ b/Library/Homebrew/cmd/diy.rb @@ -1,13 +1,3 @@ -#: * `diy` [`--name=`] [`--version=`]: -#: Automatically determine the installation prefix for non-Homebrew software. -#: -#: Using the output from this command, you can install your own software into -#: the Cellar and then link it into Homebrew's prefix with `brew link`. -#: -#: The options `--name=` and `--version=` each take an argument -#: and allow you to explicitly set the name and version of the package you are -#: installing. - require "formula" require "cli_parser" diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index eeb7a1918f..4b18a3c7b1 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -1,14 +1,3 @@ -#: * `doctor`: -#: Check your system for potential problems. Doctor exits with a non-zero status -#: if any potential problems are found. Please note that these warnings are just -#: used to help the Homebrew maintainers with debugging if you file an issue. If -#: everything you use Homebrew for is working fine: please don't worry or file -#: an issue; just ignore this. - -# Undocumented options: -# `-D` activates debugging and profiling of the audit methods (not the same as `--debug`) -# `--list-checks` lists all audit methods - require "diagnostic" require "cli_parser" @@ -32,6 +21,10 @@ module Homebrew description: "Enable debugging and profiling of audit methods." switch :verbose switch :debug + + # Undocumented options: + # `-D` activates debugging and profiling of the doctor methods (not the same as `--debug`) + # `--list-checks` lists all doctor methods end end diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb index 84a8e2bc24..07dc67e576 100644 --- a/Library/Homebrew/cmd/fetch.rb +++ b/Library/Homebrew/cmd/fetch.rb @@ -1,27 +1,3 @@ -#: * `fetch` [`--force`] [`--retry`] [`-v`] [`--devel`|`--HEAD`] [`--deps`] [`--build-from-source`|`--force-bottle`] : -#: Download the source packages for the given . -#: For tarballs, also print SHA-256 checksums. -#: -#: If `--HEAD` or `--devel` is passed, fetch that version instead of the -#: stable version. -#: -#: If `-v` is passed, do a verbose VCS checkout, if the URL represents a VCS. -#: This is useful for seeing if an existing VCS cache has been updated. -#: -#: If `--force` (or `-f`) is passed, remove a previously cached version and re-fetch. -#: -#: If `--retry` is passed, retry if a download fails or re-download if the -#: checksum of a previously cached version no longer matches. -#: -#: If `--deps` is passed, also download dependencies for any listed . -#: -#: If `--build-from-source` (or `-s`) or `--build-bottle` is passed, download the -#: source rather than a bottle. -#: -#: If `--force-bottle` is passed, download a bottle if it exists for the -#: current or newest version of macOS, even if it would not be used during -#: installation. - require "formula" require "fetch" require "cli_parser" @@ -32,15 +8,15 @@ module Homebrew def fetch_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `fetch` [] + `fetch` [] - Download the source packages for the given . + Download the source packages for the given . For tarballs, also print SHA-256 checksums. EOS switch "--HEAD", description: "Fetch HEAD version instead of stable version." switch "--devel", - description: "Fetch devel version instead of stable version." + description: "Fetch development version instead of stable version." switch :verbose, description: "Do a verbose VCS checkout, if the URL represents a VCS. This is useful for "\ "seeing if an existing VCS cache has been updated." @@ -50,7 +26,7 @@ module Homebrew description: "Retry if a download fails or re-download if the checksum of a previously cached "\ "version no longer matches." switch "--deps", - description: "Download dependencies for any listed ." + description: "Download dependencies for any listed ." switch "-s", "--build-from-source", description: "Download the source for rather than a bottle." switch "--build-bottle", diff --git a/Library/Homebrew/cmd/gist-logs.rb b/Library/Homebrew/cmd/gist-logs.rb index 28875abfca..66cb1dffe6 100644 --- a/Library/Homebrew/cmd/gist-logs.rb +++ b/Library/Homebrew/cmd/gist-logs.rb @@ -1,19 +1,3 @@ -#: * `gist-logs` [`--new-issue`|`-n`] [`--private`|`-p`] : -#: Upload logs for a failed build of to a new Gist. -#: -#: is usually the name of the formula to install, but it can be specified -#: in several different ways. -#: -#: If `--with-hostname` is passed, include the hostname in the Gist. -#: -#: If `--new-issue` is passed, automatically create a new issue in the appropriate -#: GitHub repository as well as creating the Gist. -#: -#: If `--private` is passed, the Gist will be marked private and will not -#: appear in listings but will be accessible with the link. -#: -#: If no logs are found, an error message is presented. - require "formula" require "install" require "system_config" @@ -27,7 +11,7 @@ module Homebrew def gist_logs_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `gist-logs` [] : + `gist-logs` [] Upload logs for a failed build of to a new Gist. diff --git a/Library/Homebrew/cmd/home.rb b/Library/Homebrew/cmd/home.rb index 145a23dda9..a9e1df4a86 100644 --- a/Library/Homebrew/cmd/home.rb +++ b/Library/Homebrew/cmd/home.rb @@ -1,9 +1,3 @@ -#: * `home`: -#: Open Homebrew's own homepage in a browser. -#: -#: * `home` : -#: Open 's homepage in a browser. - require "cli_parser" module Homebrew diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb index 3693a6cba9..c13b62f8db 100644 --- a/Library/Homebrew/cmd/info.rb +++ b/Library/Homebrew/cmd/info.rb @@ -1,39 +1,3 @@ -#: * `info`: -#: Display brief statistics for your Homebrew installation. -#: -#: * `info` `--analytics` [`--days=`] [`--category=`]: -#: Display Homebrew analytics data (provided neither `HOMEBREW_NO_ANALYTICS` -#: or `HOMEBREW_NO_GITHUB_API` are set) -#: -#: The value for `days` must be `30`, `90` or `365`. The default is `30`. -#: -#: The value for `category` must be `install`, `install-on-request`, -#: `build-error` or `os-version`. The default is `install`. -#: -#: * `info` [`--analytics`]: -#: Display information about and analytics data (provided neither -#: `HOMEBREW_NO_ANALYTICS` or `HOMEBREW_NO_GITHUB_API` are set) -#: -#: Pass `--verbose` to see more verbose analytics data. -#: -#: Pass `--analytics` to see only more verbose analytics data instead of -#: formula information. -#: -#: * `info` `--github` : -#: Open a browser to the GitHub History page for . -#: -#: To view formula history locally: `brew log -p` -#: -#: * `info` `--json[=`] (`--all`|`--installed`|): -#: Print a JSON representation of . Currently the default and -#: only accepted value for is `v1`. -#: -#: Pass `--all` to get information on all formulae, or `--installed` to get -#: information on all installed formulae. -#: -#: See the docs for examples of using the JSON output: -#: - require "missing_formula" require "caveats" require "cli_parser" @@ -49,7 +13,7 @@ module Homebrew def info_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `info []` + `info` [] Display brief statistics for your Homebrew installation. EOS @@ -67,7 +31,7 @@ module Homebrew description: "Open a browser to the GitHub History page for provided . "\ "To view formula history locally: `brew log -p` " flag "--json", - description: "Print a JSON representation of . Currently the default and only accepted "\ + description: "Print a JSON representation of . Currently the default and only accepted "\ "value for is `v1`. See the docs for examples of using the JSON "\ "output: " switch "--all", diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 46a4bef490..a04140527e 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -1,74 +1,3 @@ -#: * `install` [`--debug`] [`--env=`(`std`|`super`)] [`--ignore-dependencies`|`--only-dependencies`] [`--cc=`] [`--build-from-source`|`--force-bottle`] [`--include-test`] [`--devel`|`--HEAD`] [`--keep-tmp`] [`--build-bottle`] [`--force`] [`--verbose`] [`--display-times`] [ ...]: -#: Install . -#: -#: is usually the name of the formula to install, but it can be specified -#: in several different ways. -#: -#: If `--debug` (or `-d`) is passed and brewing fails, open an interactive debugging -#: session with access to IRB or a shell inside the temporary build directory. -#: -#: If `--env=std` is passed, use the standard build environment instead of superenv. -#: -#: If `--env=super` is passed, use superenv even if the formula specifies the -#: standard build environment. -#: -#: If `--ignore-dependencies` is passed, skip installing any dependencies of -#: any kind. If they are not already present, the formula will probably fail -#: to install. -#: -#: If `--only-dependencies` is passed, install the dependencies with specified -#: options but do not install the specified formula. -#: -#: If `--cc=` is passed, attempt to compile using . -#: should be the name of the compiler's executable, for instance -#: `gcc-7` for GCC 7. In order to use LLVM's clang, use `llvm_clang`. -#: To specify the Apple-provided clang, use `clang`. -#: This parameter will only accept compilers that are provided by Homebrew or -#: bundled with macOS. Please do not file issues if you encounter errors -#: while using this flag. -#: -#: If `--build-from-source` (or `-s`) is passed, compile the specified from -#: source even if a bottle is provided. Dependencies will still be installed -#: from bottles if they are available. -#: -#: If `--force-bottle` is passed, install from a bottle if it exists for the -#: current or newest version of macOS, even if it would not normally be used -#: for installation. -#: -#: If `--include-test` is passed, install testing dependencies. These are only -#: needed by formulae maintainers to run `brew test`. -#: -#: If `--devel` is passed, and defines it, install the development version. -#: -#: If `--HEAD` is passed, and defines it, install the HEAD version, -#: aka. master, trunk, unstable. -#: -#: If `--keep-tmp` is passed, the temporary files created during installation -#: are not deleted. -#: -#: If `--build-bottle` is passed, prepare the formula for eventual bottling -#: during installation. -#: -#: If `--force` (or `-f`) is passed, install without checking for previously -#: installed keg-only or non-migrated versions -#: -#: If `--verbose` (or `-v`) is passed, print the verification and postinstall steps. -#: -#: If `--display-times` is passed, install times for each formula are printed -#: at the end of the run. -#: -#: Installation options specific to may be appended to the command, -#: and can be listed with `brew options` . -#: -#: * `install` `--interactive` [`--git`] : -#: If `--interactive` (or `-i`) is passed, download and patch , then -#: open a shell. This allows the user to run `./configure --help` and -#: otherwise determine how to turn the software package into a Homebrew -#: formula. -#: -#: If `--git` (or `-g`) is passed, Homebrew will create a Git repository, useful for -#: creating patches to the software. - require "missing_formula" require "formula_installer" require "development_tools" @@ -128,9 +57,9 @@ module Homebrew switch "--fetch-HEAD", description: "Fetch the upstream repository to detect if the HEAD installation of the "\ "formula is outdated. Otherwise, the repository's HEAD will be checked for "\ - "updates when a new stable or devel version has been released." + "updates when a new stable or development version has been released." switch "--keep-tmp", - description: "Dont delete the temporary files created during installation." + description: "Don't delete the temporary files created during installation." switch "--build-bottle", description: "Prepare the formula for eventual bottling during installation." switch :force, diff --git a/Library/Homebrew/cmd/leaves.rb b/Library/Homebrew/cmd/leaves.rb index 2f4d1fb0ad..1971ff5da9 100644 --- a/Library/Homebrew/cmd/leaves.rb +++ b/Library/Homebrew/cmd/leaves.rb @@ -1,6 +1,3 @@ -#: * `leaves`: -#: Show installed formulae that are not dependencies of another installed formula. - require "formula" require "tab" require "cli_parser" diff --git a/Library/Homebrew/cmd/link.rb b/Library/Homebrew/cmd/link.rb index 7560263b19..4f2cd4371e 100644 --- a/Library/Homebrew/cmd/link.rb +++ b/Library/Homebrew/cmd/link.rb @@ -1,17 +1,3 @@ -#: * `ln`, `link` [`--overwrite`] [`--dry-run`] [`--force`] : -#: Symlink all of 's installed files into the Homebrew prefix. This -#: is done automatically when you install formulae but can be useful for DIY -#: installations. -#: -#: If `--overwrite` is passed, Homebrew will delete files which already exist in -#: the prefix while linking. -#: -#: If `--dry-run` or `-n` is passed, Homebrew will list all files which would -#: be linked or which would be deleted by `brew link --overwrite`, but will not -#: actually link or delete any files. -#: -#: If `--force` (or `-f`) is passed, Homebrew will allow keg-only formulae to be linked. - require "ostruct" require "caveats" require "cli_parser" @@ -22,7 +8,7 @@ module Homebrew def link_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `ln`, `link` + `ln`, `link` [] Symlink all of 's installed files into the Homebrew prefix. This is done automatically when you install formulae but can be useful for DIY diff --git a/Library/Homebrew/cmd/list.rb b/Library/Homebrew/cmd/list.rb index 74a3d1c1ca..15ceae6a86 100644 --- a/Library/Homebrew/cmd/list.rb +++ b/Library/Homebrew/cmd/list.rb @@ -1,23 +1,3 @@ -#: * `list`, `ls` [`--full-name`] [`-1`] [`-l`] [`-t`] [`-r`]: -#: List all installed formulae. If `--full-name` is passed, print formulae -#: with fully-qualified names. If `--full-name` is not passed, other -#: options (i.e. `-1`, `-l`, `-t` and `-r`) are passed to `ls` which produces the actual output. -#: -#: * `list`, `ls` `--unbrewed`: -#: List all files in the Homebrew prefix not installed by Homebrew. -#: -#: * `list`, `ls` [`--verbose`] [`--versions` [`--multiple`]] [`--pinned`] []: -#: List the installed files for . Combined with `--verbose`, recursively -#: list the contents of all subdirectories in each 's keg. -#: -#: If `--versions` is passed, show the version number for installed formulae, -#: or only the specified formulae if are given. With `--multiple`, -#: only show formulae with multiple versions installed. -#: -#: If `--pinned` is passed, show the versions of pinned formulae, or only the -#: specified (pinned) formulae if are given. -#: See also `pin`, `unpin`. - require "metafiles" require "formula" require "cli_parser" @@ -28,7 +8,7 @@ module Homebrew def list_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `list`, `ls` [] [`-1`] [`-l`] [`-t`] [`-r`] + `list`, `ls` [] List all installed formulae. EOS @@ -40,13 +20,13 @@ module Homebrew description: "List all files in the Homebrew prefix not installed by Homebrew." switch "--versions", description: "Show the version number for installed formulae, or only the specified "\ - "formulae if are given." + "formulae if are given." switch "--multiple", depends_on: "--versions", description: "Only show formulae with multiple versions installed." switch "--pinned", description: "Show the versions of pinned formulae, or only the specified (pinned) "\ - "formulae if are given. See also `pin`, `unpin`." + "formulae if are given. See also `pin`, `unpin`." # passed through to ls switch "-1", description: "Force output to be one entry per line. " \ diff --git a/Library/Homebrew/cmd/migrate.rb b/Library/Homebrew/cmd/migrate.rb index f32e34f87b..eede2c97f4 100644 --- a/Library/Homebrew/cmd/migrate.rb +++ b/Library/Homebrew/cmd/migrate.rb @@ -1,10 +1,3 @@ -#: * `migrate` [`--force`] : -#: Migrate renamed packages to new name, where are old names of -#: packages. -#: -#: If `--force` (or `-f`) is passed, then treat installed and passed -#: like if they are from same taps and migrate them anyway. - require "migrator" require "cli_parser" @@ -14,13 +7,13 @@ module Homebrew def migrate_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `migrate` [] + `migrate` [] - Migrate renamed packages to new name, where are old names of + Migrate renamed packages to new name, where are old names of packages. EOS switch :force, - description: "Treat installed and passed like if they are from "\ + description: "Treat installed and passed like if they are from "\ "same taps and migrate them anyway." switch :verbose switch :debug diff --git a/Library/Homebrew/cmd/missing.rb b/Library/Homebrew/cmd/missing.rb index 224c525bcc..d0229470ec 100644 --- a/Library/Homebrew/cmd/missing.rb +++ b/Library/Homebrew/cmd/missing.rb @@ -1,12 +1,3 @@ -#: * `missing` [`--hide=`] []: -#: Check the given for missing dependencies. If no are -#: given, check all installed brews. -#: -#: If `--hide=` is passed, act as if none of are installed. -#: should be a comma-separated list of formulae. -#: -#: `missing` exits with a non-zero status if any formulae are missing dependencies. - require "formula" require "tab" require "diagnostic" @@ -18,9 +9,9 @@ module Homebrew def missing_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `missing` [] [] + `missing` [] [] - Check the given for missing dependencies. If no are + Check the given for missing dependencies. If no are given, check all installed brews. `missing` exits with a non-zero status if any formulae are missing dependencies. diff --git a/Library/Homebrew/cmd/options.rb b/Library/Homebrew/cmd/options.rb index 8fa65c3a1a..e17f303ca6 100644 --- a/Library/Homebrew/cmd/options.rb +++ b/Library/Homebrew/cmd/options.rb @@ -1,13 +1,3 @@ -#: * `options` [`--compact`] (`--all`|`--installed`|): -#: Display install options specific to . -#: -#: If `--compact` is passed, show all options on a single line separated by -#: spaces. -#: -#: If `--all` is passed, show options for all formulae. -#: -#: If `--installed` is passed, show options for all installed formulae. - require "formula" require "options" require "cli_parser" @@ -18,9 +8,9 @@ module Homebrew def options_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `options` [] + `options` [] - Display install options specific to + Display install options specific to EOS switch "--compact", description: "Show all options on a single line separated by spaces." diff --git a/Library/Homebrew/cmd/outdated.rb b/Library/Homebrew/cmd/outdated.rb index 6477dc2b8d..0858eec572 100644 --- a/Library/Homebrew/cmd/outdated.rb +++ b/Library/Homebrew/cmd/outdated.rb @@ -1,22 +1,3 @@ -#: * `outdated` [`--quiet`|`--verbose`|`--json=`] [`--fetch-HEAD`]: -#: Show formulae that have an updated version available. -#: -#: By default, version information is displayed in interactive shells, and -#: suppressed otherwise. -#: -#: If `--quiet` is passed, list only the names of outdated brews (takes -#: precedence over `--verbose`). -#: -#: If `--verbose` (or `-v`) is passed, display detailed version information. -#: -#: If `--json=` is passed, the output will be in JSON format. -#: Currently the only accepted value for is `v1`. -#: -#: If `--fetch-HEAD` is passed, fetch the upstream repository to detect if -#: the HEAD installation of the formula is outdated. Otherwise, the -#: repository's HEAD will be checked for updates when a new stable or devel -#: version has been released. - require "formula" require "keg" require "cli_parser" @@ -44,7 +25,7 @@ module Homebrew switch "--fetch-HEAD", description: "Fetch the upstream repository to detect if the HEAD installation of the "\ "formula is outdated. Otherwise, the repository's HEAD will be checked for "\ - "updates when a new stable or devel version has been released." + "updates when a new stable or development version has been released." switch :debug conflicts "--quiet", "--verbose", "--json=" end diff --git a/Library/Homebrew/cmd/pin.rb b/Library/Homebrew/cmd/pin.rb index e93ce5938b..e28812b2ee 100644 --- a/Library/Homebrew/cmd/pin.rb +++ b/Library/Homebrew/cmd/pin.rb @@ -1,7 +1,3 @@ -#: * `pin` : -#: Pin the specified , preventing them from being upgraded when -#: issuing the `brew upgrade` command. See also `unpin`. - require "formula" require "cli_parser" @@ -11,10 +7,10 @@ module Homebrew def pin_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `pin` + `pin` - Pin the specified , preventing them from being upgraded when - issuing the `brew upgrade` command. See also `unpin`. + Pin the specified , preventing them from being upgraded when + issuing the `brew upgrade` command. See also `unpin`. EOS switch :debug end diff --git a/Library/Homebrew/cmd/postinstall.rb b/Library/Homebrew/cmd/postinstall.rb index 7db46b56e1..315b751428 100644 --- a/Library/Homebrew/cmd/postinstall.rb +++ b/Library/Homebrew/cmd/postinstall.rb @@ -1,6 +1,3 @@ -#: * `postinstall` : -#: Rerun the post-install steps for . - require "sandbox" require "formula_installer" require "cli_parser" diff --git a/Library/Homebrew/cmd/prune.rb b/Library/Homebrew/cmd/prune.rb index 387af49764..89500eb633 100644 --- a/Library/Homebrew/cmd/prune.rb +++ b/Library/Homebrew/cmd/prune.rb @@ -1,6 +1,3 @@ -#: * `prune` [`--dry-run`]: -#: Deprecated. Use `brew cleanup` instead. - require "keg" require "cli_parser" require "cleanup" @@ -19,6 +16,7 @@ module Homebrew description: "Show what would be removed, but do not actually remove anything." switch :verbose switch :debug + hide_from_man_page! end end diff --git a/Library/Homebrew/cmd/readall.rb b/Library/Homebrew/cmd/readall.rb index 3d51c83733..124da2e18d 100644 --- a/Library/Homebrew/cmd/readall.rb +++ b/Library/Homebrew/cmd/readall.rb @@ -1,14 +1,3 @@ -#: * `readall` [`--aliases`] [`--syntax`] []: -#: Import all formulae from specified (defaults to all installed taps). -#: -#: This can be useful for debugging issues across all formulae when making -#: significant changes to `formula.rb`, testing the performance of loading -#: all formulae or to determine if any current formulae have Ruby issues. -#: -#: If `--aliases` is passed, also verify any alias symlinks in each tap. -#: -#: If `--syntax` is passed, also syntax-check all of Homebrew's Ruby files. - require "readall" require "cli_parser" @@ -18,9 +7,9 @@ module Homebrew def readall_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `readall` [] [] + `readall` [] [] - Import all formulae from specified (defaults to all installed taps). + Import all formulae from specified (defaults to all installed taps). This can be useful for debugging issues across all formulae when making significant changes to `formula.rb`, testing the performance of loading all formulae or to determine if any current formulae have Ruby issues. diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index d1d7a0f05c..35fdecee02 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -1,31 +1,3 @@ -#: * `reinstall` [`--debug`] [`--build-from-source`|`--force-bottle`] [`--keep-tmp`] [`--force`] [`--verbose`] [`--display-times`] : -#: Uninstall and then install (with existing and any appended install options). -#: -#: If `--debug` (or `-d`) is passed and brewing fails, open an interactive debugging -#: session with access to IRB or a shell inside the temporary build directory. -#: -#: If `--build-from-source` (or `-s`) is passed, compile the specified from -#: source even if a bottle is provided. Dependencies will still be installed -#: from bottles if they are available. -#: -#: If `--force-bottle` is passed, install from a bottle if it exists for the -#: current or newest version of macOS, even if it would not normally be used -#: for installation. -#: -#: If `--keep-tmp` is passed, the temporary files created during installation -#: are not deleted. -#: -#: If `--force` (or `-f`) is passed, install without checking for previously -#: installed keg-only or non-migrated versions -#: -#: If `--verbose` (or `-v`) is passed, print the verification and postinstall steps. -#: -#: If `--display-times` is passed, install times for each formula are printed -#: at the end of the run. -#: -#: Installation options specific to may be appended to the command, -#: and can be listed with `brew options` . - require "formula_installer" require "development_tools" require "messages" @@ -52,7 +24,7 @@ module Homebrew description: "Install from a bottle if it exists for the current or newest version of "\ "macOS, even if it would not normally be used for installation." switch "--keep-tmp", - description: "Dont delete the temporary files created during installation." + description: "Don't delete the temporary files created during installation." switch :force, description: "Install without checking for previously installed keg-only or "\ "non-migrated versions." diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb index aff503cb2d..11c065e6c1 100644 --- a/Library/Homebrew/cmd/search.rb +++ b/Library/Homebrew/cmd/search.rb @@ -1,22 +1,3 @@ -#: * `search`, `-S`: -#: Display all locally available formulae (including tapped ones). -#: No online search is performed. -#: -#: * `search` `--casks`: -#: Display all locally available casks (including tapped ones). -#: No online search is performed. -#: -#: * `search` [`--desc`] (|`/``/`): -#: Perform a substring search of cask tokens and formula names for . If -#: is surrounded with slashes, then it is interpreted as a regular expression. -#: The search for is extended online to `homebrew/core` and `homebrew/cask`. -#: -#: If `--desc` is passed, search formulae with a description matching and -#: casks with a name matching . -#: -#: * `search` (`--debian`|`--fedora`|`--fink`|`--macports`|`--opensuse`|`--ubuntu`) : -#: Search for in the given package manager's list. - require "formula" require "missing_formula" require "descriptions" @@ -44,7 +25,7 @@ module Homebrew def search_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `search`, `-S` [] (|`/``/`) + `search` [] [|`/``/`] Perform a substring search of cask tokens and formula names for . If is surrounded with slashes, then it is interpreted as a regular expression. diff --git a/Library/Homebrew/cmd/sh.rb b/Library/Homebrew/cmd/sh.rb index 071f098917..90d1f6895b 100644 --- a/Library/Homebrew/cmd/sh.rb +++ b/Library/Homebrew/cmd/sh.rb @@ -1,12 +1,3 @@ -#: * `sh` [`--env=std`]: -#: Start a Homebrew build environment shell. Uses our years-battle-hardened -#: Homebrew build logic to help your `./configure && make && make install` -#: or even your `gem install` succeed. Especially handy if you run Homebrew -#: in an Xcode-only configuration since it adds tools like `make` to your `PATH` -#: which otherwise build systems would not find. -#: -#: If `--env=std` is passed, use the standard `PATH` instead of superenv's. - require "extend/ENV" require "formula" require "cli_parser" diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb index d09a362f6f..0256fe2b0e 100644 --- a/Library/Homebrew/cmd/style.rb +++ b/Library/Homebrew/cmd/style.rb @@ -1,22 +1,3 @@ -#: * `style` [`--fix`] [`--display-cop-names`] [`--only-cops=`|`--except-cops=`] [||]: -#: Check formulae or files for conformance to Homebrew style guidelines. -#: -#: Lists of , and may not be combined. If none are -#: provided, `style` will run style checks on the whole Homebrew library, -#: including core code and all formulae. -#: -#: If `--fix` is passed, automatically fix style violations using RuboCop's -#: auto-correct feature. -#: -#: If `--display-cop-names` is passed, include the RuboCop cop name for each -#: violation in the output. -#: -#: Passing `--only-cops=` will check for violations of only the listed -#: RuboCop , while `--except-cops=` will skip checking the listed -#: . For either option should be a comma-separated list of cop names. -#: -#: Exits with a non-zero status if any style violations are found. - require "json" require "open3" require "style" @@ -28,11 +9,11 @@ module Homebrew def style_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `style` [] [||] + `style` [] [||] Check formulae or files for conformance to Homebrew style guidelines. - Lists of , and may not be combined. If none are + Lists of , and may not be combined. If none are provided, `style` will run style checks on the whole Homebrew library, including core code and all formulae. EOS diff --git a/Library/Homebrew/cmd/switch.rb b/Library/Homebrew/cmd/switch.rb index 7bcc295a4d..1122f68c01 100644 --- a/Library/Homebrew/cmd/switch.rb +++ b/Library/Homebrew/cmd/switch.rb @@ -1,6 +1,3 @@ -#: * `switch` : -#: Symlink all of the specific of 's install to Homebrew prefix. - require "formula" require "keg" require "cli_parser" diff --git a/Library/Homebrew/cmd/tap-info.rb b/Library/Homebrew/cmd/tap-info.rb index e0cbba78d1..6db14fcea0 100644 --- a/Library/Homebrew/cmd/tap-info.rb +++ b/Library/Homebrew/cmd/tap-info.rb @@ -1,20 +1,3 @@ -#: * `tap-info`: -#: Display a brief summary of all installed taps. -#: -#: * `tap-info` (`--installed`|): -#: Display detailed information about one or more . -#: -#: Pass `--installed` to display information on all installed taps. -#: -#: * `tap-info` `--json=` (`--installed`|): -#: Print a JSON representation of . Currently the only accepted value -#: for is `v1`. -#: -#: Pass `--installed` to get information on installed taps. -#: -#: See the docs for examples of using the JSON output: -#: - require "cli_parser" module Homebrew @@ -23,10 +6,10 @@ module Homebrew def tap_info_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `tap-info` [] [] + `tap-info` [] [] - Display detailed information about one or more provided . - Display a brief summary of all installed taps if no are passed. + Display detailed information about one or more provided . + Display a brief summary of all installed taps if no are passed. EOS switch "--installed", description: "Display information on all installed taps." diff --git a/Library/Homebrew/cmd/tap-pin.rb b/Library/Homebrew/cmd/tap-pin.rb index 7878d550f2..0617e5ea8e 100644 --- a/Library/Homebrew/cmd/tap-pin.rb +++ b/Library/Homebrew/cmd/tap-pin.rb @@ -1,7 +1,3 @@ -#: * `tap-pin` : -#: Pin , prioritizing its formulae over core when formula names are supplied -#: by the user. See also `tap-unpin`. - require "cli_parser" module Homebrew @@ -12,7 +8,7 @@ module Homebrew usage_banner <<~EOS `tap-pin` - Pin , prioritizing its formulae over core when formula names are supplied + Pin , prioritising its formulae over core when formula names are supplied by the user. See also `tap-unpin`. EOS switch :debug diff --git a/Library/Homebrew/cmd/tap-unpin.rb b/Library/Homebrew/cmd/tap-unpin.rb index 056de3e1fd..7d030b969b 100644 --- a/Library/Homebrew/cmd/tap-unpin.rb +++ b/Library/Homebrew/cmd/tap-unpin.rb @@ -1,6 +1,3 @@ -#: * `tap-unpin` : -#: Unpin so its formulae are no longer prioritized. See also `tap-pin`. - require "cli_parser" module Homebrew @@ -11,7 +8,7 @@ module Homebrew usage_banner <<~EOS `tap-unpin` - Unpin so its formulae are no longer prioritized. See also `tap-pin`. + Unpin so its formulae are no longer prioritised. See also `tap-pin`. EOS switch :debug end diff --git a/Library/Homebrew/cmd/tap.rb b/Library/Homebrew/cmd/tap.rb index cc7f1cd6e3..917d5615c2 100644 --- a/Library/Homebrew/cmd/tap.rb +++ b/Library/Homebrew/cmd/tap.rb @@ -1,37 +1,3 @@ -#: * `tap`: -#: List all installed taps. -#: -#: * `tap` [`--full`] [`--force-auto-update`] `/` []: -#: Tap a formula repository. -#: -#: With unspecified, taps a formula repository from GitHub using HTTPS. -#: Since so many taps are hosted on GitHub, this command is a shortcut for -#: `brew tap` `/` `https://github.com/``/homebrew-`. -#: -#: With specified, taps a formula repository from anywhere, using -#: any transport protocol that `git` handles. The one-argument form of `tap` -#: simplifies but also limits. This two-argument command makes no -#: assumptions, so taps can be cloned from places other than GitHub and -#: using protocols other than HTTPS, e.g., SSH, GIT, HTTP, FTP(S), RSYNC. -#: -#: By default, the repository is cloned as a shallow copy (`--depth=1`), but -#: if `--full` is passed, a full clone will be used. To convert a shallow copy -#: to a full copy, you can retap passing `--full` without first untapping. -#: -#: By default, only taps hosted on GitHub are auto-updated (for performance -#: reasons). If `--force-auto-update` is passed, this tap will be auto-updated -#: even if it is not hosted on GitHub. -#: -#: `tap` is re-runnable and exits successfully if there's nothing to do. -#: However, retapping with a different will cause an exception, so first -#: `untap` if you need to modify the . -#: -#: * `tap` `--repair`: -#: Migrate tapped formulae from symlink-based to directory-based structure. -#: -#: * `tap` `--list-pinned`: -#: List all pinned taps. - require "cli_parser" module Homebrew diff --git a/Library/Homebrew/cmd/uninstall.rb b/Library/Homebrew/cmd/uninstall.rb index 8de4b4f0d5..15dc992a32 100644 --- a/Library/Homebrew/cmd/uninstall.rb +++ b/Library/Homebrew/cmd/uninstall.rb @@ -1,12 +1,3 @@ -#: * `uninstall`, `rm`, `remove` [`--force`] [`--ignore-dependencies`] : -#: Uninstall . -#: -#: If `--force` (or `-f`) is passed, and there are multiple versions of -#: installed, delete all installed versions. -#: -#: If `--ignore-dependencies` is passed, uninstalling won't fail, even if -#: formulae depending on would still be installed. - require "keg" require "formula" require "diagnostic" @@ -26,7 +17,7 @@ module Homebrew switch :force, description: "Delete all installed versions of the " switch "--ignore-dependencies", - description: "Dont fail uninstall, even if is a dependency of any installed "\ + description: "Don't fail uninstall, even if is a dependency of any installed "\ "formulae." switch :debug end diff --git a/Library/Homebrew/cmd/unlink.rb b/Library/Homebrew/cmd/unlink.rb index 81561f96d3..9e3b9f84a0 100644 --- a/Library/Homebrew/cmd/unlink.rb +++ b/Library/Homebrew/cmd/unlink.rb @@ -1,11 +1,3 @@ -#: * `unlink` [`--dry-run`] : -#: Remove symlinks for from the Homebrew prefix. This can be useful -#: for temporarily disabling a formula: -#: `brew unlink` `&&` `&& brew link` -#: -#: If `--dry-run` or `-n` is passed, Homebrew will list all files which would -#: be unlinked, but will not actually unlink or delete any files. - require "ostruct" require "cli_parser" diff --git a/Library/Homebrew/cmd/unpack.rb b/Library/Homebrew/cmd/unpack.rb index f091df6d78..764362af62 100644 --- a/Library/Homebrew/cmd/unpack.rb +++ b/Library/Homebrew/cmd/unpack.rb @@ -1,14 +1,3 @@ -#: * `unpack` [`--git`|`--patch`] [`--destdir=`] : -#: Unpack the source files for into subdirectories of the current -#: working directory. If `--destdir=` is given, the subdirectories will -#: be created in the directory named by instead. -#: -#: If `--patch` is passed, patches for will be applied to the -#: unpacked source. -#: -#: If `--git` (or `-g`) is passed, a Git repository will be initialized in the unpacked -#: source. This is useful for creating patches for the software. - require "stringio" require "formula" require "cli_parser" @@ -19,17 +8,17 @@ module Homebrew def unpack_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `usage` [] + `unpack` [] - Unpack the source files for into subdirectories of the current + Unpack the source files for into subdirectories of the current working directory. EOS flag "--destdir=", description: "Create subdirectories in the directory named by instead." switch "--patch", - description: "Patches for will be applied to the unpacked source." + description: "Patches for will be applied to the unpacked source." switch "-g", "--git", - description: "Initialize a Git repository in the unpacked source. This is useful for creating "\ + description: "Initialise a Git repository in the unpacked source. This is useful for creating "\ "patches for the software." switch :force switch :verbose diff --git a/Library/Homebrew/cmd/unpin.rb b/Library/Homebrew/cmd/unpin.rb index 4f4da23d43..9f75503499 100644 --- a/Library/Homebrew/cmd/unpin.rb +++ b/Library/Homebrew/cmd/unpin.rb @@ -1,7 +1,3 @@ -#: * `unpin` : -#: Unpin , allowing them to be upgraded by `brew upgrade` . -#: See also `pin`. - require "formula" require "cli_parser" @@ -11,9 +7,9 @@ module Homebrew def unpin_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `unpin` + `unpin` - Unpin , allowing them to be upgraded by `brew upgrade` . + Unpin , allowing them to be upgraded by `brew upgrade` . See also `pin`. EOS switch :verbose diff --git a/Library/Homebrew/cmd/untap.rb b/Library/Homebrew/cmd/untap.rb index 1dbeaf0621..250484f3df 100644 --- a/Library/Homebrew/cmd/untap.rb +++ b/Library/Homebrew/cmd/untap.rb @@ -1,6 +1,3 @@ -#: * `untap` : -#: Remove a tapped repository. - require "cli_parser" module Homebrew diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 71c6b81e7e..93b96c9ce5 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -1,42 +1,3 @@ -#: * `upgrade` [`--debug`] [`--build-from-source`|`--force-bottle`] [`--fetch-HEAD`] [`--ignore-pinned`] [`--keep-tmp`] [`--force`] [`--verbose`] [`--display-times`] [] [ ...]: -#: Upgrade outdated, unpinned brews (with existing and any appended install options). -#: -#: If are given, upgrade only the specified brews (unless they -#: are pinned; see `pin`, `unpin`). -#: -#: If `--debug` (or `-d`) is passed and brewing fails, open an interactive debugging -#: session with access to IRB or a shell inside the temporary build directory. -#: -#: If `--build-from-source` (or `-s`) is passed, compile the specified from -#: source even if a bottle is provided. Dependencies will still be installed -#: from bottles if they are available. -#: -#: If `--force-bottle` is passed, install from a bottle if it exists for the -#: current or newest version of macOS, even if it would not normally be used -#: for installation. -#: -#: If `--fetch-HEAD` is passed, fetch the upstream repository to detect if -#: the HEAD installation of the formula is outdated. Otherwise, the -#: repository's HEAD will be checked for updates when a new stable or devel -#: version has been released. -#: -#: If `--ignore-pinned` is passed, set a 0 exit code even if pinned formulae -#: are not upgraded. -#: -#: If `--keep-tmp` is passed, the temporary files created during installation -#: are not deleted. -#: -#: If `--force` (or `-f`) is passed, install without checking for previously -#: installed keg-only or non-migrated versions -#: -#: If `--verbose` (or `-v`) is passed, print the verification and postinstall steps. -#: -#: If `--display-times` is passed, install times for each formula are printed -#: at the end of the run. -#: -#: Additional options specific to may be appended to the command, -#: and can be listed with `brew options` . - require "install" require "reinstall" require "formula_installer" @@ -69,11 +30,11 @@ module Homebrew switch "--fetch-HEAD", description: "Fetch the upstream repository to detect if the HEAD installation of the "\ "formula is outdated. Otherwise, the repository's HEAD will be checked for "\ - "updates when a new stable or devel version has been released." + "updates when a new stable or development version has been released." switch "--ignore-pinned", description: "Set a 0 exit code even if pinned formulae are not upgraded." switch "--keep-tmp", - description: "Dont delete the temporary files created during installation." + description: "Don't delete the temporary files created during installation." switch :force, description: "Install without checking for previously installed keg-only or "\ "non-migrated versions." diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb index 654211dbad..f25b3114a9 100644 --- a/Library/Homebrew/cmd/uses.rb +++ b/Library/Homebrew/cmd/uses.rb @@ -1,23 +1,3 @@ -#: * `uses` [`--installed`] [`--recursive`] [`--include-build`] [`--include-test`] [`--include-optional`] [`--skip-recommended`] [`--devel`|`--HEAD`] : -#: Show the formulae that specify as a dependency. When given -#: multiple formula arguments, show the intersection of formulae that use -#: . -#: -#: Use `--recursive` to resolve more than one level of dependencies. -#: -#: If `--installed` is passed, only list installed formulae. -#: -#: By default, `uses` shows all formulae that specify as a required -#: or recommended dependency. To include the `:build` type dependencies, pass -#: `--include-build`, to include the `:test` type dependencies, pass -#: `--include-test` and to include `:optional` dependencies pass -#: `--include-optional`. To skip `:recommended` type dependencies, pass -#: `--skip-recommended`. -#: -#: By default, `uses` shows usage of by stable builds. To find -#: cases where is used by development or HEAD build, pass -#: `--devel` or `--HEAD`. - require "formula" require "cli_parser" @@ -31,33 +11,33 @@ module Homebrew def uses_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `uses` [] + `uses` [] - Show the formulae that specify as a dependency. When given + Show the formulae that specify as a dependency. When given multiple formula arguments, show the intersection of formulae that use - . + . - By default, `uses` shows all formulae that specify as a required + By default, `uses` shows all formulae that specify as a required or recommended dependency. - By default, `uses` shows usage of by stable builds. + By default, `uses` shows usage of by stable builds. EOS switch "--recursive", description: "Resolve more than one level of dependencies." switch "--installed", description: "Only list installed formulae." switch "--include-build", - description: "Include all formulae that specify as `:build` type dependency." + description: "Include all formulae that specify as `:build` type dependency." switch "--include-test", - description: "Include all formulae that specify as `:test` type dependency." + description: "Include all formulae that specify as `:test` type dependency." switch "--include-optional", - description: "Include all formulae that specify as `:optional` type dependency." + description: "Include all formulae that specify as `:optional` type dependency." switch "--skip-recommended", - description: "Skip all formulae that specify as `:recommended` type dependency." + description: "Skip all formulae that specify as `:recommended` type dependency." switch "--devel", - description: "Show usage of by development build." + description: "Show usage of by development build." switch "--HEAD", - description: "Show usage of by HEAD build." + description: "Show usage of by HEAD build." switch :debug conflicts "--devel", "--HEAD" end From bbea109926c706bc50294d3b15b3b93354800ec0 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:33:03 +0000 Subject: [PATCH 111/199] dev-cmd: remove --help headers and tweak docs. --- Library/Homebrew/dev-cmd/audit.rb | 46 ++------------- Library/Homebrew/dev-cmd/bottle.rb | 34 +---------- Library/Homebrew/dev-cmd/bump-formula-pr.rb | 43 -------------- Library/Homebrew/dev-cmd/create.rb | 21 ------- Library/Homebrew/dev-cmd/edit.rb | 8 +-- Library/Homebrew/dev-cmd/extract.rb | 12 ---- Library/Homebrew/dev-cmd/formula.rb | 5 +- Library/Homebrew/dev-cmd/irb.rb | 8 --- Library/Homebrew/dev-cmd/linkage.rb | 14 +---- Library/Homebrew/dev-cmd/man.rb | 9 --- Library/Homebrew/dev-cmd/mirror.rb | 7 +-- Library/Homebrew/dev-cmd/prof.rb | 11 +--- Library/Homebrew/dev-cmd/pull.rb | 65 +-------------------- Library/Homebrew/dev-cmd/release-notes.rb | 7 --- Library/Homebrew/dev-cmd/ruby.rb | 12 +--- Library/Homebrew/dev-cmd/tap-new.rb | 3 - Library/Homebrew/dev-cmd/test.rb | 19 +----- Library/Homebrew/dev-cmd/tests.rb | 19 +----- Library/Homebrew/dev-cmd/update-test.rb | 16 ----- Library/Homebrew/dev-cmd/vendor-gems.rb | 11 ++-- 20 files changed, 29 insertions(+), 341 deletions(-) diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 61f14f28bb..a3ef5a531f 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -1,40 +1,3 @@ -#: * `audit` [`--strict`] [`--fix`] [`--online`] [`--new-formula`] [`--display-cop-names`] [`--display-filename`] [`--only=`|`--except=`] [`--only-cops=`|`--except-cops=`] []: -#: Check for Homebrew coding style violations. This should be run -#: 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 are provided, all of them are checked. -#: -#: If `--strict` is passed, additional checks are run, including RuboCop -#: style checks. -#: -#: If `--fix` is passed, style violations will be -#: automatically fixed using RuboCop's auto-correct feature. -#: -#: 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 eligible 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. -#: -#: Specifying `--only=` will run only the methods named `audit_`, -#: while `--except=` will skip the methods named `audit_`. -#: For either option should be a comma-separated list. -#: -#: Specifying `--only-cops=` will check for violations of only the listed -#: RuboCop , while `--except-cops=` will skip checking the listed -#: . For either option should be a comma-separated list of cop names. - -# Undocumented options: -# `-D` activates debugging and profiling of the audit methods (not the same as `--debug`) - require "formula" require "formula_versions" require "utils/curl" @@ -53,12 +16,12 @@ module Homebrew def audit_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `audit` [] + `audit` [] - Check for Homebrew coding style violations. This should be run before + Check for Homebrew coding style violations. This should be run 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 are provided, all of them are checked. + If no are provided, all of them are checked. EOS switch "--strict", description: "Run additional style checks, including RuboCop style checks." @@ -93,6 +56,9 @@ module Homebrew switch :debug conflicts "--only", "--except" conflicts "--only-cops", "--except-cops" + + # Undocumented options: + # `-D` activates debugging and profiling of the audit methods (not the same as `--debug`) end end diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 66ae74b278..356241fe83 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -1,35 +1,3 @@ -#: * `bottle` [`--verbose`] [`--no-rebuild`|`--keep-old`] [`--skip-relocation`] [`--or-later`] [`--root-url=`] [`--force-core-tap`] [`--json`] : -#: Generate a bottle (binary package) from a formula that was installed with -#: `--build-bottle`. -#: -#: 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 original -#: value, while `--no-rebuild` will remove it. -#: -#: If `--verbose` (or `-v`) is passed, print the bottling commands and any warnings -#: encountered. -#: -#: If `--skip-relocation` is passed, do not check if the bottle can be marked -#: as relocatable. -#: -#: If `--root-url` is passed, use the specified as the root of the -#: bottle's URL instead of Homebrew's default. -#: -#: If `--or-later` is passed, append `_or_later` to the bottle tag. -#: -#: If `--force-core-tap` is passed, build a bottle even if is not -#: in homebrew/core or any installed taps. -#: -#: If `--json` is passed, write bottle information to a JSON file, which can -#: be used as the argument for `--merge`. -#: -#: * `bottle` `--merge` [`--keep-old`] [`--write` [`--no-commit`]] : -#: Generate a bottle from a `--json` output file and print the new DSL merged -#: into the existing formula. -#: -#: If `--write` is passed, write the changes to the formula file. A new -#: commit will then be generated unless `--no-commit` is passed. - require "formula" require "utils/bottles" require "tab" @@ -72,7 +40,7 @@ module Homebrew def bottle_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `bottle` [] + `bottle` [] Generate a bottle (binary package) from a formula that was installed with `--build-bottle`. diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 26c077fed1..820106b3fe 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -1,46 +1,3 @@ -#: * `bump-formula-pr` [`--devel`] [`--dry-run` [`--write`]] [`--no-audit`|`--strict`] [`--no-browse] [`--mirror=`] [`--version=`] [`--message=`] (`--url=` `--sha256=`|`--tag=` `--revision=`) []: -#: Create a pull request to update a formula with a new URL or a new tag. -#: -#: If a is specified, the checksum of the new download should -#: also be specified. A best effort to determine the and -#: name will be made if either or both values are not supplied by the user. -#: -#: If a is specified, the Git commit 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 `--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. -#: -#: If `--no-audit` is passed, don't run `brew audit` before opening the PR. -#: -#: If `--strict` is passed, run `brew audit --strict` before opening the PR. -#: -#: If `--mirror=` is passed, use the value as a mirror URL. -#: -#: If `--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 -#: an existing version override from a formula if it has become redundant. -#: -#: If `--message=` is passed, append to the default PR -#: message. -#: -#: If `--no-browse` is passed, don't pass the `--browse` argument to `hub` -#: which opens the pull request URL in a browser. Instead, output it to the -#: command line. -#: -#: If `--quiet` is passed, don't output replacement messages or warn about -#: duplicate pull requests. -#: -#: *Note:* this command cannot be used to transition a formula from a -#: URL-and-SHA-256 style specification into a tag-and-revision style -#: specification, nor vice versa. It must use whichever style specification -#: the preexisting formula already uses. - require "formula" require "cli_parser" diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb index 1f219c29b1..6432fa2a26 100644 --- a/Library/Homebrew/dev-cmd/create.rb +++ b/Library/Homebrew/dev-cmd/create.rb @@ -1,24 +1,3 @@ -#: * `create` [`--autotools`|`--cmake`|`--meson`] [`--no-fetch`] [`--set-name` ] [`--set-version` ] [`--tap` `/`] : -#: Generate a formula for the downloadable file at 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, see: -#: -#: -#: 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 `--meson` is passed, create a basic template for a Meson-style build. -#: -#: If `--no-fetch` is passed, Homebrew will not download to the cache and -#: 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 its description and homepage). -#: -#: 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. - require "formula" require "formula_creator" require "missing_formula" diff --git a/Library/Homebrew/dev-cmd/edit.rb b/Library/Homebrew/dev-cmd/edit.rb index 14f0780bfb..0340a8ea28 100644 --- a/Library/Homebrew/dev-cmd/edit.rb +++ b/Library/Homebrew/dev-cmd/edit.rb @@ -1,9 +1,3 @@ -#: * `edit`: -#: Open the Homebrew repository for editing. -#: -#: * `edit` : -#: Open in the editor set by `EDITOR` or `HOMEBREW_EDITOR`. - require "formula" require "cli_parser" @@ -13,7 +7,7 @@ module Homebrew def edit_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `edit` [] + `edit` [] Open a formula in the editor set by `EDITOR` or `HOMEBREW_EDITOR`, or open the Homebrew repository for editing if no is provided. diff --git a/Library/Homebrew/dev-cmd/extract.rb b/Library/Homebrew/dev-cmd/extract.rb index 0a0ac2787d..3360ab196c 100644 --- a/Library/Homebrew/dev-cmd/extract.rb +++ b/Library/Homebrew/dev-cmd/extract.rb @@ -1,15 +1,3 @@ -#: * `extract` [`--force`] [`--version=`]: -#: Look through repository history to find the most recent version of and -#: create a copy in `/Formula/``@``.rb`. If the tap is -#: not installed yet, attempt to install/clone the tap before continuing. -#: -#: If `--force` is passed, the file at the destination will be overwritten -#: if it already exists. Otherwise, existing files will be preserved. -#: -#: If an argument is passed through `--version`, of -#: will be extracted and placed in the destination tap. Otherwise, the most -#: recent version that can be found will be used. - require "cli_parser" require "utils/git" require "formulary" diff --git a/Library/Homebrew/dev-cmd/formula.rb b/Library/Homebrew/dev-cmd/formula.rb index 43f355f20c..8fe5c008b7 100644 --- a/Library/Homebrew/dev-cmd/formula.rb +++ b/Library/Homebrew/dev-cmd/formula.rb @@ -1,6 +1,3 @@ -#: * `formula` : -#: Display the path where a formula is located. - require "formula" require "cli_parser" @@ -10,7 +7,7 @@ module Homebrew def formula_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `formula` + `formula` Display the path where a formula is located. EOS diff --git a/Library/Homebrew/dev-cmd/irb.rb b/Library/Homebrew/dev-cmd/irb.rb index 62bd270e9d..4e57bffd91 100644 --- a/Library/Homebrew/dev-cmd/irb.rb +++ b/Library/Homebrew/dev-cmd/irb.rb @@ -1,11 +1,3 @@ -#: * `irb` [`--examples`] [`--pry`]: -#: Enter the interactive Homebrew Ruby shell. -#: -#: 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. - require "cli_parser" class Symbol diff --git a/Library/Homebrew/dev-cmd/linkage.rb b/Library/Homebrew/dev-cmd/linkage.rb index 3cd56bf629..34f60718db 100644 --- a/Library/Homebrew/dev-cmd/linkage.rb +++ b/Library/Homebrew/dev-cmd/linkage.rb @@ -1,15 +1,3 @@ -#: * `linkage` [`--test`] [`--reverse`] []: -#: Check the library links for kegs of installed formulae. -#: Raises an error if run on uninstalled formulae. -#: -#: If `--test` is passed, only display missing libraries and exit with a -#: non-zero status if any missing libraries are found. -#: -#: If `--reverse` is passed, for every library that a keg references, -#: print its dylib path followed by the binaries that link to it. -#: -#: If are given, check linkage for only the specified brews. - require "cache_store" require "linkage_checker" require "cli_parser" @@ -20,7 +8,7 @@ module Homebrew def linkage_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `linkage` [] [] + `linkage` [] [] Check the library links for kegs of installed formulae. Raises an error if run on uninstalled formulae. diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index c63b32857c..1baaeff8f4 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -1,12 +1,3 @@ -#: * `man` [`--fail-if-changed`]: -#: Generate Homebrew's manpages. -#: -#: If `--fail-if-changed` is passed, the command will return a failing -#: status code if changes are detected in the manpage outputs. -#: This can be used for CI to be notified when the manpages are out of date. -#: Additionally, the date used in new manpages will match those in the existing -#: manpages (to allow comparison without factoring in the date). - require "formula" require "erb" require "ostruct" diff --git a/Library/Homebrew/dev-cmd/mirror.rb b/Library/Homebrew/dev-cmd/mirror.rb index fc408cabc7..e7deeb8b35 100644 --- a/Library/Homebrew/dev-cmd/mirror.rb +++ b/Library/Homebrew/dev-cmd/mirror.rb @@ -1,7 +1,3 @@ -#: @hide_from_man_page -#: * `mirror` : -#: Reuploads the stable URL for a formula to Bintray to use it as a mirror. - require "cli_parser" module Homebrew @@ -10,12 +6,13 @@ module Homebrew def mirror_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `mirror` + `mirror` Reuploads the stable URL for a formula to Bintray to use it as a mirror. EOS switch :verbose switch :debug + hide_from_man_page! end end diff --git a/Library/Homebrew/dev-cmd/prof.rb b/Library/Homebrew/dev-cmd/prof.rb index 9a573bb68b..f05204e136 100644 --- a/Library/Homebrew/dev-cmd/prof.rb +++ b/Library/Homebrew/dev-cmd/prof.rb @@ -1,19 +1,12 @@ -#: * `prof` []: -#: Run Homebrew with the Ruby profiler. -#: -#: *Example:* `brew prof readall` - module Homebrew module_function def prof_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `prof` [] + `prof` - Run Homebrew with the Ruby profiler. - - *Example:* `brew prof readall` + Run Homebrew with the Ruby profiler e.g. `brew prof readall`. EOS end end diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index 2554d44e65..fd1cc476dc 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -1,52 +1,3 @@ -#: * `pull` [`--bottle`] [`--bump`] [`--clean`] [`--ignore-whitespace`] [`--resolve`] [`--branch-okay`] [`--no-pbcopy`] [`--no-publish`] [`--warn-on-publish-failure`] [`--bintray-org=`] [`--test-bot-user=`] []: -#: Get a patch from a GitHub commit or pull request and apply it to Homebrew. -#: Optionally, publish updated bottles for 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 "https://jenkins.brew.sh/job/..." string specifying a testing job ID -#: -#: If `--bottle` is passed, handle bottles, pulling the bottle-update -#: commit and publishing files on Bintray. -#: -#: If `--bump` is passed, for one-formula PRs, automatically reword -#: commit message to our preferred format. -#: -#: If `--clean` is passed, do not rewrite or otherwise modify the -#: commits found in the pulled PR. -#: -#: If `--ignore-whitespace` is passed, silently ignore whitespace -#: discrepancies when applying diffs. -#: -#: If `--resolve` is passed, when a patch fails to apply, leave in -#: progress and allow user to resolve, instead of aborting. -#: -#: If `--branch-okay` is passed, do not warn if pulling to a branch -#: besides master (useful for testing). -#: -#: If `--no-pbcopy` is passed, do not copy anything to the system -#: clipboard. -#: -#: If `--no-publish` is passed, do not publish bottles to Bintray. -#: -#: If `--warn-on-publish-failure` was passed, do not exit if there's a -#: failure publishing bottles on Bintray. -#: -#: If `--bintray-org=` is passed, publish at the provided Bintray -#: organisation. -#: -#: If `--test-bot-user=` is passed, pull the bottle block -#: commit from the provided user on GitHub. - require "net/http" require "net/https" require "json" @@ -74,23 +25,13 @@ module Homebrew def pull_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `pull` [] + `pull` [] Get a patch from a GitHub commit or pull request and apply it to Homebrew. Optionally, publish updated bottles for 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 "https://jenkins.brew.sh/job/..." string specifying a testing job ID + Each may be the number of a PR in homebrew/core, the URL of a PR + on GitHub, the URL of a commit on GitHub or a "https://jenkins.brew.sh/job/..." testing job URL. EOS switch "--bottle", description: "Handle bottles, pulling the bottle-update commit and publishing files on Bintray." diff --git a/Library/Homebrew/dev-cmd/release-notes.rb b/Library/Homebrew/dev-cmd/release-notes.rb index 2c3711c1c3..29153c40c6 100644 --- a/Library/Homebrew/dev-cmd/release-notes.rb +++ b/Library/Homebrew/dev-cmd/release-notes.rb @@ -1,10 +1,3 @@ -#: * `release-notes` [`--markdown`] [] []: -#: Print the merged pull requests on Homebrew/brew between two Git refs. -#: If no is provided it defaults to the latest tag. -#: If no is provided it defaults to `origin/master`. -#: -#: If `--markdown` is passed, print as a Markdown list. - require "cli_parser" module Homebrew diff --git a/Library/Homebrew/dev-cmd/ruby.rb b/Library/Homebrew/dev-cmd/ruby.rb index 35a4eb1c5c..f6373ac833 100644 --- a/Library/Homebrew/dev-cmd/ruby.rb +++ b/Library/Homebrew/dev-cmd/ruby.rb @@ -1,8 +1,3 @@ -#: * `ruby` []: -#: Run a Ruby instance with Homebrew's libraries loaded. -#: -#: *Example:* `brew ruby -e "puts :gcc.f.deps"` or `brew ruby script.rb` - require "cli_parser" module Homebrew @@ -11,11 +6,10 @@ module Homebrew def ruby_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `ruby` [] + `ruby` [`-e`]: - Run a Ruby instance with Homebrew's libraries loaded. - - *Example:* `brew ruby -e "puts :gcc.f.deps"` or `brew ruby script.rb` + Run a Ruby instance with Homebrew's libraries loaded e.g. + `brew ruby -e "puts :gcc.f.deps"` or `brew ruby script.rb` EOS switch "-e", description: "Execute the provided string argument as a script." diff --git a/Library/Homebrew/dev-cmd/tap-new.rb b/Library/Homebrew/dev-cmd/tap-new.rb index d43c059e18..6c7e7f0f7d 100644 --- a/Library/Homebrew/dev-cmd/tap-new.rb +++ b/Library/Homebrew/dev-cmd/tap-new.rb @@ -1,6 +1,3 @@ -#: * `tap-new` `/`: -#: Generate the template files for a new tap. - require "tap" require "cli_parser" diff --git a/Library/Homebrew/dev-cmd/test.rb b/Library/Homebrew/dev-cmd/test.rb index cdd4837ec9..0cf2b8f445 100644 --- a/Library/Homebrew/dev-cmd/test.rb +++ b/Library/Homebrew/dev-cmd/test.rb @@ -1,23 +1,8 @@ -#: * `test` [`--devel`|`--HEAD`] [`--debug`] [`--keep-tmp`] : -#: Run the test method provided by a formula. -#: There is no standard output or return code, but generally it should notify 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` (or `-d`) 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` - require "extend/ENV" require "formula_assertions" require "sandbox" require "timeout" +require "cli_parser" module Homebrew module_function @@ -25,7 +10,7 @@ module Homebrew def test_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `test` [] + `test` [] Run the test method provided by an installed formula. There is no standard output or return code, but generally it should notify the diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index af9ffee6a4..bab63de71b 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -1,20 +1,3 @@ -#: * `tests` [`--verbose`] [`--coverage`] [`--generic`] [`--no-compat`] [`--only=`[`:`]] [`--seed=`] [`--online`]: -#: Run Homebrew's unit and integration tests. If provided, -#: `--only=` runs only `_spec.rb`, and `--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 `--coverage` is passed, also generate code coverage reports. -#: -#: If `--generic` is passed, only run OS-agnostic tests. -#: -#: If `--no-compat` is passed, do not load the compatibility layer when -#: running tests. -#: -#: If `--online` is passed, include tests that use the GitHub API and tests -#: that use any of the taps for official external commands. - require "cli_parser" require "fileutils" @@ -41,7 +24,7 @@ module Homebrew description: "Run only `_spec.rb`. Appending `:` will start at a "\ "specific line." flag "--seed=", - description: "Randomize tests with the provided instead of a random seed." + description: "Randomise tests with the provided instead of a random seed." switch :verbose switch :debug end diff --git a/Library/Homebrew/dev-cmd/update-test.rb b/Library/Homebrew/dev-cmd/update-test.rb index d950abf3dd..8902972113 100644 --- a/Library/Homebrew/dev-cmd/update-test.rb +++ b/Library/Homebrew/dev-cmd/update-test.rb @@ -1,19 +1,3 @@ -#: * `update-test` [`--commit=`] [`--before=`] [`--to-tag`] [`--keep-tmp`]: -#: Run a test of `brew update` with a new repository clone. -#: -#: If no arguments are passed, use `origin/master` as the start commit. -#: -#: If `--commit=` is passed, use as the start commit. -#: -#: If `--before=` is passed, use the commit at as the -#: start commit. -#: -#: If `--to-tag` is passed, set `HOMEBREW_UPDATE_TO_TAG` to test updating -#: between tags. -#: -#: If `--keep-tmp` is passed, retain the temporary directory containing -#: the new repository clone. - require "cli_parser" module Homebrew diff --git a/Library/Homebrew/dev-cmd/vendor-gems.rb b/Library/Homebrew/dev-cmd/vendor-gems.rb index bea67f9343..6687e482f6 100644 --- a/Library/Homebrew/dev-cmd/vendor-gems.rb +++ b/Library/Homebrew/dev-cmd/vendor-gems.rb @@ -1,13 +1,10 @@ -#: * `vendor-gems`: -#: Install and commit Homebrew's vendored gems. - require "formula" require "cli_parser" module Homebrew module_function - def vendor_gems + def vendor_gems_args Homebrew::CLI::Parser.new do usage_banner <<~EOS `vendor-gems` @@ -15,7 +12,11 @@ module Homebrew Install and commit Homebrew's vendored gems. EOS switch :debug - end.parse + end + end + + def vendor_gems + vendor_gems_args.parse Homebrew.install_bundler! From a10ba20459d8dec55d09ee0d4b6442258ea642eb Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:33:55 +0000 Subject: [PATCH 112/199] brew.1.md.erb: improve output consistency. --- Library/Homebrew/manpages/brew.1.md.erb | 51 +++++++++++++------------ 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/Library/Homebrew/manpages/brew.1.md.erb b/Library/Homebrew/manpages/brew.1.md.erb index 06f41e37f3..fda085b6c4 100644 --- a/Library/Homebrew/manpages/brew.1.md.erb +++ b/Library/Homebrew/manpages/brew.1.md.erb @@ -29,52 +29,55 @@ For the full command list, see the [COMMANDS](#commands) section. With `--verbose` or `-v`, many commands print extra debugging information. Note that these flags should only appear after a command. - * `install` : - Install . +### `install` : - * `uninstall` : - Uninstall . +Install . - * `update`: - Fetch the newest version of Homebrew from GitHub using `git`(1). +### `uninstall` : - * `list`: - List all installed formulae. +Uninstall . - * `search` (|`/``/`): - Perform a substring search of cask tokens and formula names for . If - is surrounded with slashes, then it is interpreted as a regular expression. - The search for is extended online to `homebrew/core` and `homebrew/cask`. - If no search term is given, all locally available formulae are listed. +### `list`: + +List all installed formulae. + +### `search` (|`/``/`): +Perform a substring search of cask tokens and formula names for . If +is surrounded with slashes, then it is interpreted as a regular expression. +The search for is extended online to `homebrew/core` and `homebrew/cask`. +If no search term is given, all locally available formulae are listed. ## COMMANDS -<%= commands.join("\n") %> +<%= commands %> ## DEVELOPER COMMANDS -<%= developer_commands.join("\n") %> +<%= developer_commands %> ## GLOBAL OPTIONS -<%= global_options.join("\n") %> +<%= global_options %> ## OFFICIAL EXTERNAL COMMANDS - <%= homebrew_bundle.join.strip %> +### `bundle` : +Bundler for non-Ruby dependencies from Homebrew, Homebrew Cask and the Mac App Store. See `brew bundle --help`. - **Homebrew/homebrew-bundle**: +**Homebrew/homebrew-bundle**: - * `cask` [`--version` | `audit` | `cat` | `cleanup` | `create` | `doctor` | `edit` | `fetch` | `home` | `info`]: - Install macOS applications distributed as binaries. +### `cask` : - **Homebrew/homebrew-cask**: +Install macOS applications distributed as binaries. See brew-cask(1). - <%= homebrew_services.join.strip %> +**Homebrew/homebrew-cask**: +### `services` : - **Homebrew/homebrew-services**: +Manage background services with macOS' `launchctl`(1) daemon manager. See `brew services --help`. + +**Homebrew/homebrew-services**: ## CUSTOM EXTERNAL COMMANDS @@ -213,7 +216,7 @@ Note that environment variables must have a value set to be detected. For exampl rather than falling back to building from source. * `HOMEBREW_NO_COLOR`: - If set, Homebrew will not print text with color added. + If set, Homebrew will not print text with colour added. * `HOMEBREW_NO_EMOJI`: If set, Homebrew will not print the `HOMEBREW_INSTALL_BADGE` on a From 1bdcd2001c53556a3cdc472b0b3797d3822a800b Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:34:10 +0000 Subject: [PATCH 113/199] cli_parser: allow hiding from man page. --- Library/Homebrew/cli_parser.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cli_parser.rb b/Library/Homebrew/cli_parser.rb index 1fa11a1d47..54d3297054 100644 --- a/Library/Homebrew/cli_parser.rb +++ b/Library/Homebrew/cli_parser.rb @@ -5,7 +5,7 @@ require "set" module Homebrew module CLI class Parser - attr_reader :processed_options + attr_reader :processed_options, :hide_from_man_page def self.parse(args = ARGV, &block) new(&block).parse(args) @@ -29,6 +29,7 @@ module Homebrew @conflicts = [] @processed_options = [] @desc_line_length = 43 + @hide_from_man_page = false instance_eval(&block) post_initialize end @@ -163,6 +164,10 @@ module Homebrew end end + def hide_from_man_page! + @hide_from_man_page = true + end + private def enable_switch(*names) From 4ace1af297b633b1297a57650f5ca85c5aa9becb Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:34:21 +0000 Subject: [PATCH 114/199] help: improve command --help output. --- Library/Homebrew/help.rb | 12 ++++++++---- Library/Homebrew/test/cmd/help_spec.rb | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/help.rb b/Library/Homebrew/help.rb index 671a962afc..6b734c3b70 100644 --- a/Library/Homebrew/help.rb +++ b/Library/Homebrew/help.rb @@ -76,10 +76,13 @@ module Homebrew def command_help(path) # Let OptionParser generate help text for commands which have a parser defined + cmd = path.basename(path.extname) + cmd_args_method_name = "#{cmd.to_s.tr("-", "_")}_args".to_sym begin - cmd = path.basename(path.extname) - return Homebrew.send("#{cmd.to_s.tr("-", "_")}_args".to_sym).generate_help_text - rescue NoMethodError + return Homebrew.send(cmd_args_method_name) + .generate_help_text + rescue NoMethodError => e + raise if e.name != cmd_args_method_name nil end @@ -89,7 +92,8 @@ module Homebrew HOMEBREW_HELP else help_lines.map do |line| - line.sub(/^ \* /, "#{Tty.bold}brew#{Tty.reset} ") + line.gsub(/^ /, "") + .sub(/^\* /, "#{Tty.bold}Usage: brew#{Tty.reset} ") .gsub(/`(.*?)`/, "#{Tty.bold}\\1#{Tty.reset}") .gsub(%r{<([^\s]+?://[^\s]+?)>}) { |url| Formatter.url(url) } .gsub(/<(.*?)>/, "#{Tty.underline}\\1#{Tty.reset}") diff --git a/Library/Homebrew/test/cmd/help_spec.rb b/Library/Homebrew/test/cmd/help_spec.rb index ab80b69f01..df4b7dd3c3 100644 --- a/Library/Homebrew/test/cmd/help_spec.rb +++ b/Library/Homebrew/test/cmd/help_spec.rb @@ -20,7 +20,7 @@ describe "brew", :integration_test do it "prints help for a documented shell command" do expect { brew "help", "update" } - .to output(/^brew update/).to_stdout + .to output(/^Usage: brew update/).to_stdout .and be_a_success end From f1d6c0f5a459e0a3ebefc6b15646e35d40d3ff80 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:35:01 +0000 Subject: [PATCH 115/199] completions/zsh: fix a typo. --- completions/zsh/_brew | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/completions/zsh/_brew b/completions/zsh/_brew index baf8e79d07..8e5feaeb78 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -115,7 +115,7 @@ __brew_common_commands() { 'link:link a formula' 'list:list files in a formula or not-installed formulae' 'log:git commit log for a formula' - 'missing:check all installed formuale for missing dependencies.' + 'missing:check all installed formulae for missing dependencies.' 'migrate:migrate renamed formula to new name' 'outdated:list formulae for which a newer version is available' 'pin:pin specified formulae' From 2446aea729ec0ee60079372535d8d8bd582c11f2 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:35:32 +0000 Subject: [PATCH 116/199] manpages: commit updates. --- docs/Manpage.md | 1239 +++++++++++++++++---------------------- manpages/brew.1 | 1466 +++++++++++++++++++++++------------------------ 2 files changed, 1243 insertions(+), 1462 deletions(-) diff --git a/docs/Manpage.md b/docs/Manpage.md index 0e9dcfdc09..7ecec9fa7f 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -18,706 +18,625 @@ For the full command list, see the [COMMANDS](#commands) section. With `--verbose` or `-v`, many commands print extra debugging information. Note that these flags should only appear after a command. - * `install` *`formula`*: - Install *`formula`*. +### `install` *`formula`*: - * `uninstall` *`formula`*: - Uninstall *`formula`*. +Install *`formula`*. - * `update`: - Fetch the newest version of Homebrew from GitHub using `git`(1). +### `uninstall` *`formula`*: - * `list`: - List all installed formulae. +Uninstall *`formula`*. - * `search` (*`text`*|`/`*`text`*`/`): - Perform a substring search of cask tokens and formula names for *`text`*. If *`text`* - is surrounded with slashes, then it is interpreted as a regular expression. - The search for *`text`* is extended online to `homebrew/core` and `homebrew/cask`. - If no search term is given, all locally available formulae are listed. +### `list`: + +List all installed formulae. + +### `search` (*`text`*|`/`*`text`*`/`): +Perform a substring search of cask tokens and formula names for *`text`*. If *`text`* +is surrounded with slashes, then it is interpreted as a regular expression. +The search for *`text`* is extended online to `homebrew/core` and `homebrew/cask`. +If no search term is given, all locally available formulae are listed. ## COMMANDS - * `analytics` [`state`]: - Display anonymous user behaviour analytics state. - Read more at . +### `analytics` (`on`|`off`) [`state`] [`regenerate-uuid`] - * `analytics` (`on`|`off`): - Turn on/off Homebrew's analytics. +If `on`|`off` is passed, turn Homebrew's analytics on or off respectively. - * `analytics` `regenerate-uuid`: - Regenerate UUID used in Homebrew's analytics. +If `state` is passed, display anonymous user behaviour analytics state. +Read more at . - * `cat` *`formula`*: - Display the source to *`formula`*. +If `regenerate-uuid` is passed, regenerate UUID used in Homebrew's analytics. - * `cleanup` [`--prune=`*`days`*] [`--dry-run`] [`-s`] [*`formulae`*|*`casks`*]: - Remove stale lock files and outdated downloads for formulae and casks, - and remove old versions of installed formulae. If arguments are specified, - only do this for the specified formulae and casks. +### `cat` *`formula`* - If `--prune=`*`days`* is specified, remove all cache files older than *`days`*. +Display the source to *`formula`*. - If `--dry-run` or `-n` is passed, show what would be removed, but do not - actually remove anything. +### `cleanup` [*`options`*] [*`formula`*|*`cask`*] - If `-s` is passed, scrub the cache, including downloads for even the latest - versions. Note downloads for any installed formula or cask will still not - be deleted. If you want to delete those too: `rm -rf "$(brew --cache)"` +Remove stale lock files and outdated downloads for formulae and casks, +and remove old versions of installed formulae. If arguments are specified, +only do this for the specified formulae and casks. - * `command` *`cmd`*: - Display the path to the file which is used when invoking `brew` *`cmd`*. +* `--prune`: + Remove all cache files older than specified *`days`*. +* `-n`, `--dry-run`: + Show what would be removed, but do not actually remove anything. +* `-s`: + Scrub the cache, including downloads for even the latest versions. Note downloads for any installed formula or cask will still not be deleted. If you want to delete those too: `rm -rf "$(brew --cache)"` + +### `command` *`cmd`* + +Display the path to the file which is used when invoking `brew` *`cmd`*. + +### `commands` [*`options`*] + +Show a list of built-in and external commands. + +* `--include-aliases`: + Include the aliases of internal commands. + +### `config` - * `commands` [`--quiet` [`--include-aliases`]]: - Show a list of built-in and external commands. +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. - If `--quiet` is passed, list only the names of commands without the header. - With `--include-aliases`, the aliases of internal commands will be included. +### `deps` [*`options`*] *`formula`* + +Show dependencies for *`formula`*. When given multiple formula arguments, +show the intersection of dependencies for *`formula`*. + +* `--1`: + Only show dependencies one level down, instead of recursing. +* `-n`: + Show dependencies in topological order. +* `--union`: + Show the union of dependencies for *`formula`*, instead of the intersection. +* `--full-name`: + List dependencies by their full name. +* `--installed`: + Only list those dependencies that are currently installed. +* `--all`: + List all the dependencies for all available formulae. +* `--include-build`: + Show `:build` type dependencies for *`formula`*. +* `--include-optional`: + Show `:optional` dependencies for *`formula`*. +* `--include-test`: + Show `:test` dependencies for *`formula`* (non-recursive). +* `--skip-recommended`: + Skip `:recommended` type dependencies for *`formula`*. +* `--include-requirements`: + Include requirements in addition to dependencies for *`formula`*. +* `--tree`: + Show dependencies as a tree. When given multiple formula arguments output individual trees for every formula. +* `--for-each`: + Switch into the mode used by `deps --all`, but only list dependencies for specified formula one specified formula per line. This is used for debugging the `--installed`/`--all` display mode. + +### `desc` [*`options`*] (*`text`*|`/`*`text`*`/`|*`formula`*) + +Display *`formula`*'s name and one-line description. +Formula descriptions are cached; the cache is created on the +first search, making that search slower than subsequent ones. + +* `-s`, `--search`: + Search both name and description for provided *`text`*. If *`text`* is flanked by slashes, it is interpreted as a regular expression. +* `-n`, `--name`: + Search just the names for provided *`text`*. If *`text`* is flanked by slashes, it is interpreted as a regular expression. +* `-d`, `--description`: + Search just the descriptions for provided *`text`*. If *`text`* is flanked by slashes, it is interpreted as a regular expression. + +### `diy` [*`options`*] + +Automatically determine the installation prefix for non-Homebrew software. +Using the output from this command, you can install your own software into +the Cellar and then link it into Homebrew's prefix with `brew link`. + +* `--name`: + Explicitly set the provided *`name`* of the package being installed. +* `--version`: + Explicitly set the provided *`version`* of the package being installed. + +### `doctor` [*`options`*] + +Check your system for potential problems. Doctor exits with a non-zero status +if any potential problems are found. Please note that these warnings are just +used to help the Homebrew maintainers with debugging if you file an issue. If +everything you use Homebrew for is working fine: please don't worry or file +an issue; just ignore this. + +* `--list-checks`: + List all audit methods. +* `-D`, `--audit-debug`: + Enable debugging and profiling of audit methods. + +### `fetch` [*`options`*] *`formula`* + +Download the source packages for the given *`formula`*. +For tarballs, also print SHA-256 checksums. + +* `--HEAD`: + Fetch HEAD version instead of stable version. +* `--devel`: + Fetch development version instead of stable version. +* `--retry`: + Retry if a download fails or re-download if the checksum of a previously cached version no longer matches. +* `--deps`: + Download dependencies for any listed *`formula`*. +* `-s`, `--build-from-source`: + Download the source for rather than a bottle. +* `--build-bottle`: + Download the source (for eventual bottling) rather than a bottle. +* `--force-bottle`: + Download a bottle if it exists for the current or newest version of macOS, even if it would not be used during installation. + +### `gist-logs` [*`options`*] *`formula`* + +Upload logs for a failed build of *`formula`* to a new Gist. + +*`formula`* is usually the name of the formula to install, but it can be specified +in several different ways. + +If no logs are found, an error message is presented. + +* `--with-hostname`: + Include the hostname in the Gist. +* `-n`, `--new-issue`: + Automatically create a new issue in the appropriate GitHub repository as well as creating the Gist. +* `-p`, `--private`: + The Gist will be marked private and will not appear in listings but will be accessible with the link. + +### `home` [*`formula`*] + +Open *`formula`*'s homepage in a browser. If no formula is provided, +open Homebrew's own homepage in a browser. + +### `info` [*`formula`*] + +Display brief statistics for your Homebrew installation. + +* `--analytics`: + Display Homebrew analytics data (provided neither `HOMEBREW_NO_ANALYTICS` or `HOMEBREW_NO_GITHUB_API` are set). +* `--days`: + The value for `days` must be `30`, `90` or `365`. The default is `30`. +* `--category`: + The value for `category` must be `install`, `install-on-request`, `build-error` or `os-version`. The default is `install`. +* `--github`: + Open a browser to the GitHub History page for provided *`formula`*. To view formula history locally: `brew log -p` *`formula`* +* `--json`: + Print a JSON representation of *`formula`*. Currently the default and only accepted value for *`version`* is `v1`. See the docs for examples of using the JSON output: +* `--all`: + Get information on all formulae. +* `--installed`: + Get information on all installed formulae. + +### `install` [*`options`*] *`formula`* + +Install *`formula`*. + +*`formula`* is usually the name of the formula to install, but it can be specified +in several different ways. + +* `--env`: + If `std` is passed, use the standard build environment instead of superenv.If `super` is passed, use superenv even if the formula specifies the standard build environment. +* `--ignore-dependencies`: + Skip installing any dependencies of any kind. If they are not already present, the formula will probably fail to install. +* `--only-dependencies`: + Install the dependencies with specified options but do not install the specified formula. +* `--cc`: + Attempt to compile using provided *`compiler`*. *`compiler`* should be the name of the compiler's executable, for instance `gcc-7` for GCC 7. In order to use LLVM's clang, use `llvm_clang`. To specify the Apple-provided clang, use `clang`. This parameter will only accept compilers that are provided by Homebrew or bundled with macOS. Please do not file issues if you encounter errors while using this flag. +* `-s`, `--build-from-source`: + Compile the specified *`formula`* from source even if a bottle is provided. Dependencies will still be installed from bottles if they are available. +* `--force-bottle`: + Install from a bottle if it exists for the current or newest version of macOS, even if it would not normally be used for installation. +* `--include-test`: + Install testing dependencies required to run `brew test`. +* `--devel`: + If *`formula`* defines it, install the development version. +* `--HEAD`: + If *`formula`* defines it, install the HEAD version, aka. master, trunk, unstable. +* `--fetch-HEAD`: + Fetch the upstream repository to detect if the HEAD installation of the formula is outdated. Otherwise, the repository's HEAD will be checked for updates when a new stable or development version has been released. +* `--keep-tmp`: + Don't delete the temporary files created during installation. +* `--build-bottle`: + Prepare the formula for eventual bottling during installation. +* `--display-times`: + Print install times for each formula at the end of the run. +* `-i`, `--interactive`: + Download and patch *`formula`*, then open a shell. This allows the user to run `./configure --help` and otherwise determine how to turn the software package into a Homebrew package. +* `-g`, `--git`: + Create a Git repository, useful for creating patches to the software. + +### `leaves` + +Show installed formulae that are not dependencies of another installed formula. + +### `ln`, `link` [*`options`*] *`formula`* + +Symlink all of *`formula`*'s installed files into the Homebrew prefix. This +is done automatically when you install formulae but can be useful for DIY +installations. + +* `--overwrite`: + Delete files already existing in the prefix while linking. +* `-n`, `--dry-run`: + List all files which would be linked or deleted by `brew link --overwrite`, but will not actually link or delete any files. + +### `list`, `ls` [*`options`*] + +List all installed formulae. + +* `--full-name`: + Print formulae with fully-qualified names. If `--full-name` is not passed, other options (i.e. `-1`, `-l`, `-t` and `-r`) are passed to `ls` which produces the actual output. +* `--unbrewed`: + List all files in the Homebrew prefix not installed by Homebrew. +* `--versions`: + Show the version number for installed formulae, or only the specified formulae if *`formula`* are given. +* `--multiple`: + Only show formulae with multiple versions installed. +* `--pinned`: + Show the versions of pinned formulae, or only the specified (pinned) formulae if *`formula`* are given. See also `pin`, `unpin`. +* `-1`: + Force output to be one entry per line. This is the default when output is not to a terminal. +* `-l`: + List in long format. If the output is to a terminal, a total sum for all the file sizes is output on a line before the long listing. +* `-r`: + Reverse the order of the sort to get the oldest entries first. +* `-t`: + Sort by time modified (most recently modified first). + +### `log` [*`options`*] *`formula`* + +Show the `git log` for the given *`formula`*. + +* `-p`, `--patch`: + Also output patch from commit. +* `--stat`: + Also output diffstat from commit. +* `--oneline`: + Output only one line per commit. +* `-1`, `--max-count`: + Output only one commit. + +### `migrate` [*`options`*] *`formula`* + +Migrate renamed packages to new name, where *`formula`* are old names of +packages. + +### `missing` [*`options`*] [*`formule`*] + +Check the given *`formula`* for missing dependencies. If no *`formula`* are +given, check all installed brews. + +`missing` exits with a non-zero status if any formulae are missing dependencies. + +* `--hide`: + Act as if none of the provided *`hidden`* are installed. *`hidden`* should be comma-separated list of formulae. + +### `options` [*`options`*] *`formula`* + +Display install options specific to *`formula`* + +* `--compact`: + Show all options on a single line separated by spaces. +* `--all`: + Show options for all formulae. +* `--installed`: + Show options for all installed formulae. + +### `outdated` [*`options`*] + +Show formulae that have an updated version available. + +By default, version information is displayed in interactive shells, and +suppressed otherwise. + +* `--json`: + Show output in JSON format for provided *`version`*. Currently the only accepted value of *`version`* is `v1`. +* `--fetch-HEAD`: + Fetch the upstream repository to detect if the HEAD installation of the formula is outdated. Otherwise, the repository's HEAD will be checked for updates when a new stable or development version has been released. - * `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. +### `pin` *`formula`* - * `deps` [`--1`] [`-n`] [`--union`] [`--full-name`] [`--installed`] [`--include-build`] [`--include-optional`] [`--skip-recommended`] [`--include-requirements`] *`formula`*: - Show dependencies for *`formula`*. When given multiple formula arguments, - show the intersection of dependencies for every formula. +Pin the specified *`formula`*, preventing them from being upgraded when +issuing the `brew upgrade` *`formula`* command. See also `unpin`. - If `--1` is passed, only show dependencies one level down, instead of - recursing. +### `postinstall` *`formula`* - If `-n` is passed, show dependencies in topological order. +Rerun the post-install steps for *`formula`*. - If `--union` is passed, show the union of dependencies for *`formula`*, - instead of the intersection. +### `readall` [*`options`*] [*`tap`*] - If `--full-name` is passed, list dependencies by their full name. +Import all formulae from specified *`tap`* (defaults to all installed taps). +This can be useful for debugging issues across all formulae when making +significant changes to `formula.rb`, testing the performance of loading +all formulae or to determine if any current formulae have Ruby issues. - If `--installed` is passed, only list those dependencies that are - currently installed. +* `--aliases`: + Verify any alias symlinks in each tap. +* `--syntax`: + Syntax-check all of Homebrew's Ruby files. - By default, `deps` shows required and recommended dependencies for - *`formula`*. To include the `:build` type dependencies, pass `--include-build`. - Similarly, pass `--include-optional` to include `:optional` dependencies or - `--include-test` to include (non-recursive) `:test` dependencies. - To skip `:recommended` type dependencies, pass `--skip-recommended`. - To include requirements in addition to dependencies, pass `--include-requirements`. +### `reinstall` [*`options`*] *`formula`* - * `deps` `--tree` [`--1`] [*`filters`*] [`--annotate`] (*`formula`*|`--installed`): - Show dependencies as a tree. When given multiple formula arguments, output - individual trees for every formula. +Uninstall and then install *`formula`* (with existing and any appended install options). - If `--1` is passed, only one level of children is displayed. +* `-s`, `--build-from-source`: + Compile *`formula`* from source even if a bottle is available. +* `--force-bottle`: + Install from a bottle if it exists for the current or newest version of macOS, even if it would not normally be used for installation. +* `--keep-tmp`: + Don't delete the temporary files created during installation. +* `--display-times`: + Print install times for each formula at the end of the run. - If `--installed` is passed, output a tree for every installed formula. +### `search` [*`options`*] [*`text`*|`/`*`text`*`/`] - The *`filters`* placeholder is any combination of options `--include-build`, - `--include-optional`, `--include-test`, `--skip-recommended`, and - `--include-requirements` as documented above. + Perform a substring search of cask tokens and formula names for *`text`*. If *`text`* + is surrounded with slashes, then it is interpreted as a regular expression. + The search for *`text`* is extended online to `homebrew/core` and `homebrew/cask`. - If `--annotate` is passed, the build, optional, and recommended dependencies - are marked as such in the output. + If no *`text`* is passed, display all locally available formulae (including tapped ones). + No online search is performed. - * `deps` [*`filters`*] (`--installed`|`--all`): - Show dependencies for installed or all available formulae. Every line of - output starts with the formula name, followed by a colon and all direct - dependencies of that formula. +* `--casks`: + Display all locally available casks (including tapped ones). No online search is performed. +* `--desc`: + search formulae with a description matching *`text`* and casks with a name matching *`text`*. +* `--macports`: + Search for *`text`* in the given package manager's list. +* `--fink`: + Search for *`text`* in the given package manager's list. +* `--opensuse`: + Search for *`text`* in the given package manager's list. +* `--fedora`: + Search for *`text`* in the given package manager's list. +* `--debian`: + Search for *`text`* in the given package manager's list. +* `--ubuntu`: + Search for *`text`* in the given package manager's list. - The *`filters`* placeholder is any combination of options `--include-build`, - `--include-optional`, `--include-test`, and `--skip-recommended` as - documented above. +### `sh` [*`options`*] - Additional options specific to *`formula`* may be appended to the command, - and can be listed with `brew options` *`formula`*. +Start a Homebrew build environment shell. Uses our years-battle-hardened +Homebrew build logic to help your `./configure && make && make install` +or even your `gem install` succeed. Especially handy if you run Homebrew +in an Xcode-only configuration since it adds tools like `make` to your `PATH` +which otherwise build systems would not find. - * `desc` *`formula`*: - Display *`formula`*'s name and one-line description. +* `--env`: + Use the standard `PATH` instead of superenv's, when *`std`* is passed - * `desc` [`--search`|`--name`|`--description`] (*`text`*|`/`*`text`*`/`): - Search both name and description (`--search` or `-s`), just the names - (`--name` or `-n`), or just the descriptions (`--description` or `-d`) for - *`text`*. If *`text`* is flanked by slashes, it is interpreted as a regular - expression. Formula descriptions are cached; the cache is created on the - first search, making that search slower than subsequent ones. +### `shellenv` +Prints export statements - run them in a shell and this installation of Homebrew will be included into your `PATH`, `MANPATH` and `INFOPATH`. - * `diy` [`--name=`*`name`*] [`--version=`*`version`*]: - Automatically determine the installation prefix for non-Homebrew software. +`HOMEBREW_PREFIX`, `HOMEBREW_CELLAR` and `HOMEBREW_REPOSITORY` are also exported to save multiple queries of those variables. - Using the output from this command, you can install your own software into - the Cellar and then link it into Homebrew's prefix with `brew link`. +Consider adding evaluating the output in your dotfiles (e.g. `~/.profile`) with `eval $(brew shellenv)` - The options `--name=`*`name`* and `--version=`*`version`* each take an argument - and allow you to explicitly set the name and version of the package you are - installing. +### `style` [*`options`*] [*`file`*|*`tap`*|*`formula`*] - * `doctor`: - Check your system for potential problems. Doctor exits with a non-zero status - if any potential problems are found. Please note that these warnings are just - used to help the Homebrew maintainers with debugging if you file an issue. If - everything you use Homebrew for is working fine: please don't worry or file - an issue; just ignore this. +Check formulae or files for conformance to Homebrew style guidelines. - * `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. +Lists of *`file`*, *`tap`* and *`formula`* may not be combined. If none are +provided, `style` will run style checks on the whole Homebrew library, +including core code and all formulae. - If `--HEAD` or `--devel` is passed, fetch that version instead of the - stable version. +* `--fix`: + Fix style violations automatically using RuboCop's auto-correct feature. +* `--display-cop-names`: + Include the RuboCop cop name for each violation in the output. +* `--only-cops`: + Specify a comma-separated *`cops`* list to check for violations of only the listed RuboCop cops. +* `--except-cops`: + Specify a comma-separated *`cops`* list to skip checking for violations of the listed RuboCop cops. - If `-v` is passed, do a verbose VCS checkout, if the URL represents a VCS. - This is useful for seeing if an existing VCS cache has been updated. +### `switch` *`formula`* *`version`* - If `--force` (or `-f`) is passed, remove a previously cached version and re-fetch. +Symlink all of the specific *`version`* of *`formula`*'s install to Homebrew prefix. - If `--retry` is passed, retry if a download fails or re-download if the - checksum of a previously cached version no longer matches. +### `tap` [*`options`*] *`user`*`/`*`repo`* [*`URL`*] - If `--deps` is passed, also download dependencies for any listed *`formulae`*. +Tap a formula repository. - If `--build-from-source` (or `-s`) or `--build-bottle` is passed, download the - source rather than a bottle. +List all installed taps when no arguments are passed. - If `--force-bottle` is passed, download a bottle if it exists for the - current or newest version of macOS, even if it would not be used during - installation. +With *`URL`* unspecified, taps a formula repository from GitHub using HTTPS. +Since so many taps are hosted on GitHub, this command is a shortcut for +`brew tap` *`user`*`/`*`repo`* `https://github.com/`*`user`*`/homebrew-`*`repo`*. - * `gist-logs` [`--new-issue`|`-n`] [`--private`|`-p`] *`formula`*: - Upload logs for a failed build of *`formula`* to a new Gist. +With *`URL`* specified, taps a formula repository from anywhere, using +any transport protocol that `git` handles. The one-argument form of `tap` +simplifies but also limits. This two-argument command makes no +assumptions, so taps can be cloned from places other than GitHub and +using protocols other than HTTPS, e.g., SSH, GIT, HTTP, FTP(S), RSYNC. - *`formula`* is usually the name of the formula to install, but it can be specified - in several different ways. +* `--full`: + Use a full clone when tapping a repository. By default, the repository is cloned as a shallow copy (`--depth=1`). To convert a shallow copy to a full copy, you can retap passing `--full` without first untapping. +* `--force-auto-update`: + Auto-update tap even if it is not hosted on GitHub. By default, only taps hosted on GitHub are auto-updated (for performance reasons). +* `--repair`: + Migrate tapped formulae from symlink-based to directory-based structure. +* `--list-pinned`: + List all pinned taps. +* `-q`, `--quieter`: + Suppress any warnings. - If `--with-hostname` is passed, include the hostname in the Gist. +### `tap-info` [*`options`*] [*`tap`*] - If `--new-issue` is passed, automatically create a new issue in the appropriate - GitHub repository as well as creating the Gist. +Display detailed information about one or more provided *`tap`*. +Display a brief summary of all installed taps if no *`tap`* are passed. - If `--private` is passed, the Gist will be marked private and will not - appear in listings but will be accessible with the link. +* `--installed`: + Display information on all installed taps. +* `--json`: + Print a JSON representation of *`taps`*. Currently the only accepted value for *`version`* is `v1`. See the docs for examples of using the JSON output: - If no logs are found, an error message is presented. +### `tap-pin` *`tap`* - * `home`: - Open Homebrew's own homepage in a browser. +Pin *`tap`*, prioritising its formulae over core when formula names are supplied +by the user. See also `tap-unpin`. - * `home` *`formula`*: - Open *`formula`*'s homepage in a browser. +### `tap-unpin` *`tap`* - * `info`: - Display brief statistics for your Homebrew installation. +Unpin *`tap`* so its formulae are no longer prioritised. See also `tap-pin`. - * `info` `--analytics` [`--days=`*`days`*] [`--category=`*`category`*]: - Display Homebrew analytics data (provided neither `HOMEBREW_NO_ANALYTICS` - or `HOMEBREW_NO_GITHUB_API` are set) +### `uninstall`, `rm`, `remove` [*`options`*] *`formula`* - The value for `days` must be `30`, `90` or `365`. The default is `30`. +Uninstall *`formula`*. - The value for `category` must be `install`, `install-on-request`, - `build-error` or `os-version`. The default is `install`. +* `--ignore-dependencies`: + Don't fail uninstall, even if *`formula`* is a dependency of any installed formulae. - * `info` *`formula`* [`--analytics`]: - Display information about *`formula`* and analytics data (provided neither - `HOMEBREW_NO_ANALYTICS` or `HOMEBREW_NO_GITHUB_API` are set) +### `unlink` [*`options`*] *`formula`* - Pass `--verbose` to see more verbose analytics data. +Remove symlinks for *`formula`* from the Homebrew prefix. This can be useful +for temporarily disabling a formula: +`brew unlink` *`formula`* `&&` *`commands`* `&& brew link` *`formula`* - Pass `--analytics` to see only more verbose analytics data instead of - formula information. +* `-n`, `--dry-run`: + List all files which would be unlinked, but will not actually unlink or delete any files. - * `info` `--github` *`formula`*: - Open a browser to the GitHub History page for *`formula`*. +### `unpack` [*`options`*] *`formula`* - To view formula history locally: `brew log -p` *`formula`* +Unpack the source files for *`formula`* into subdirectories of the current +working directory. - * `info` `--json[=`*`version`*] (`--all`|`--installed`|*`formulae`*): - Print a JSON representation of *`formulae`*. Currently the default and - only accepted value for *`version`* is `v1`. +* `--destdir`: + Create subdirectories in the directory named by *`path`* instead. +* `--patch`: + Patches for *`formula`* will be applied to the unpacked source. +* `-g`, `--git`: + Initialise a Git repository in the unpacked source. This is useful for creating patches for the software. - Pass `--all` to get information on all formulae, or `--installed` to get - information on all installed formulae. +### `unpin` *`formula`* - See the docs for examples of using the JSON output: - +Unpin *`formula`*, allowing them to be upgraded by `brew upgrade` *`formula`*. +See also `pin`. - * `install` [`--debug`] [`--env=`(`std`|`super`)] [`--ignore-dependencies`|`--only-dependencies`] [`--cc=`*`compiler`*] [`--build-from-source`|`--force-bottle`] [`--include-test`] [`--devel`|`--HEAD`] [`--keep-tmp`] [`--build-bottle`] [`--force`] [`--verbose`] [`--display-times`] *`formula`* [*`options`* ...]: - Install *`formula`*. +### `untap` *`tap`* - *`formula`* is usually the name of the formula to install, but it can be specified - in several different ways. +Remove a tapped repository. - If `--debug` (or `-d`) is passed and brewing fails, open an interactive debugging - session with access to IRB or a shell inside the temporary build directory. +### `update` [*`options`*] +Fetch the newest version of Homebrew and all formulae from GitHub using `git`(1) and perform any necessary migrations. - If `--env=std` is passed, use the standard build environment instead of superenv. +* `--merge`: + `git merge` is used to include updates (rather than `git rebase`). - If `--env=super` is passed, use superenv even if the formula specifies the - standard build environment. +* `--force`: + Always do a slower, full update check (even if unnecessary). - If `--ignore-dependencies` is passed, skip installing any dependencies of - any kind. If they are not already present, the formula will probably fail - to install. +### `update-reset` [*`repository`*] +Fetches and resets Homebrew and all tap repositories (or any specified `repository`) using `git`(1) to their latest `origin/master`. Note this will destroy all your uncommitted or committed changes. - If `--only-dependencies` is passed, install the dependencies with specified - options but do not install the specified formula. +### `upgrade` [*`options`*] *`formula`* - If `--cc=`*`compiler`* is passed, attempt to compile using *`compiler`*. - *`compiler`* should be the name of the compiler's executable, for instance - `gcc-7` for GCC 7. In order to use LLVM's clang, use `llvm_clang`. - To specify the Apple-provided clang, use `clang`. - This parameter will only accept compilers that are provided by Homebrew or - bundled with macOS. Please do not file issues if you encounter errors - while using this flag. +Upgrade outdated, unpinned brews (with existing and any appended install options). - If `--build-from-source` (or `-s`) is passed, compile the specified *`formula`* from - source even if a bottle is provided. Dependencies will still be installed - from bottles if they are available. +If *`formula`* are given, upgrade only the specified brews (unless they +are pinned; see `pin`, `unpin`). - If `--force-bottle` is passed, install from a bottle if it exists for the - current or newest version of macOS, even if it would not normally be used - for installation. +* `-s`, `--build-from-source`: + Compile *`formula`* from source even if a bottle is available. +* `--force-bottle`: + Install from a bottle if it exists for the current or newest version of macOS, even if it would not normally be used for installation. +* `--fetch-HEAD`: + Fetch the upstream repository to detect if the HEAD installation of the formula is outdated. Otherwise, the repository's HEAD will be checked for updates when a new stable or development version has been released. +* `--ignore-pinned`: + Set a 0 exit code even if pinned formulae are not upgraded. +* `--keep-tmp`: + Don't delete the temporary files created during installation. +* `--display-times`: + Print install times for each formula at the end of the run. - If `--include-test` is passed, install testing dependencies. These are only - needed by formulae maintainers to run `brew test`. +### `uses` [*`options`*] *`formula`* - If `--devel` is passed, and *`formula`* defines it, install the development version. +Show the formulae that specify *`formula`* as a dependency. When given +multiple formula arguments, show the intersection of formulae that use +*`formula`*. - If `--HEAD` is passed, and *`formula`* defines it, install the HEAD version, - aka. master, trunk, unstable. +By default, `uses` shows all formulae that specify *`formula`* as a required +or recommended dependency. - If `--keep-tmp` is passed, the temporary files created during installation - are not deleted. +By default, `uses` shows usage of *`formula`* by stable builds. - If `--build-bottle` is passed, prepare the formula for eventual bottling - during installation. +* `--recursive`: + Resolve more than one level of dependencies. +* `--installed`: + Only list installed formulae. +* `--include-build`: + Include all formulae that specify *`formula`* as `:build` type dependency. +* `--include-test`: + Include all formulae that specify *`formula`* as `:test` type dependency. +* `--include-optional`: + Include all formulae that specify *`formula`* as `:optional` type dependency. +* `--skip-recommended`: + Skip all formulae that specify *`formula`* as `:recommended` type dependency. +* `--devel`: + Show usage of *`formula`* by development build. +* `--HEAD`: + Show usage of *`formula`* by HEAD build. - If `--force` (or `-f`) is passed, install without checking for previously - installed keg-only or non-migrated versions +### `--cache` [*`options`*] [*`formula`*] - If `--verbose` (or `-v`) is passed, print the verification and postinstall steps. +Display Homebrew's download cache. See also `HOMEBREW_CACHE`. - If `--display-times` is passed, install times for each formula are printed - at the end of the run. +If *`formula`* is provided, display the file or directory used to cache *`formula`*. - Installation options specific to *`formula`* may be appended to the command, - and can be listed with `brew options` *`formula`*. +* `-s`, `--build-from-source`: + Show the cache file used when building from source. +* `--force-bottle`: + Show the cache file used when pouring a bottle. - * `install` `--interactive` [`--git`] *`formula`*: - If `--interactive` (or `-i`) is passed, download and patch *`formula`*, then - open a shell. This allows the user to run `./configure --help` and - otherwise determine how to turn the software package into a Homebrew - formula. +### `--cache` [*`formula`*] - If `--git` (or `-g`) is passed, Homebrew will create a Git repository, useful for - creating patches to the software. +Display Homebrew's Cellar path. *Default:* `$(brew --prefix)/Cellar`, or if +that directory doesn't exist, `$(brew --repository)/Cellar`. - * `leaves`: - Show installed formulae that are not dependencies of another installed formula. +If *`formula`* is provided, display the location in the cellar where *`formula`* +would be installed, without any sort of versioned directory as the last path. - * `ln`, `link` [`--overwrite`] [`--dry-run`] [`--force`] *`formula`*: - Symlink all of *`formula`*'s installed files into the Homebrew prefix. This - is done automatically when you install formulae but can be useful for DIY - installations. +### `--env` [*`options`*] - If `--overwrite` is passed, Homebrew will delete files which already exist in - the prefix while linking. +Show a summary of the Homebrew build environment as a plain list. - If `--dry-run` or `-n` is passed, Homebrew will list all files which would - be linked or which would be deleted by `brew link --overwrite`, but will not - actually link or delete any files. +If the command's output is sent through a pipe and no shell is specified, +the list is formatted for export to `bash`(1) unless `--plain` is passed. - If `--force` (or `-f`) is passed, Homebrew will allow keg-only formulae to be linked. +* `--shell`: + Generate a list of environment variables for the specified shell, or `--shell=auto` to detect the current shell. +* `--plain`: + Plain output even when piped. - * `list`, `ls` [`--full-name`] [`-1`] [`-l`] [`-t`] [`-r`]: - List all installed formulae. If `--full-name` is passed, print formulae - with fully-qualified names. If `--full-name` is not passed, other - options (i.e. `-1`, `-l`, `-t` and `-r`) are passed to `ls` which produces the actual output. +### `--prefix` [*`formula`*] - * `list`, `ls` `--unbrewed`: - List all files in the Homebrew prefix not installed by Homebrew. +Display Homebrew's install path. *Default:* `/usr/local` on macOS and +`/home/linuxbrew/.linuxbrew` on Linux. - * `list`, `ls` [`--verbose`] [`--versions` [`--multiple`]] [`--pinned`] [*`formulae`*]: - List the installed files for *`formulae`*. Combined with `--verbose`, recursively - list the contents of all subdirectories in each *`formula`*'s keg. +If *`formula`* is provided, display the location in the cellar where *`formula`* +is or would be installed. - If `--versions` is passed, show the version number for installed formulae, - or only the specified formulae if *`formulae`* are given. With `--multiple`, - only show formulae with multiple versions installed. +### `--repository` [*`formula`*] - If `--pinned` is passed, show the versions of pinned formulae, or only the - specified (pinned) formulae if *`formulae`* are given. - See also `pin`, `unpin`. +Display where Homebrew's `.git` directory is located. - * `log` [*`git-log-options`*] *`formula`* ...: - Show the git log for the given formulae. Options that `git-log`(1) - recognizes can be passed before the formula list. +If *`user`*`/`*`repo`* are provided, display where tap *`user`*`/`*`repo`*'s directory is located. - * `migrate` [`--force`] *`formulae`*: - Migrate renamed packages to new name, where *`formulae`* are old names of - packages. +### `--version` - If `--force` (or `-f`) is passed, then treat installed *`formulae`* and passed *`formulae`* - like if they are from same taps and migrate them anyway. - - * `missing` [`--hide=`*`hidden`*] [*`formulae`*]: - Check the given *`formulae`* for missing dependencies. If no *`formulae`* are - given, check all installed brews. - - If `--hide=`*`hidden`* is passed, act as if none of *`hidden`* are installed. - *`hidden`* should be a comma-separated list of formulae. - - `missing` exits with a non-zero status if any formulae are missing dependencies. - - * `options` [`--compact`] (`--all`|`--installed`|*`formulae`*): - Display install options specific to *`formulae`*. - - If `--compact` is passed, show all options on a single line separated by - spaces. - - If `--all` is passed, show options for all formulae. - - If `--installed` is passed, show options for all installed formulae. - - * `outdated` [`--quiet`|`--verbose`|`--json=`*`version`*] [`--fetch-HEAD`]: - Show formulae that have an updated version available. - - By default, version information is displayed in interactive shells, and - suppressed otherwise. - - If `--quiet` is passed, list only the names of outdated brews (takes - precedence over `--verbose`). - - If `--verbose` (or `-v`) is passed, display detailed version information. - - If `--json=`*`version`* is passed, the output will be in JSON format. - Currently the only accepted value for *`version`* is `v1`. - - If `--fetch-HEAD` is passed, fetch the upstream repository to detect if - the HEAD installation of the formula is outdated. Otherwise, the - repository's HEAD will be checked for updates when a new stable or devel - version has been released. - - * `pin` *`formulae`*: - Pin the specified *`formulae`*, preventing them from being upgraded when - issuing the `brew upgrade` *`formulae`* command. See also `unpin`. - - * `postinstall` *`formula`*: - Rerun the post-install steps for *`formula`*. - - * `prune` [`--dry-run`]: - Deprecated. Use `brew cleanup` instead. - - * `readall` [`--aliases`] [`--syntax`] [*`taps`*]: - Import all formulae from specified *`taps`* (defaults to all installed taps). - - This can be useful for debugging issues across all formulae when making - significant changes to `formula.rb`, testing the performance of loading - all formulae or to determine if any current formulae have Ruby issues. - - If `--aliases` is passed, also verify any alias symlinks in each tap. - - If `--syntax` is passed, also syntax-check all of Homebrew's Ruby files. - - * `reinstall` [`--debug`] [`--build-from-source`|`--force-bottle`] [`--keep-tmp`] [`--force`] [`--verbose`] [`--display-times`] *`formula`*: - Uninstall and then install *`formula`* (with existing and any appended install options). - - If `--debug` (or `-d`) is passed and brewing fails, open an interactive debugging - session with access to IRB or a shell inside the temporary build directory. - - If `--build-from-source` (or `-s`) is passed, compile the specified *`formula`* from - source even if a bottle is provided. Dependencies will still be installed - from bottles if they are available. - - If `--force-bottle` is passed, install from a bottle if it exists for the - current or newest version of macOS, even if it would not normally be used - for installation. - - If `--keep-tmp` is passed, the temporary files created during installation - are not deleted. - - If `--force` (or `-f`) is passed, install without checking for previously - installed keg-only or non-migrated versions - - If `--verbose` (or `-v`) is passed, print the verification and postinstall steps. - - If `--display-times` is passed, install times for each formula are printed - at the end of the run. - - Installation options specific to *`formula`* may be appended to the command, - and can be listed with `brew options` *`formula`*. - - * `search`, `-S`: - Display all locally available formulae (including tapped ones). - No online search is performed. - - * `search` `--casks`: - Display all locally available casks (including tapped ones). - No online search is performed. - - * `search` [`--desc`] (*`text`*|`/`*`text`*`/`): - Perform a substring search of cask tokens and formula names for *`text`*. If *`text`* - is surrounded with slashes, then it is interpreted as a regular expression. - The search for *`text`* is extended online to `homebrew/core` and `homebrew/cask`. - - If `--desc` is passed, search formulae with a description matching *`text`* and - casks with a name matching *`text`*. - - * `search` (`--debian`|`--fedora`|`--fink`|`--macports`|`--opensuse`|`--ubuntu`) *`text`*: - Search for *`text`* in the given package manager's list. - - * `sh` [`--env=std`]: - Start a Homebrew build environment shell. Uses our years-battle-hardened - Homebrew build logic to help your `./configure && make && make install` - or even your `gem install` succeed. Especially handy if you run Homebrew - in an Xcode-only configuration since it adds tools like `make` to your `PATH` - which otherwise build systems would not find. - - If `--env=std` is passed, use the standard `PATH` instead of superenv's. - - * `shellenv`: - Prints export statements - run them in a shell and this installation of - Homebrew will be included into your PATH, MANPATH, and INFOPATH. - - HOMEBREW_PREFIX, HOMEBREW_CELLAR and HOMEBREW_REPOSITORY are also exported - to save multiple queries of those variables. - - Consider adding evaluating the output in your dotfiles (e.g. `~/.profile`) - with `eval $(brew shellenv)` - - * `style` [`--fix`] [`--display-cop-names`] [`--only-cops=`*`cops`*|`--except-cops=`*`cops`*] [*`files`*|*`taps`*|*`formulae`*]: - Check formulae or files for conformance to Homebrew style guidelines. - - Lists of *`files`*, *`taps`* and *`formulae`* may not be combined. If none are - provided, `style` will run style checks on the whole Homebrew library, - including core code and all formulae. - - If `--fix` is passed, automatically fix style violations using RuboCop's - auto-correct feature. - - If `--display-cop-names` is passed, include the RuboCop cop name for each - violation in the output. - - Passing `--only-cops=`*`cops`* will check for violations of only 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. - - Exits with a non-zero status if any style violations are found. - - * `switch` *`formula`* *`version`*: - Symlink all of the specific *`version`* of *`formula`*'s install to Homebrew prefix. - - * `tap`: - List all installed taps. - - * `tap` [`--full`] [`--force-auto-update`] *`user`*`/`*`repo`* [*`URL`*]: - Tap a formula repository. - - With *`URL`* unspecified, taps a formula repository from GitHub using HTTPS. - Since so many taps are hosted on GitHub, this command is a shortcut for - `brew tap` *`user`*`/`*`repo`* `https://github.com/`*`user`*`/homebrew-`*`repo`*. - - With *`URL`* specified, taps a formula repository from anywhere, using - any transport protocol that `git` handles. The one-argument form of `tap` - simplifies but also limits. This two-argument command makes no - assumptions, so taps can be cloned from places other than GitHub and - using protocols other than HTTPS, e.g., SSH, GIT, HTTP, FTP(S), RSYNC. - - By default, the repository is cloned as a shallow copy (`--depth=1`), but - if `--full` is passed, a full clone will be used. To convert a shallow copy - to a full copy, you can retap passing `--full` without first untapping. - - By default, only taps hosted on GitHub are auto-updated (for performance - reasons). If `--force-auto-update` is passed, this tap will be auto-updated - even if it is not hosted on GitHub. - - `tap` is re-runnable and exits successfully if there's nothing to do. - However, retapping with a different *`URL`* will cause an exception, so first - `untap` if you need to modify the *`URL`*. - - * `tap` `--repair`: - Migrate tapped formulae from symlink-based to directory-based structure. - - * `tap` `--list-pinned`: - List all pinned taps. - - * `tap-info`: - Display a brief summary of all installed taps. - - * `tap-info` (`--installed`|*`taps`*): - Display detailed information about one or more *`taps`*. - - Pass `--installed` to display information on all installed taps. - - * `tap-info` `--json=`*`version`* (`--installed`|*`taps`*): - Print a JSON representation of *`taps`*. Currently the only accepted value - for *`version`* is `v1`. - - Pass `--installed` to get information on installed taps. - - See the docs for examples of using the JSON output: - - - * `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`. - - * `uninstall`, `rm`, `remove` [`--force`] [`--ignore-dependencies`] *`formula`*: - Uninstall *`formula`*. - - If `--force` (or `-f`) is passed, and there are multiple versions of *`formula`* - installed, delete all installed versions. - - If `--ignore-dependencies` is passed, uninstalling won't fail, even if - formulae depending on *`formula`* would still be installed. - - * `unlink` [`--dry-run`] *`formula`*: - Remove symlinks for *`formula`* from the Homebrew prefix. This can be useful - for temporarily disabling a formula: - `brew unlink` *`formula`* `&&` *`commands`* `&& brew link` *`formula`* - - If `--dry-run` or `-n` is passed, Homebrew will list all files which would - be unlinked, but will not actually unlink or delete any files. - - * `unpack` [`--git`|`--patch`] [`--destdir=`*`path`*] *`formulae`*: - Unpack the source files for *`formulae`* into subdirectories of the current - working directory. If `--destdir=`*`path`* is given, the subdirectories will - be created in the directory named by *`path`* instead. - - If `--patch` is passed, patches for *`formulae`* will be applied to the - unpacked source. - - If `--git` (or `-g`) is passed, a Git repository will be initialized in the unpacked - source. This is useful for creating patches for the software. - - * `unpin` *`formulae`*: - Unpin *`formulae`*, allowing them to be upgraded by `brew upgrade` *`formulae`*. - See also `pin`. - - * `untap` *`tap`*: - Remove a tapped repository. - - * `update` [`--merge`] [`--force`]: - Fetch the newest version of Homebrew and all formulae from GitHub using - `git`(1) and perform any necessary migrations. - - If `--merge` is specified then `git merge` is used to include updates - (rather than `git rebase`). - - If `--force` (or `-f`) is specified then always do a slower, full update check even - if unnecessary. - - * `update-reset` [*`repositories`*]: - Fetches and resets Homebrew and all tap repositories (or the specified - `repositories`) using `git`(1) to their latest `origin/master`. Note this - will destroy all your uncommitted or committed changes. - - * `upgrade` [`--debug`] [`--build-from-source`|`--force-bottle`] [`--fetch-HEAD`] [`--ignore-pinned`] [`--keep-tmp`] [`--force`] [`--verbose`] [`--display-times`] [*`formula`*] [*`options`* ...]: - Upgrade outdated, unpinned brews (with existing and any appended install options). - - If *`formula`* are given, upgrade only the specified brews (unless they - are pinned; see `pin`, `unpin`). - - If `--debug` (or `-d`) is passed and brewing fails, open an interactive debugging - session with access to IRB or a shell inside the temporary build directory. - - If `--build-from-source` (or `-s`) is passed, compile the specified *`formula`* from - source even if a bottle is provided. Dependencies will still be installed - from bottles if they are available. - - If `--force-bottle` is passed, install from a bottle if it exists for the - current or newest version of macOS, even if it would not normally be used - for installation. - - If `--fetch-HEAD` is passed, fetch the upstream repository to detect if - the HEAD installation of the formula is outdated. Otherwise, the - repository's HEAD will be checked for updates when a new stable or devel - version has been released. - - If `--ignore-pinned` is passed, set a 0 exit code even if pinned formulae - are not upgraded. - - If `--keep-tmp` is passed, the temporary files created during installation - are not deleted. - - If `--force` (or `-f`) is passed, install without checking for previously - installed keg-only or non-migrated versions - - If `--verbose` (or `-v`) is passed, print the verification and postinstall steps. - - If `--display-times` is passed, install times for each formula are printed - at the end of the run. - - Additional options specific to *`formula`* may be appended to the command, - and can be listed with `brew options` *`formula`*. - - * `uses` [`--installed`] [`--recursive`] [`--include-build`] [`--include-test`] [`--include-optional`] [`--skip-recommended`] [`--devel`|`--HEAD`] *`formulae`*: - Show the formulae that specify *`formulae`* as a dependency. When given - multiple formula arguments, show the intersection of formulae that use - *`formulae`*. - - Use `--recursive` to resolve more than one level of dependencies. - - If `--installed` is passed, only list installed formulae. - - By default, `uses` shows all formulae that specify *`formulae`* as a required - or recommended dependency. To include the `:build` type dependencies, pass - `--include-build`, to include the `:test` type dependencies, pass - `--include-test` and to include `:optional` dependencies pass - `--include-optional`. To skip `:recommended` type dependencies, pass - `--skip-recommended`. - - By default, `uses` shows usage of *`formulae`* by stable builds. To find - cases where *`formulae`* is used by development or HEAD build, pass - `--devel` or `--HEAD`. - - * `--cache`: - Display Homebrew's download cache. See also `HOMEBREW_CACHE`. - - * `--cache` [`--build-from-source`|`-s`] [`--force-bottle`] *`formula`*: - Display the file or directory used to cache *`formula`*. - - * `--cellar`: - Display Homebrew's Cellar path. *Default:* `$(brew --prefix)/Cellar`, or if - that directory doesn't exist, `$(brew --repository)/Cellar`. - - * `--cellar` *`formula`*: - Display the location in the cellar where *`formula`* would be installed, - without any sort of versioned directory as the last path. - - * `--env` [`--shell=`(*`shell`*|`auto`)|`--plain`]: - Show a summary of the Homebrew build environment as a plain list. - - Pass `--shell=`*`shell`* to generate a list of environment variables for the - specified shell, or `--shell=auto` to detect the current shell. - - If the command's output is sent through a pipe and no shell is specified, - the list is formatted for export to `bash`(1) unless `--plain` is passed. - - * `--prefix`: - Display Homebrew's install path. *Default:* `/usr/local` on macOS and `/home/linuxbrew/.linuxbrew` on Linux - - * `--prefix` *`formula`*: - Display the location in the cellar where *`formula`* is or would be installed. - - * `--repository`: - Display where Homebrew's `.git` directory is located. - - * `--repository` *`user`*`/`*`repo`*: - Display where tap *`user`*`/`*`repo`*'s directory is located. - - * `--version`: - Print the version number of Homebrew to standard output and exit. +Print the version number of Homebrew, Homebrew/homebrew-core and Homebrew/homebrew-cask +(if tapped) to standard output and exit. ## DEVELOPER COMMANDS -### `audit` [*`options`*] *`formulae`* +### `audit` [*`options`*] *`formula`* -Check *`formulae`* for Homebrew coding style violations. This should be run before +Check *`formula`* for Homebrew coding style violations. This should be run 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 *`formula`* are provided, all of them are checked. * `--strict`: Run additional style checks, including RuboCop style checks. @@ -742,7 +661,7 @@ If no *`formulae`* are provided, all of them are checked. * `--except-cops`: Specify a comma-separated *`cops`* list to skip checking for violations of the listed RuboCop cops. -### `bottle` [*`options`*] *`formulae`* +### `bottle` [*`options`*] *`formula`* Generate a bottle (binary package) from a formula that was installed with `--build-bottle`. @@ -839,12 +758,11 @@ a simple example. For the complete API, see: * `--tap`: Generate the new formula in the provided tap, specified as *`user`*`/`*`repo`*. -### `edit` [*`formulae`*] +### `edit` [*`formula`*] Open a formula in the editor set by `EDITOR` or `HOMEBREW_EDITOR`, or open the Homebrew repository for editing if no *`formula`* is provided. - ### `extract` [*`options`*] *`formula`* *`tap`* Look through repository history to find the most recent version of *`formula`* and @@ -854,11 +772,10 @@ installed yet, attempt to install/clone the tap before continuing. * `--version`: Extract the provided *`version`* of *`formula`* instead of the most recent. -### `formula` *`formulae`* +### `formula` *`formula`* Display the path where a formula is located. - ### `irb` [*`options`*] Enter the interactive Homebrew Ruby shell. @@ -868,7 +785,7 @@ Enter the interactive Homebrew Ruby shell. * `--pry`: Use Pry instead of IRB. Implied if `HOMEBREW_PRY` is set. -### `linkage` [*`options`*] [*`formulae`*] +### `linkage` [*`options`*] [*`formula`*] Check the library links for kegs of installed formulae. Raises an error if run on uninstalled formulae. @@ -889,35 +806,17 @@ Generate Homebrew's manpages. * `--link`: This is now done automatically by `brew update`. -### `mirror` *`formulae`* +### `prof` *`command`* -Reuploads the stable URL for a formula to Bintray to use it as a mirror. +Run Homebrew with the Ruby profiler e.g. `brew prof readall`. - -### `prof` [*`ruby options`*] - -Run Homebrew with the Ruby profiler. - -*Example:* `brew prof readall` - - -### `pull` [*`options`*] *`patch sources`* +### `pull` [*`options`*] *`patch`* Get a patch from a GitHub commit or pull request and apply it to Homebrew. Optionally, publish updated bottles for 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 "https://jenkins.brew.sh/job/..." string specifying a testing job ID +Each *`patch`* may be the number of a PR in homebrew/core, the URL of a PR +on GitHub, the URL of a commit on GitHub or a "https://jenkins.brew.sh/job/..." testing job URL. * `--bottle`: Handle bottles, pulling the bottle-update commit and publishing files on Bintray. @@ -951,11 +850,10 @@ If no *`end_ref`* is provided it defaults to `origin/master`. * `--markdown`: Print as a Markdown list. -### `ruby` [*`ruby options`*] +### `ruby` [`-e`]: -Run a Ruby instance with Homebrew's libraries loaded. - -*Example:* `brew ruby -e "puts :gcc.f.deps"` or `brew ruby script.rb` +Run a Ruby instance with Homebrew's libraries loaded e.g. +`brew ruby -e "puts :gcc.f.deps"` or `brew ruby script.rb` * `-e`: Execute the provided string argument as a script. @@ -964,8 +862,7 @@ Run a Ruby instance with Homebrew's libraries loaded. Generate the template files for a new tap. - -### `test` [*`options`*] *`formulae`* +### `test` [*`options`*] *`formula`* Run the test method provided by an installed formula. There is no standard output or return code, but generally it should notify the @@ -995,7 +892,7 @@ Run Homebrew's unit and integration tests. * `--only`: Run only *`test_script`*`_spec.rb`. Appending `:`*`line_number`* will start at a specific line. * `--seed`: - Randomize tests with the provided *`value`* instead of a random seed. + Randomise tests with the provided *`value`* instead of a random seed. ### `update-test` [*`options`*] @@ -1011,8 +908,9 @@ If no arguments are passed, use `origin/master` as the start commit. * `--before`: Use the commit at provided *`date`* as the start commit. - * `vendor-gems`: - Install and commit Homebrew's vendored gems. +### `vendor-gems` + +Install and commit Homebrew's vendored gems. ## GLOBAL OPTIONS @@ -1032,80 +930,23 @@ These options are applicable across all sub-commands. ## OFFICIAL EXTERNAL COMMANDS - * `bundle` *`command`*: - Bundler for non-Ruby dependencies from Homebrew. +### `bundle` *`subcommand`*: - `brew bundle` [`install`] [`-v`|`--verbose`] [`--no-upgrade`] [`--file=`*`path`*|`--global`]: - Install or upgrade all dependencies in a Brewfile. +Bundler for non-Ruby dependencies from Homebrew, Homebrew Cask and the Mac App Store. See `brew bundle --help`. - `brew bundle dump` [`--force`] [`--describe`] [`--file=`*`path`*|`--global`]: - Write all installed casks/formulae/taps into a Brewfile. +**Homebrew/homebrew-bundle**: - `brew bundle cleanup` [`--force`] [`--zap`] [`--file=`*`path`*|`--global`]: - Uninstall all dependencies not listed in a Brewfile. +### `cask` *`subcommand`*: - `brew bundle check` [`--no-upgrade`] [`--file=`*`path`*|`--global`] [`--verbose`]: - Check if all dependencies are installed in a Brewfile. Missing dependencies are listed in verbose mode. - `check` will exit on the first category missing a dependency unless in verbose mode. +Install macOS applications distributed as binaries. See brew-cask(1). - `brew bundle exec` *`command`*: - Run an external command in an isolated build environment. +**Homebrew/homebrew-cask**: - `brew bundle list` [`--all`|`--brews`|`--casks`|`--taps`|`--mas`] [`--file=`*`path`*|`--global`]: - List all dependencies present in a Brewfile, optionally limiting by types. - By default, only brew dependencies are output. +### `services` *`subcommand`*: - If `-v` or `--verbose` are passed, print verbose output. +Manage background services with macOS' `launchctl`(1) daemon manager. See `brew services --help`. - If `--no-upgrade` is passed, don't run `brew upgrade` on outdated dependencies. - Note they may still be upgraded by `brew install` if needed. - - If `--force` is passed, uninstall dependencies or overwrite an existing Brewfile. - - If `--zap` is passed, casks will be removed using the `zap` command instead of `uninstall`. - - If `--file=`*`path`* is passed, the Brewfile path is set accordingly. - Use `--file=-` to output to console. - - If `--global` is passed, set the Brewfile path to `~/.Brewfile`. - - If `--describe` is passed, output a description comment above each line. - This comment will not be output if the dependency does not have a description. - - If `-h` or `--help` are passed, print this help message and exit. - - **Homebrew/homebrew-bundle**: - - * `cask` [`--version` | `audit` | `cat` | `cleanup` | `create` | `doctor` | `edit` | `fetch` | `home` | `info`]: - Install macOS applications distributed as binaries. - - **Homebrew/homebrew-cask**: - - * `services` *`command`*: - Integrates Homebrew formulae with macOS' `launchctl` manager. - - [`sudo`] `brew services list`: - List all running services for the current user (or root). - - [`sudo`] `brew services run` (*`formula`*|`--all`): - Run the service *`formula`* without registering to launch at login (or boot). - - [`sudo`] `brew services start` (*`formula`*|`--all`): - Start the service *`formula`* immediately and register it to launch at login (or boot). - - [`sudo`] `brew services stop` (*`formula`*|`--all`): - Stop the service *`formula`* immediately and unregister it from launching at login (or boot). - - [`sudo`] `brew services restart` (*`formula`*|`--all`): - Stop (if necessary) and start the service *`formula`* immediately and register it to launch at login (or boot). - - [`sudo`] `brew services cleanup`: - Remove all unused services. - - If `sudo` is passed, operate on `/Library/LaunchDaemons` (started at boot). - Otherwise, operate on `~/Library/LaunchAgents` (started at login). - - **Homebrew/homebrew-services**: +**Homebrew/homebrew-services**: ## CUSTOM EXTERNAL COMMANDS @@ -1244,7 +1085,7 @@ Note that environment variables must have a value set to be detected. For exampl rather than falling back to building from source. * `HOMEBREW_NO_COLOR`: - If set, Homebrew will not print text with color added. + If set, Homebrew will not print text with colour added. * `HOMEBREW_NO_EMOJI`: If set, Homebrew will not print the `HOMEBREW_INSTALL_BADGE` on a @@ -1358,7 +1199,6 @@ See our issues on GitHub: * **Homebrew/homebrew-core**: - [SYNOPSIS]: #SYNOPSIS "SYNOPSIS" [DESCRIPTION]: #DESCRIPTION "DESCRIPTION" [ESSENTIAL COMMANDS]: #ESSENTIAL-COMMANDS "ESSENTIAL COMMANDS" @@ -1374,5 +1214,4 @@ See our issues on GitHub: [AUTHORS]: #AUTHORS "AUTHORS" [BUGS]: #BUGS "BUGS" - [-]: -.html diff --git a/manpages/brew.1 b/manpages/brew.1 index 0998c376f2..789cde567a 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -21,712 +21,755 @@ For the full command list, see the \fICOMMANDS\fR section\. .P With \fB\-\-verbose\fR or \fB\-v\fR, many commands print extra debugging information\. Note that these flags should only appear after a command\. . -.TP -\fBinstall\fR \fIformula\fR +.SS "\fBinstall\fR \fIformula\fR:" Install \fIformula\fR\. . -.TP -\fBuninstall\fR \fIformula\fR +.SS "\fBuninstall\fR \fIformula\fR:" Uninstall \fIformula\fR\. . -.TP -\fBupdate\fR -Fetch the newest version of Homebrew from GitHub using \fBgit\fR(1)\. -. -.TP -\fBlist\fR +.SS "\fBlist\fR:" List all installed formulae\. . -.TP -\fBsearch\fR (\fItext\fR|\fB/\fR\fItext\fR\fB/\fR) +.SS "\fBsearch\fR (\fItext\fR|\fB/\fR\fItext\fR\fB/\fR):" Perform a substring search of cask tokens and formula names for \fItext\fR\. If \fItext\fR is surrounded with slashes, then it is interpreted as a regular expression\. The search for \fItext\fR is extended online to \fBhomebrew/core\fR and \fBhomebrew/cask\fR\. If no search term is given, all locally available formulae are listed\. . .SH "COMMANDS" . -.TP -\fBanalytics\fR [\fBstate\fR] -Display anonymous user behaviour analytics state\. Read more at \fIhttps://docs\.brew\.sh/Analytics\fR\. +.SS "\fBanalytics\fR (\fBon\fR|\fBoff\fR) [\fBstate\fR] [\fBregenerate\-uuid\fR]" +If \fBon\fR|\fBoff\fR is passed, turn Homebrew\'s analytics on or off respectively\. . -.TP -\fBanalytics\fR (\fBon\fR|\fBoff\fR) -Turn on/off Homebrew\'s analytics\. +.P +If \fBstate\fR is passed, display anonymous user behaviour analytics state\. Read more at \fIhttps://docs\.brew\.sh/Analytics\fR\. . -.TP -\fBanalytics\fR \fBregenerate\-uuid\fR -Regenerate UUID used in Homebrew\'s analytics\. +.P +If \fBregenerate\-uuid\fR is passed, regenerate UUID used in Homebrew\'s analytics\. . -.TP -\fBcat\fR \fIformula\fR +.SS "\fBcat\fR \fIformula\fR" Display the source to \fIformula\fR\. . -.TP -\fBcleanup\fR [\fB\-\-prune=\fR\fIdays\fR] [\fB\-\-dry\-run\fR] [\fB\-s\fR] [\fIformulae\fR|\fIcasks\fR] +.SS "\fBcleanup\fR [\fIoptions\fR] [\fIformula\fR|\fIcask\fR]" Remove stale lock files and outdated downloads for formulae and casks, and remove old versions of installed formulae\. If arguments are specified, only do this for the specified formulae and casks\. . -.IP -If \fB\-\-prune=\fR\fIdays\fR is specified, remove all cache files older than \fIdays\fR\. -. -.IP -If \fB\-\-dry\-run\fR or \fB\-n\fR is passed, show what would be removed, but do not actually remove anything\. -. -.IP -If \fB\-s\fR is passed, scrub the cache, including downloads for even the latest versions\. Note downloads for any installed formula or cask will still not be deleted\. If you want to delete those too: \fBrm \-rf "$(brew \-\-cache)"\fR +.TP +\fB\-\-prune\fR +Remove all cache files older than specified \fIdays\fR\. . .TP -\fBcommand\fR \fIcmd\fR +\fB\-n\fR, \fB\-\-dry\-run\fR +Show what would be removed, but do not actually remove anything\. +. +.TP +\fB\-s\fR +Scrub the cache, including downloads for even the latest versions\. Note downloads for any installed formula or cask will still not be deleted\. If you want to delete those too: \fBrm \-rf "$(brew \-\-cache)"\fR +. +.SS "\fBcommand\fR \fIcmd\fR" Display the path to the file which is used when invoking \fBbrew\fR \fIcmd\fR\. . -.TP -\fBcommands\fR [\fB\-\-quiet\fR [\fB\-\-include\-aliases\fR]] +.SS "\fBcommands\fR [\fIoptions\fR]" Show a list of built\-in and external commands\. . -.IP -If \fB\-\-quiet\fR is passed, list only the names of commands without the header\. With \fB\-\-include\-aliases\fR, the aliases of internal commands will be included\. -. .TP -\fBconfig\fR +\fB\-\-include\-aliases\fR +Include the aliases of internal commands\. +. +.SS "\fBconfig\fR" 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 -\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] [\fB\-\-include\-requirements\fR] \fIformula\fR -Show dependencies for \fIformula\fR\. When given multiple formula arguments, show the intersection of dependencies for every formula\. -. -.IP -If \fB\-\-1\fR is passed, only show dependencies one level down, instead of recursing\. -. -.IP -If \fB\-n\fR is passed, show dependencies in topological order\. -. -.IP -If \fB\-\-union\fR is passed, show the union of dependencies for \fIformula\fR, instead of the intersection\. -. -.IP -If \fB\-\-full\-name\fR is passed, list dependencies by their full name\. -. -.IP -If \fB\-\-installed\fR is passed, only list those dependencies that are currently installed\. -. -.IP -By default, \fBdeps\fR shows required and recommended dependencies for \fIformula\fR\. To include the \fB:build\fR type dependencies, pass \fB\-\-include\-build\fR\. Similarly, pass \fB\-\-include\-optional\fR to include \fB:optional\fR dependencies or \fB\-\-include\-test\fR to include (non\-recursive) \fB:test\fR dependencies\. To skip \fB:recommended\fR type dependencies, pass \fB\-\-skip\-recommended\fR\. To include requirements in addition to dependencies, pass \fB\-\-include\-requirements\fR\. -. -.TP -\fBdeps\fR \fB\-\-tree\fR [\fB\-\-1\fR] [\fIfilters\fR] [\fB\-\-annotate\fR] (\fIformula\fR|\fB\-\-installed\fR) -Show dependencies as a tree\. When given multiple formula arguments, output individual trees for every formula\. -. -.IP -If \fB\-\-1\fR is passed, only one level of children is displayed\. -. -.IP -If \fB\-\-installed\fR is passed, output a tree for every installed formula\. -. -.IP -The \fIfilters\fR placeholder is any combination of options \fB\-\-include\-build\fR, \fB\-\-include\-optional\fR, \fB\-\-include\-test\fR, \fB\-\-skip\-recommended\fR, and \fB\-\-include\-requirements\fR as documented above\. -. -.IP -If \fB\-\-annotate\fR is passed, the build, optional, and recommended dependencies are marked as such in the output\. -. -.TP -\fBdeps\fR [\fIfilters\fR] (\fB\-\-installed\fR|\fB\-\-all\fR) -Show dependencies for installed or all available formulae\. Every line of output starts with the formula name, followed by a colon and all direct dependencies of that formula\. -. -.IP -The \fIfilters\fR placeholder is any combination of options \fB\-\-include\-build\fR, \fB\-\-include\-optional\fR, \fB\-\-include\-test\fR, and \fB\-\-skip\-recommended\fR as documented above\. -. -.IP -Additional options specific to \fIformula\fR may be appended to the command, and can be listed with \fBbrew options\fR \fIformula\fR\. -. -.TP -\fBdesc\fR \fIformula\fR -Display \fIformula\fR\'s name and one\-line description\. -. -.TP -\fBdesc\fR [\fB\-\-search\fR|\fB\-\-name\fR|\fB\-\-description\fR] (\fItext\fR|\fB/\fR\fItext\fR\fB/\fR) -Search both name and description (\fB\-\-search\fR or \fB\-s\fR), just the names (\fB\-\-name\fR or \fB\-n\fR), or just the descriptions (\fB\-\-description\fR or \fB\-d\fR) for \fItext\fR\. If \fItext\fR is flanked by slashes, it is interpreted as a regular expression\. Formula descriptions are cached; the cache is created on the first search, making that search slower than subsequent ones\. -. -.TP -\fBdiy\fR [\fB\-\-name=\fR\fIname\fR] [\fB\-\-version=\fR\fIversion\fR] -Automatically determine the installation prefix for non\-Homebrew software\. -. -.IP -Using the output from this command, you can install your own software into the Cellar and then link it into Homebrew\'s prefix with \fBbrew link\fR\. -. -.IP -The options \fB\-\-name=\fR\fIname\fR and \fB\-\-version=\fR\fIversion\fR each take an argument and allow you to explicitly set the name and version of the package you are installing\. -. -.TP -\fBdoctor\fR -Check your system for potential problems\. Doctor exits with a non\-zero status if any potential problems are found\. Please note that these warnings are just used to help the Homebrew maintainers with debugging if you file an issue\. If everything you use Homebrew for is working fine: please don\'t worry or file an issue; just ignore this\. -. -.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\. -. -.IP -If \fB\-\-HEAD\fR or \fB\-\-devel\fR is passed, fetch that version instead of the stable version\. -. -.IP -If \fB\-v\fR is passed, do a verbose VCS checkout, if the URL represents a VCS\. This is useful for seeing if an existing VCS cache has been updated\. -. -.IP -If \fB\-\-force\fR (or \fB\-f\fR) is passed, remove a previously cached version and re\-fetch\. -. -.IP -If \fB\-\-retry\fR is passed, retry if a download fails or re\-download if the checksum of a previously cached version no longer matches\. -. -.IP -If \fB\-\-deps\fR is passed, also download dependencies for any listed \fIformulae\fR\. -. -.IP -If \fB\-\-build\-from\-source\fR (or \fB\-s\fR) or \fB\-\-build\-bottle\fR is passed, download the source rather than a bottle\. -. -.IP -If \fB\-\-force\-bottle\fR is passed, download a bottle if it exists for the current or newest version of macOS, even if it would not be used during installation\. -. -.TP -\fBgist\-logs\fR [\fB\-\-new\-issue\fR|\fB\-n\fR] [\fB\-\-private\fR|\fB\-p\fR] \fIformula\fR -Upload logs for a failed build of \fIformula\fR to a new Gist\. -. -.IP -\fIformula\fR is usually the name of the formula to install, but it can be specified in several different ways\. -. -.IP -If \fB\-\-with\-hostname\fR is passed, include the hostname in the Gist\. -. -.IP -If \fB\-\-new\-issue\fR is passed, automatically create a new issue in the appropriate GitHub repository as well as creating the Gist\. -. -.IP -If \fB\-\-private\fR is passed, the Gist will be marked private and will not appear in listings but will be accessible with the link\. -. -.IP -If no logs are found, an error message is presented\. -. -.TP -\fBhome\fR -Open Homebrew\'s own homepage in a browser\. -. -.TP -\fBhome\fR \fIformula\fR -Open \fIformula\fR\'s homepage in a browser\. -. -.TP -\fBinfo\fR -Display brief statistics for your Homebrew installation\. -. -.TP -\fBinfo\fR \fB\-\-analytics\fR [\fB\-\-days=\fR\fIdays\fR] [\fB\-\-category=\fR\fIcategory\fR] -Display Homebrew analytics data (provided neither \fBHOMEBREW_NO_ANALYTICS\fR or \fBHOMEBREW_NO_GITHUB_API\fR are set) -. -.IP -The value for \fBdays\fR must be \fB30\fR, \fB90\fR or \fB365\fR\. The default is \fB30\fR\. -. -.IP -The value for \fBcategory\fR must be \fBinstall\fR, \fBinstall\-on\-request\fR, \fBbuild\-error\fR or \fBos\-version\fR\. The default is \fBinstall\fR\. -. -.TP -\fBinfo\fR \fIformula\fR [\fB\-\-analytics\fR] -Display information about \fIformula\fR and analytics data (provided neither \fBHOMEBREW_NO_ANALYTICS\fR or \fBHOMEBREW_NO_GITHUB_API\fR are set) -. -.IP -Pass \fB\-\-verbose\fR to see more verbose analytics data\. -. -.IP -Pass \fB\-\-analytics\fR to see only more verbose analytics data instead of formula information\. +.SS "\fBdeps\fR [\fIoptions\fR] \fIformula\fR" +Show dependencies for \fIformula\fR\. When given multiple formula arguments, show the intersection of dependencies for \fIformula\fR\. . .TP -\fBinfo\fR \fB\-\-github\fR \fIformula\fR -Open a browser to the GitHub History page for \fIformula\fR\. -. -.IP -To view formula history locally: \fBbrew log \-p\fR \fIformula\fR +\fB\-\-1\fR +Only show dependencies one level down, instead of recursing\. . .TP -\fBinfo\fR \fB\-\-json[=\fR\fIversion\fR] (\fB\-\-all\fR|\fB\-\-installed\fR|\fIformulae\fR) -Print a JSON representation of \fIformulae\fR\. Currently the default and only accepted value for \fIversion\fR is \fBv1\fR\. -. -.IP -Pass \fB\-\-all\fR to get information on all formulae, or \fB\-\-installed\fR to get information on all installed formulae\. -. -.IP -See the docs for examples of using the JSON output: \fIhttps://docs\.brew\.sh/Querying\-Brew\fR +\fB\-n\fR +Show dependencies in topological order\. . .TP -\fBinstall\fR [\fB\-\-debug\fR] [\fB\-\-env=\fR(\fBstd\fR|\fBsuper\fR)] [\fB\-\-ignore\-dependencies\fR|\fB\-\-only\-dependencies\fR] [\fB\-\-cc=\fR\fIcompiler\fR] [\fB\-\-build\-from\-source\fR|\fB\-\-force\-bottle\fR] [\fB\-\-include\-test\fR] [\fB\-\-devel\fR|\fB\-\-HEAD\fR] [\fB\-\-keep\-tmp\fR] [\fB\-\-build\-bottle\fR] [\fB\-\-force\fR] [\fB\-\-verbose\fR] [\fB\-\-display\-times\fR] \fIformula\fR [\fIoptions\fR \.\.\.] -Install \fIformula\fR\. -. -.IP -\fIformula\fR is usually the name of the formula to install, but it can be specified in several different ways\. -. -.IP -If \fB\-\-debug\fR (or \fB\-d\fR) is passed and brewing fails, open an interactive debugging session with access to IRB or a shell inside the temporary build directory\. -. -.IP -If \fB\-\-env=std\fR is passed, use the standard build environment instead of superenv\. -. -.IP -If \fB\-\-env=super\fR is passed, use superenv even if the formula specifies the standard build environment\. -. -.IP -If \fB\-\-ignore\-dependencies\fR is passed, skip installing any dependencies of any kind\. If they are not already present, the formula will probably fail to install\. -. -.IP -If \fB\-\-only\-dependencies\fR is passed, install the dependencies with specified options but do not install the specified formula\. -. -.IP -If \fB\-\-cc=\fR\fIcompiler\fR is passed, attempt to compile using \fIcompiler\fR\. \fIcompiler\fR should be the name of the compiler\'s executable, for instance \fBgcc\-7\fR for GCC 7\. In order to use LLVM\'s clang, use \fBllvm_clang\fR\. To specify the Apple\-provided clang, use \fBclang\fR\. This parameter will only accept compilers that are provided by Homebrew or bundled with macOS\. Please do not file issues if you encounter errors while using this flag\. -. -.IP -If \fB\-\-build\-from\-source\fR (or \fB\-s\fR) is passed, compile the specified \fIformula\fR from source even if a bottle is provided\. Dependencies will still be installed from bottles if they are available\. -. -.IP -If \fB\-\-force\-bottle\fR is passed, install from a bottle if it exists for the current or newest version of macOS, even if it would not normally be used for installation\. -. -.IP -If \fB\-\-include\-test\fR is passed, install testing dependencies\. These are only needed by formulae maintainers to run \fBbrew test\fR\. -. -.IP -If \fB\-\-devel\fR is passed, and \fIformula\fR defines it, install the development version\. -. -.IP -If \fB\-\-HEAD\fR is passed, and \fIformula\fR defines it, install the HEAD version, aka\. master, trunk, unstable\. -. -.IP -If \fB\-\-keep\-tmp\fR is passed, the temporary files created during installation are not deleted\. -. -.IP -If \fB\-\-build\-bottle\fR is passed, prepare the formula for eventual bottling during installation\. -. -.IP -If \fB\-\-force\fR (or \fB\-f\fR) is passed, install without checking for previously installed keg\-only or non\-migrated versions -. -.IP -If \fB\-\-verbose\fR (or \fB\-v\fR) is passed, print the verification and postinstall steps\. -. -.IP -If \fB\-\-display\-times\fR is passed, install times for each formula are printed at the end of the run\. -. -.IP -Installation options specific to \fIformula\fR may be appended to the command, and can be listed with \fBbrew options\fR \fIformula\fR\. +\fB\-\-union\fR +Show the union of dependencies for \fIformula\fR, instead of the intersection\. . .TP -\fBinstall\fR \fB\-\-interactive\fR [\fB\-\-git\fR] \fIformula\fR -If \fB\-\-interactive\fR (or \fB\-i\fR) is passed, download and patch \fIformula\fR, then open a shell\. This allows the user to run \fB\./configure \-\-help\fR and otherwise determine how to turn the software package into a Homebrew formula\. -. -.IP -If \fB\-\-git\fR (or \fB\-g\fR) is passed, Homebrew will create a Git repository, useful for creating patches to the software\. +\fB\-\-full\-name\fR +List dependencies by their full name\. . .TP -\fBleaves\fR -Show installed formulae that are not dependencies of another installed formula\. +\fB\-\-installed\fR +Only list those dependencies that are currently installed\. . .TP -\fBln\fR, \fBlink\fR [\fB\-\-overwrite\fR] [\fB\-\-dry\-run\fR] [\fB\-\-force\fR] \fIformula\fR -Symlink all of \fIformula\fR\'s installed files into the Homebrew prefix\. This is done automatically when you install formulae but can be useful for DIY installations\. -. -.IP -If \fB\-\-overwrite\fR is passed, Homebrew will delete files which already exist in the prefix while linking\. -. -.IP -If \fB\-\-dry\-run\fR or \fB\-n\fR is passed, Homebrew will list all files which would be linked or which would be deleted by \fBbrew link \-\-overwrite\fR, but will not actually link or delete any files\. -. -.IP -If \fB\-\-force\fR (or \fB\-f\fR) is passed, Homebrew will allow keg\-only formulae to be linked\. +\fB\-\-all\fR +List all the dependencies for all available formulae\. . .TP -\fBlist\fR, \fBls\fR [\fB\-\-full\-name\fR] [\fB\-1\fR] [\fB\-l\fR] [\fB\-t\fR] [\fB\-r\fR] -List all installed formulae\. If \fB\-\-full\-name\fR is passed, print formulae with fully\-qualified names\. If \fB\-\-full\-name\fR is not passed, other options (i\.e\. \fB\-1\fR, \fB\-l\fR, \fB\-t\fR and \fB\-r\fR) are passed to \fBls\fR which produces the actual output\. +\fB\-\-include\-build\fR +Show \fB:build\fR type dependencies for \fIformula\fR\. . .TP -\fBlist\fR, \fBls\fR \fB\-\-unbrewed\fR -List all files in the Homebrew prefix not installed by Homebrew\. +\fB\-\-include\-optional\fR +Show \fB:optional\fR dependencies for \fIformula\fR\. . .TP -\fBlist\fR, \fBls\fR [\fB\-\-verbose\fR] [\fB\-\-versions\fR [\fB\-\-multiple\fR]] [\fB\-\-pinned\fR] [\fIformulae\fR] -List the installed files for \fIformulae\fR\. Combined with \fB\-\-verbose\fR, recursively list the contents of all subdirectories in each \fIformula\fR\'s keg\. -. -.IP -If \fB\-\-versions\fR is passed, show the version number for installed formulae, or only the specified formulae if \fIformulae\fR are given\. With \fB\-\-multiple\fR, only show formulae with multiple versions installed\. -. -.IP -If \fB\-\-pinned\fR is passed, show the versions of pinned formulae, or only the specified (pinned) formulae if \fIformulae\fR are given\. See also \fBpin\fR, \fBunpin\fR\. +\fB\-\-include\-test\fR +Show \fB:test\fR dependencies for \fIformula\fR (non\-recursive)\. . .TP -\fBlog\fR [\fIgit\-log\-options\fR] \fIformula\fR \.\.\. -Show the git log for the given formulae\. Options that \fBgit\-log\fR(1) recognizes can be passed before the formula list\. +\fB\-\-skip\-recommended\fR +Skip \fB:recommended\fR type dependencies for \fIformula\fR\. . .TP -\fBmigrate\fR [\fB\-\-force\fR] \fIformulae\fR -Migrate renamed packages to new name, where \fIformulae\fR are old names of packages\. -. -.IP -If \fB\-\-force\fR (or \fB\-f\fR) is passed, then treat installed \fIformulae\fR and passed \fIformulae\fR like if they are from same taps and migrate them anyway\. +\fB\-\-include\-requirements\fR +Include requirements in addition to dependencies for \fIformula\fR\. . .TP -\fBmissing\fR [\fB\-\-hide=\fR\fIhidden\fR] [\fIformulae\fR] -Check the given \fIformulae\fR for missing dependencies\. If no \fIformulae\fR are given, check all installed brews\. -. -.IP -If \fB\-\-hide=\fR\fIhidden\fR is passed, act as if none of \fIhidden\fR are installed\. \fIhidden\fR should be a comma\-separated list of formulae\. -. -.IP -\fBmissing\fR exits with a non\-zero status if any formulae are missing dependencies\. -. -.TP -\fBoptions\fR [\fB\-\-compact\fR] (\fB\-\-all\fR|\fB\-\-installed\fR|\fIformulae\fR) -Display install options specific to \fIformulae\fR\. -. -.IP -If \fB\-\-compact\fR is passed, show all options on a single line separated by spaces\. -. -.IP -If \fB\-\-all\fR is passed, show options for all formulae\. -. -.IP -If \fB\-\-installed\fR is passed, show options for all installed formulae\. +\fB\-\-tree\fR +Show dependencies as a tree\. When given multiple formula arguments output individual trees for every formula\. . .TP -\fBoutdated\fR [\fB\-\-quiet\fR|\fB\-\-verbose\fR|\fB\-\-json=\fR\fIversion\fR] [\fB\-\-fetch\-HEAD\fR] -Show formulae that have an updated version available\. -. -.IP -By default, version information is displayed in interactive shells, and suppressed otherwise\. -. -.IP -If \fB\-\-quiet\fR is passed, list only the names of outdated brews (takes precedence over \fB\-\-verbose\fR)\. +\fB\-\-for\-each\fR +Switch into the mode used by \fBdeps \-\-all\fR, but only list dependencies for specified formula one specified formula per line\. This is used for debugging the \fB\-\-installed\fR/\fB\-\-all\fR display mode\. . -.IP -If \fB\-\-verbose\fR (or \fB\-v\fR) is passed, display detailed version information\. -. -.IP -If \fB\-\-json=\fR\fIversion\fR is passed, the output will be in JSON format\. Currently the only accepted value for \fIversion\fR is \fBv1\fR\. -. -.IP -If \fB\-\-fetch\-HEAD\fR is passed, fetch the upstream repository to detect if the HEAD installation of the formula is outdated\. Otherwise, the repository\'s HEAD will be checked for updates when a new stable or devel version has been released\. +.SS "\fBdesc\fR [\fIoptions\fR] (\fItext\fR|\fB/\fR\fItext\fR\fB/\fR|\fIformula\fR)" +Display \fIformula\fR\'s name and one\-line description\. Formula descriptions are cached; the cache is created on the first search, making that search slower than subsequent ones\. . .TP -\fBpin\fR \fIformulae\fR -Pin the specified \fIformulae\fR, preventing them from being upgraded when issuing the \fBbrew upgrade\fR \fIformulae\fR command\. See also \fBunpin\fR\. +\fB\-s\fR, \fB\-\-search\fR +Search both name and description for provided \fItext\fR\. If \fItext\fR is flanked by slashes, it is interpreted as a regular expression\. . .TP -\fBpostinstall\fR \fIformula\fR -Rerun the post\-install steps for \fIformula\fR\. +\fB\-n\fR, \fB\-\-name\fR +Search just the names for provided \fItext\fR\. If \fItext\fR is flanked by slashes, it is interpreted as a regular expression\. . .TP -\fBprune\fR [\fB\-\-dry\-run\fR] -Deprecated\. Use \fBbrew cleanup\fR instead\. -. -.TP -\fBreadall\fR [\fB\-\-aliases\fR] [\fB\-\-syntax\fR] [\fItaps\fR] -Import all formulae from specified \fItaps\fR (defaults to all installed taps)\. -. -.IP -This can be useful for debugging issues across all formulae when making significant changes to \fBformula\.rb\fR, testing the performance of loading all formulae or to determine if any current formulae have Ruby issues\. -. -.IP -If \fB\-\-aliases\fR is passed, also verify any alias symlinks in each tap\. -. -.IP -If \fB\-\-syntax\fR is passed, also syntax\-check all of Homebrew\'s Ruby files\. -. -.TP -\fBreinstall\fR [\fB\-\-debug\fR] [\fB\-\-build\-from\-source\fR|\fB\-\-force\-bottle\fR] [\fB\-\-keep\-tmp\fR] [\fB\-\-force\fR] [\fB\-\-verbose\fR] [\fB\-\-display\-times\fR] \fIformula\fR -Uninstall and then install \fIformula\fR (with existing and any appended install options)\. -. -.IP -If \fB\-\-debug\fR (or \fB\-d\fR) is passed and brewing fails, open an interactive debugging session with access to IRB or a shell inside the temporary build directory\. -. -.IP -If \fB\-\-build\-from\-source\fR (or \fB\-s\fR) is passed, compile the specified \fIformula\fR from source even if a bottle is provided\. Dependencies will still be installed from bottles if they are available\. -. -.IP -If \fB\-\-force\-bottle\fR is passed, install from a bottle if it exists for the current or newest version of macOS, even if it would not normally be used for installation\. -. -.IP -If \fB\-\-keep\-tmp\fR is passed, the temporary files created during installation are not deleted\. -. -.IP -If \fB\-\-force\fR (or \fB\-f\fR) is passed, install without checking for previously installed keg\-only or non\-migrated versions -. -.IP -If \fB\-\-verbose\fR (or \fB\-v\fR) is passed, print the verification and postinstall steps\. -. -.IP -If \fB\-\-display\-times\fR is passed, install times for each formula are printed at the end of the run\. +\fB\-d\fR, \fB\-\-description\fR +Search just the descriptions for provided \fItext\fR\. If \fItext\fR is flanked by slashes, it is interpreted as a regular expression\. . -.IP -Installation options specific to \fIformula\fR may be appended to the command, and can be listed with \fBbrew options\fR \fIformula\fR\. -. -.TP -\fBsearch\fR, \fB\-S\fR -Display all locally available formulae (including tapped ones)\. No online search is performed\. -. -.TP -\fBsearch\fR \fB\-\-casks\fR -Display all locally available casks (including tapped ones)\. No online search is performed\. -. -.TP -\fBsearch\fR [\fB\-\-desc\fR] (\fItext\fR|\fB/\fR\fItext\fR\fB/\fR) -Perform a substring search of cask tokens and formula names for \fItext\fR\. If \fItext\fR is surrounded with slashes, then it is interpreted as a regular expression\. The search for \fItext\fR is extended online to \fBhomebrew/core\fR and \fBhomebrew/cask\fR\. -. -.IP -If \fB\-\-desc\fR is passed, search formulae with a description matching \fItext\fR and casks with a name matching \fItext\fR\. -. -.TP -\fBsearch\fR (\fB\-\-debian\fR|\fB\-\-fedora\fR|\fB\-\-fink\fR|\fB\-\-macports\fR|\fB\-\-opensuse\fR|\fB\-\-ubuntu\fR) \fItext\fR -Search for \fItext\fR in the given package manager\'s list\. -. -.TP -\fBsh\fR [\fB\-\-env=std\fR] -Start a Homebrew build environment shell\. Uses our years\-battle\-hardened Homebrew build logic to help your \fB\./configure && make && make install\fR or even your \fBgem install\fR succeed\. Especially handy if you run Homebrew in an Xcode\-only configuration since it adds tools like \fBmake\fR to your \fBPATH\fR which otherwise build systems would not find\. -. -.IP -If \fB\-\-env=std\fR is passed, use the standard \fBPATH\fR instead of superenv\'s\. -. -.TP -\fBshellenv\fR -Prints export statements \- run them in a shell and this installation of Homebrew will be included into your PATH, MANPATH, and INFOPATH\. -. -.IP -HOMEBREW_PREFIX, HOMEBREW_CELLAR and HOMEBREW_REPOSITORY are also exported to save multiple queries of those variables\. -. -.IP -Consider adding evaluating the output in your dotfiles (e\.g\. \fB~/\.profile\fR) with \fBeval $(brew shellenv)\fR -. -.TP -\fBstyle\fR [\fB\-\-fix\fR] [\fB\-\-display\-cop\-names\fR] [\fB\-\-only\-cops=\fR\fIcops\fR|\fB\-\-except\-cops=\fR\fIcops\fR] [\fIfiles\fR|\fItaps\fR|\fIformulae\fR] -Check formulae or files for conformance to Homebrew style guidelines\. -. -.IP -Lists of \fIfiles\fR, \fItaps\fR and \fIformulae\fR may not be combined\. If none are provided, \fBstyle\fR will run style checks on the whole Homebrew library, including core code and all formulae\. -. -.IP -If \fB\-\-fix\fR is passed, automatically fix style violations using RuboCop\'s auto\-correct feature\. -. -.IP -If \fB\-\-display\-cop\-names\fR is passed, include the RuboCop cop name for each violation in the output\. -. -.IP -Passing \fB\-\-only\-cops=\fR\fIcops\fR will check for violations of only the listed RuboCop \fIcops\fR, while \fB\-\-except\-cops=\fR\fIcops\fR will skip checking the listed \fIcops\fR\. For either option \fIcops\fR should be a comma\-separated list of cop names\. -. -.IP -Exits with a non\-zero status if any style violations are found\. -. -.TP -\fBswitch\fR \fIformula\fR \fIversion\fR -Symlink all of the specific \fIversion\fR of \fIformula\fR\'s install to Homebrew prefix\. -. -.TP -\fBtap\fR -List all installed taps\. -. -.TP -\fBtap\fR [\fB\-\-full\fR] [\fB\-\-force\-auto\-update\fR] \fIuser\fR\fB/\fR\fIrepo\fR [\fIURL\fR] -Tap a formula repository\. -. -.IP -With \fIURL\fR unspecified, taps a formula repository from GitHub using HTTPS\. Since so many taps are hosted on GitHub, this command is a shortcut for \fBbrew tap\fR \fIuser\fR\fB/\fR\fIrepo\fR \fBhttps://github\.com/\fR\fIuser\fR\fB/homebrew\-\fR\fIrepo\fR\. -. -.IP -With \fIURL\fR specified, taps a formula repository from anywhere, using any transport protocol that \fBgit\fR handles\. The one\-argument form of \fBtap\fR simplifies but also limits\. This two\-argument command makes no assumptions, so taps can be cloned from places other than GitHub and using protocols other than HTTPS, e\.g\., SSH, GIT, HTTP, FTP(S), RSYNC\. -. -.IP -By default, the repository is cloned as a shallow copy (\fB\-\-depth=1\fR), but if \fB\-\-full\fR is passed, a full clone will be used\. To convert a shallow copy to a full copy, you can retap passing \fB\-\-full\fR without first untapping\. -. -.IP -By default, only taps hosted on GitHub are auto\-updated (for performance reasons)\. If \fB\-\-force\-auto\-update\fR is passed, this tap will be auto\-updated even if it is not hosted on GitHub\. -. -.IP -\fBtap\fR is re\-runnable and exits successfully if there\'s nothing to do\. However, retapping with a different \fIURL\fR will cause an exception, so first \fBuntap\fR if you need to modify the \fIURL\fR\. -. -.TP -\fBtap\fR \fB\-\-repair\fR -Migrate tapped formulae from symlink\-based to directory\-based structure\. -. -.TP -\fBtap\fR \fB\-\-list\-pinned\fR -List all pinned taps\. -. -.TP -\fBtap\-info\fR -Display a brief summary of all installed taps\. -. -.TP -\fBtap\-info\fR (\fB\-\-installed\fR|\fItaps\fR) -Display detailed information about one or more \fItaps\fR\. -. -.IP -Pass \fB\-\-installed\fR to display information on all installed taps\. -. -.TP -\fBtap\-info\fR \fB\-\-json=\fR\fIversion\fR (\fB\-\-installed\fR|\fItaps\fR) -Print a JSON representation of \fItaps\fR\. Currently the only accepted value for \fIversion\fR is \fBv1\fR\. -. -.IP -Pass \fB\-\-installed\fR to get information on installed taps\. -. -.IP -See the docs for examples of using the JSON output: \fIhttps://docs\.brew\.sh/Querying\-Brew\fR -. -.TP -\fBtap\-pin\fR \fItap\fR -Pin \fItap\fR, prioritizing its formulae over core when formula names are supplied by the user\. See also \fBtap\-unpin\fR\. -. -.TP -\fBtap\-unpin\fR \fItap\fR -Unpin \fItap\fR so its formulae are no longer prioritized\. See also \fBtap\-pin\fR\. -. -.TP -\fBuninstall\fR, \fBrm\fR, \fBremove\fR [\fB\-\-force\fR] [\fB\-\-ignore\-dependencies\fR] \fIformula\fR -Uninstall \fIformula\fR\. -. -.IP -If \fB\-\-force\fR (or \fB\-f\fR) is passed, and there are multiple versions of \fIformula\fR installed, delete all installed versions\. -. -.IP -If \fB\-\-ignore\-dependencies\fR is passed, uninstalling won\'t fail, even if formulae depending on \fIformula\fR would still be installed\. -. -.TP -\fBunlink\fR [\fB\-\-dry\-run\fR] \fIformula\fR -Remove symlinks for \fIformula\fR from the Homebrew prefix\. This can be useful for temporarily disabling a formula: \fBbrew unlink\fR \fIformula\fR \fB&&\fR \fIcommands\fR \fB&& brew link\fR \fIformula\fR -. -.IP -If \fB\-\-dry\-run\fR or \fB\-n\fR is passed, Homebrew will list all files which would be unlinked, but will not actually unlink or delete any files\. -. -.TP -\fBunpack\fR [\fB\-\-git\fR|\fB\-\-patch\fR] [\fB\-\-destdir=\fR\fIpath\fR] \fIformulae\fR -Unpack the source files for \fIformulae\fR into subdirectories of the current working directory\. If \fB\-\-destdir=\fR\fIpath\fR is given, the subdirectories will be created in the directory named by \fIpath\fR instead\. -. -.IP -If \fB\-\-patch\fR is passed, patches for \fIformulae\fR will be applied to the unpacked source\. -. -.IP -If \fB\-\-git\fR (or \fB\-g\fR) is passed, a Git repository will be initialized in the unpacked source\. This is useful for creating patches for the software\. -. -.TP -\fBunpin\fR \fIformulae\fR -Unpin \fIformulae\fR, allowing them to be upgraded by \fBbrew upgrade\fR \fIformulae\fR\. See also \fBpin\fR\. -. -.TP -\fBuntap\fR \fItap\fR -Remove a tapped repository\. -. -.TP -\fBupdate\fR [\fB\-\-merge\fR] [\fB\-\-force\fR] -Fetch the newest version of Homebrew and all formulae from GitHub using \fBgit\fR(1) and perform any necessary migrations\. -. -.IP -If \fB\-\-merge\fR is specified then \fBgit merge\fR is used to include updates (rather than \fBgit rebase\fR)\. -. -.IP -If \fB\-\-force\fR (or \fB\-f\fR) is specified then always do a slower, full update check even if unnecessary\. -. -.TP -\fBupdate\-reset\fR [\fIrepositories\fR] -Fetches and resets Homebrew and all tap repositories (or the specified \fBrepositories\fR) using \fBgit\fR(1) to their latest \fBorigin/master\fR\. Note this will destroy all your uncommitted or committed changes\. -. -.TP -\fBupgrade\fR [\fB\-\-debug\fR] [\fB\-\-build\-from\-source\fR|\fB\-\-force\-bottle\fR] [\fB\-\-fetch\-HEAD\fR] [\fB\-\-ignore\-pinned\fR] [\fB\-\-keep\-tmp\fR] [\fB\-\-force\fR] [\fB\-\-verbose\fR] [\fB\-\-display\-times\fR] [\fIformula\fR] [\fIoptions\fR \.\.\.] -Upgrade outdated, unpinned brews (with existing and any appended install options)\. -. -.IP -If \fIformula\fR are given, upgrade only the specified brews (unless they are pinned; see \fBpin\fR, \fBunpin\fR)\. -. -.IP -If \fB\-\-debug\fR (or \fB\-d\fR) is passed and brewing fails, open an interactive debugging session with access to IRB or a shell inside the temporary build directory\. -. -.IP -If \fB\-\-build\-from\-source\fR (or \fB\-s\fR) is passed, compile the specified \fIformula\fR from source even if a bottle is provided\. Dependencies will still be installed from bottles if they are available\. -. -.IP -If \fB\-\-force\-bottle\fR is passed, install from a bottle if it exists for the current or newest version of macOS, even if it would not normally be used for installation\. -. -.IP -If \fB\-\-fetch\-HEAD\fR is passed, fetch the upstream repository to detect if the HEAD installation of the formula is outdated\. Otherwise, the repository\'s HEAD will be checked for updates when a new stable or devel version has been released\. -. -.IP -If \fB\-\-ignore\-pinned\fR is passed, set a 0 exit code even if pinned formulae are not upgraded\. -. -.IP -If \fB\-\-keep\-tmp\fR is passed, the temporary files created during installation are not deleted\. -. -.IP -If \fB\-\-force\fR (or \fB\-f\fR) is passed, install without checking for previously installed keg\-only or non\-migrated versions -. -.IP -If \fB\-\-verbose\fR (or \fB\-v\fR) is passed, print the verification and postinstall steps\. -. -.IP -If \fB\-\-display\-times\fR is passed, install times for each formula are printed at the end of the run\. -. -.IP -Additional options specific to \fIformula\fR may be appended to the command, and can be listed with \fBbrew options\fR \fIformula\fR\. -. -.TP -\fBuses\fR [\fB\-\-installed\fR] [\fB\-\-recursive\fR] [\fB\-\-include\-build\fR] [\fB\-\-include\-test\fR] [\fB\-\-include\-optional\fR] [\fB\-\-skip\-recommended\fR] [\fB\-\-devel\fR|\fB\-\-HEAD\fR] \fIformulae\fR -Show the formulae that specify \fIformulae\fR as a dependency\. When given multiple formula arguments, show the intersection of formulae that use \fIformulae\fR\. -. -.IP -Use \fB\-\-recursive\fR to resolve more than one level of dependencies\. -. -.IP -If \fB\-\-installed\fR is passed, only list installed formulae\. -. -.IP -By default, \fBuses\fR shows all formulae that specify \fIformulae\fR as a required or recommended dependency\. To include the \fB:build\fR type dependencies, pass \fB\-\-include\-build\fR, to include the \fB:test\fR type dependencies, pass \fB\-\-include\-test\fR and to include \fB:optional\fR dependencies pass \fB\-\-include\-optional\fR\. To skip \fB:recommended\fR type dependencies, pass \fB\-\-skip\-recommended\fR\. -. -.IP -By default, \fBuses\fR shows usage of \fIformulae\fR by stable builds\. To find cases where \fIformulae\fR is used by development or HEAD build, pass \fB\-\-devel\fR or \fB\-\-HEAD\fR\. -. -.TP -\fB\-\-cache\fR -Display Homebrew\'s download cache\. See also \fBHOMEBREW_CACHE\fR\. -. -.TP -\fB\-\-cache\fR [\fB\-\-build\-from\-source\fR|\fB\-s\fR] [\fB\-\-force\-bottle\fR] \fIformula\fR -Display the file or directory used to cache \fIformula\fR\. -. -.TP -\fB\-\-cellar\fR -Display Homebrew\'s Cellar path\. \fIDefault:\fR \fB$(brew \-\-prefix)/Cellar\fR, or if that directory doesn\'t exist, \fB$(brew \-\-repository)/Cellar\fR\. -. -.TP -\fB\-\-cellar\fR \fIformula\fR -Display the location in the cellar where \fIformula\fR would be installed, without any sort of versioned directory as the last path\. -. -.TP -\fB\-\-env\fR [\fB\-\-shell=\fR(\fIshell\fR|\fBauto\fR)|\fB\-\-plain\fR] -Show a summary of the Homebrew build environment as a plain list\. -. -.IP -Pass \fB\-\-shell=\fR\fIshell\fR to generate a list of environment variables for the specified shell, or \fB\-\-shell=auto\fR to detect the current shell\. -. -.IP -If the command\'s output is sent through a pipe and no shell is specified, the list is formatted for export to \fBbash\fR(1) unless \fB\-\-plain\fR is passed\. -. -.TP -\fB\-\-prefix\fR -Display Homebrew\'s install path\. \fIDefault:\fR \fB/usr/local\fR on macOS and \fB/home/linuxbrew/\.linuxbrew\fR on Linux -. -.TP -\fB\-\-prefix\fR \fIformula\fR -Display the location in the cellar where \fIformula\fR is or would be installed\. -. -.TP -\fB\-\-repository\fR -Display where Homebrew\'s \fB\.git\fR directory is located\. +.SS "\fBdiy\fR [\fIoptions\fR]" +Automatically determine the installation prefix for non\-Homebrew software\. Using the output from this command, you can install your own software into the Cellar and then link it into Homebrew\'s prefix with \fBbrew link\fR\. . .TP -\fB\-\-repository\fR \fIuser\fR\fB/\fR\fIrepo\fR -Display where tap \fIuser\fR\fB/\fR\fIrepo\fR\'s directory is located\. +\fB\-\-name\fR +Explicitly set the provided \fIname\fR of the package being installed\. . .TP \fB\-\-version\fR -Print the version number of Homebrew to standard output and exit\. +Explicitly set the provided \fIversion\fR of the package being installed\. +. +.SS "\fBdoctor\fR [\fIoptions\fR]" +Check your system for potential problems\. Doctor exits with a non\-zero status if any potential problems are found\. Please note that these warnings are just used to help the Homebrew maintainers with debugging if you file an issue\. If everything you use Homebrew for is working fine: please don\'t worry or file an issue; just ignore this\. +. +.TP +\fB\-\-list\-checks\fR +List all audit methods\. +. +.TP +\fB\-D\fR, \fB\-\-audit\-debug\fR +Enable debugging and profiling of audit methods\. +. +.SS "\fBfetch\fR [\fIoptions\fR] \fIformula\fR" +Download the source packages for the given \fIformula\fR\. For tarballs, also print SHA\-256 checksums\. +. +.TP +\fB\-\-HEAD\fR +Fetch HEAD version instead of stable version\. +. +.TP +\fB\-\-devel\fR +Fetch development version instead of stable version\. +. +.TP +\fB\-\-retry\fR +Retry if a download fails or re\-download if the checksum of a previously cached version no longer matches\. +. +.TP +\fB\-\-deps\fR +Download dependencies for any listed \fIformula\fR\. +. +.TP +\fB\-s\fR, \fB\-\-build\-from\-source\fR +Download the source for rather than a bottle\. +. +.TP +\fB\-\-build\-bottle\fR +Download the source (for eventual bottling) rather than a bottle\. +. +.TP +\fB\-\-force\-bottle\fR +Download a bottle if it exists for the current or newest version of macOS, even if it would not be used during installation\. +. +.SS "\fBgist\-logs\fR [\fIoptions\fR] \fIformula\fR" +Upload logs for a failed build of \fIformula\fR to a new Gist\. +. +.P +\fIformula\fR is usually the name of the formula to install, but it can be specified in several different ways\. +. +.P +If no logs are found, an error message is presented\. +. +.TP +\fB\-\-with\-hostname\fR +Include the hostname in the Gist\. +. +.TP +\fB\-n\fR, \fB\-\-new\-issue\fR +Automatically create a new issue in the appropriate GitHub repository as well as creating the Gist\. +. +.TP +\fB\-p\fR, \fB\-\-private\fR +The Gist will be marked private and will not appear in listings but will be accessible with the link\. +. +.SS "\fBhome\fR [\fIformula\fR]" +Open \fIformula\fR\'s homepage in a browser\. If no formula is provided, open Homebrew\'s own homepage in a browser\. +. +.SS "\fBinfo\fR [\fIformula\fR]" +Display brief statistics for your Homebrew installation\. +. +.TP +\fB\-\-analytics\fR +Display Homebrew analytics data (provided neither \fBHOMEBREW_NO_ANALYTICS\fR or \fBHOMEBREW_NO_GITHUB_API\fR are set)\. +. +.TP +\fB\-\-days\fR +The value for \fBdays\fR must be \fB30\fR, \fB90\fR or \fB365\fR\. The default is \fB30\fR\. +. +.TP +\fB\-\-category\fR +The value for \fBcategory\fR must be \fBinstall\fR, \fBinstall\-on\-request\fR, \fBbuild\-error\fR or \fBos\-version\fR\. The default is \fBinstall\fR\. +. +.TP +\fB\-\-github\fR +Open a browser to the GitHub History page for provided \fIformula\fR\. To view formula history locally: \fBbrew log \-p\fR \fIformula\fR +. +.TP +\fB\-\-json\fR +Print a JSON representation of \fIformula\fR\. Currently the default and only accepted value for \fIversion\fR is \fBv1\fR\. See the docs for examples of using the JSON output: \fIhttps://docs\.brew\.sh/Querying\-Brew\fR +. +.TP +\fB\-\-all\fR +Get information on all formulae\. +. +.TP +\fB\-\-installed\fR +Get information on all installed formulae\. +. +.SS "\fBinstall\fR [\fIoptions\fR] \fIformula\fR" +Install \fIformula\fR\. +. +.P +\fIformula\fR is usually the name of the formula to install, but it can be specified in several different ways\. +. +.TP +\fB\-\-env\fR +If \fBstd\fR is passed, use the standard build environment instead of superenv\.If \fBsuper\fR is passed, use superenv even if the formula specifies the standard build environment\. +. +.TP +\fB\-\-ignore\-dependencies\fR +Skip installing any dependencies of any kind\. If they are not already present, the formula will probably fail to install\. +. +.TP +\fB\-\-only\-dependencies\fR +Install the dependencies with specified options but do not install the specified formula\. +. +.TP +\fB\-\-cc\fR +Attempt to compile using provided \fIcompiler\fR\. \fIcompiler\fR should be the name of the compiler\'s executable, for instance \fBgcc\-7\fR for GCC 7\. In order to use LLVM\'s clang, use \fBllvm_clang\fR\. To specify the Apple\-provided clang, use \fBclang\fR\. This parameter will only accept compilers that are provided by Homebrew or bundled with macOS\. Please do not file issues if you encounter errors while using this flag\. +. +.TP +\fB\-s\fR, \fB\-\-build\-from\-source\fR +Compile the specified \fIformula\fR from source even if a bottle is provided\. Dependencies will still be installed from bottles if they are available\. +. +.TP +\fB\-\-force\-bottle\fR +Install from a bottle if it exists for the current or newest version of macOS, even if it would not normally be used for installation\. +. +.TP +\fB\-\-include\-test\fR +Install testing dependencies required to run \fBbrew test\fR\. +. +.TP +\fB\-\-devel\fR +If \fIformula\fR defines it, install the development version\. +. +.TP +\fB\-\-HEAD\fR +If \fIformula\fR defines it, install the HEAD version, aka\. master, trunk, unstable\. +. +.TP +\fB\-\-fetch\-HEAD\fR +Fetch the upstream repository to detect if the HEAD installation of the formula is outdated\. Otherwise, the repository\'s HEAD will be checked for updates when a new stable or development version has been released\. +. +.TP +\fB\-\-keep\-tmp\fR +Don\'t delete the temporary files created during installation\. +. +.TP +\fB\-\-build\-bottle\fR +Prepare the formula for eventual bottling during installation\. +. +.TP +\fB\-\-display\-times\fR +Print install times for each formula at the end of the run\. +. +.TP +\fB\-i\fR, \fB\-\-interactive\fR +Download and patch \fIformula\fR, then open a shell\. This allows the user to run \fB\./configure \-\-help\fR and otherwise determine how to turn the software package into a Homebrew package\. +. +.TP +\fB\-g\fR, \fB\-\-git\fR +Create a Git repository, useful for creating patches to the software\. +. +.SS "\fBleaves\fR" +Show installed formulae that are not dependencies of another installed formula\. +. +.SS "\fBln\fR, \fBlink\fR [\fIoptions\fR] \fIformula\fR" +Symlink all of \fIformula\fR\'s installed files into the Homebrew prefix\. This is done automatically when you install formulae but can be useful for DIY installations\. +. +.TP +\fB\-\-overwrite\fR +Delete files already existing in the prefix while linking\. +. +.TP +\fB\-n\fR, \fB\-\-dry\-run\fR +List all files which would be linked or deleted by \fBbrew link \-\-overwrite\fR, but will not actually link or delete any files\. +. +.SS "\fBlist\fR, \fBls\fR [\fIoptions\fR]" +List all installed formulae\. +. +.TP +\fB\-\-full\-name\fR +Print formulae with fully\-qualified names\. If \fB\-\-full\-name\fR is not passed, other options (i\.e\. \fB\-1\fR, \fB\-l\fR, \fB\-t\fR and \fB\-r\fR) are passed to \fBls\fR which produces the actual output\. +. +.TP +\fB\-\-unbrewed\fR +List all files in the Homebrew prefix not installed by Homebrew\. +. +.TP +\fB\-\-versions\fR +Show the version number for installed formulae, or only the specified formulae if \fIformula\fR are given\. +. +.TP +\fB\-\-multiple\fR +Only show formulae with multiple versions installed\. +. +.TP +\fB\-\-pinned\fR +Show the versions of pinned formulae, or only the specified (pinned) formulae if \fIformula\fR are given\. See also \fBpin\fR, \fBunpin\fR\. +. +.TP +\fB\-1\fR +Force output to be one entry per line\. This is the default when output is not to a terminal\. +. +.TP +\fB\-l\fR +List in long format\. If the output is to a terminal, a total sum for all the file sizes is output on a line before the long listing\. +. +.TP +\fB\-r\fR +Reverse the order of the sort to get the oldest entries first\. +. +.TP +\fB\-t\fR +Sort by time modified (most recently modified first)\. +. +.SS "\fBlog\fR [\fIoptions\fR] \fIformula\fR" +Show the \fBgit log\fR for the given \fIformula\fR\. +. +.TP +\fB\-p\fR, \fB\-\-patch\fR +Also output patch from commit\. +. +.TP +\fB\-\-stat\fR +Also output diffstat from commit\. +. +.TP +\fB\-\-oneline\fR +Output only one line per commit\. +. +.TP +\fB\-1\fR, \fB\-\-max\-count\fR +Output only one commit\. +. +.SS "\fBmigrate\fR [\fIoptions\fR] \fIformula\fR" +Migrate renamed packages to new name, where \fIformula\fR are old names of packages\. +. +.SS "\fBmissing\fR [\fIoptions\fR] [\fIformule\fR]" +Check the given \fIformula\fR for missing dependencies\. If no \fIformula\fR are given, check all installed brews\. +. +.P +\fBmissing\fR exits with a non\-zero status if any formulae are missing dependencies\. +. +.TP +\fB\-\-hide\fR +Act as if none of the provided \fIhidden\fR are installed\. \fIhidden\fR should be comma\-separated list of formulae\. +. +.SS "\fBoptions\fR [\fIoptions\fR] \fIformula\fR" +Display install options specific to \fIformula\fR +. +.TP +\fB\-\-compact\fR +Show all options on a single line separated by spaces\. +. +.TP +\fB\-\-all\fR +Show options for all formulae\. +. +.TP +\fB\-\-installed\fR +Show options for all installed formulae\. +. +.SS "\fBoutdated\fR [\fIoptions\fR]" +Show formulae that have an updated version available\. +. +.P +By default, version information is displayed in interactive shells, and suppressed otherwise\. +. +.TP +\fB\-\-json\fR +Show output in JSON format for provided \fIversion\fR\. Currently the only accepted value of \fIversion\fR is \fBv1\fR\. +. +.TP +\fB\-\-fetch\-HEAD\fR +Fetch the upstream repository to detect if the HEAD installation of the formula is outdated\. Otherwise, the repository\'s HEAD will be checked for updates when a new stable or development version has been released\. +. +.SS "\fBpin\fR \fIformula\fR" +Pin the specified \fIformula\fR, preventing them from being upgraded when issuing the \fBbrew upgrade\fR \fIformula\fR command\. See also \fBunpin\fR\. +. +.SS "\fBpostinstall\fR \fIformula\fR" +Rerun the post\-install steps for \fIformula\fR\. +. +.SS "\fBreadall\fR [\fIoptions\fR] [\fItap\fR]" +Import all formulae from specified \fItap\fR (defaults to all installed taps)\. This can be useful for debugging issues across all formulae when making significant changes to \fBformula\.rb\fR, testing the performance of loading all formulae or to determine if any current formulae have Ruby issues\. +. +.TP +\fB\-\-aliases\fR +Verify any alias symlinks in each tap\. +. +.TP +\fB\-\-syntax\fR +Syntax\-check all of Homebrew\'s Ruby files\. +. +.SS "\fBreinstall\fR [\fIoptions\fR] \fIformula\fR" +Uninstall and then install \fIformula\fR (with existing and any appended install options)\. +. +.TP +\fB\-s\fR, \fB\-\-build\-from\-source\fR +Compile \fIformula\fR from source even if a bottle is available\. +. +.TP +\fB\-\-force\-bottle\fR +Install from a bottle if it exists for the current or newest version of macOS, even if it would not normally be used for installation\. +. +.TP +\fB\-\-keep\-tmp\fR +Don\'t delete the temporary files created during installation\. +. +.TP +\fB\-\-display\-times\fR +Print install times for each formula at the end of the run\. +. +.SS "\fBsearch\fR [\fIoptions\fR] [\fItext\fR|\fB/\fR\fItext\fR\fB/\fR]" +Perform a substring search of cask tokens and formula names for \fItext\fR\. If \fItext\fR is surrounded with slashes, then it is interpreted as a regular expression\. The search for \fItext\fR is extended online to \fBhomebrew/core\fR and \fBhomebrew/cask\fR\. +. +.P +If no \fItext\fR is passed, display all locally available formulae (including tapped ones)\. No online search is performed\. +. +.TP +\fB\-\-casks\fR +Display all locally available casks (including tapped ones)\. No online search is performed\. +. +.TP +\fB\-\-desc\fR +search formulae with a description matching \fItext\fR and casks with a name matching \fItext\fR\. +. +.TP +\fB\-\-macports\fR +Search for \fItext\fR in the given package manager\'s list\. +. +.TP +\fB\-\-fink\fR +Search for \fItext\fR in the given package manager\'s list\. +. +.TP +\fB\-\-opensuse\fR +Search for \fItext\fR in the given package manager\'s list\. +. +.TP +\fB\-\-fedora\fR +Search for \fItext\fR in the given package manager\'s list\. +. +.TP +\fB\-\-debian\fR +Search for \fItext\fR in the given package manager\'s list\. +. +.TP +\fB\-\-ubuntu\fR +Search for \fItext\fR in the given package manager\'s list\. +. +.SS "\fBsh\fR [\fIoptions\fR]" +Start a Homebrew build environment shell\. Uses our years\-battle\-hardened Homebrew build logic to help your \fB\./configure && make && make install\fR or even your \fBgem install\fR succeed\. Especially handy if you run Homebrew in an Xcode\-only configuration since it adds tools like \fBmake\fR to your \fBPATH\fR which otherwise build systems would not find\. +. +.TP +\fB\-\-env\fR +Use the standard \fBPATH\fR instead of superenv\'s, when \fIstd\fR is passed +. +.SS "\fBshellenv\fR" +Prints export statements \- run them in a shell and this installation of Homebrew will be included into your \fBPATH\fR, \fBMANPATH\fR and \fBINFOPATH\fR\. +. +.P +\fBHOMEBREW_PREFIX\fR, \fBHOMEBREW_CELLAR\fR and \fBHOMEBREW_REPOSITORY\fR are also exported to save multiple queries of those variables\. +. +.P +Consider adding evaluating the output in your dotfiles (e\.g\. \fB~/\.profile\fR) with \fBeval $(brew shellenv)\fR +. +.SS "\fBstyle\fR [\fIoptions\fR] [\fIfile\fR|\fItap\fR|\fIformula\fR]" +Check formulae or files for conformance to Homebrew style guidelines\. +. +.P +Lists of \fIfile\fR, \fItap\fR and \fIformula\fR may not be combined\. If none are provided, \fBstyle\fR will run style checks on the whole Homebrew library, including core code and all formulae\. +. +.TP +\fB\-\-fix\fR +Fix style violations automatically using RuboCop\'s auto\-correct feature\. +. +.TP +\fB\-\-display\-cop\-names\fR +Include the RuboCop cop name for each violation in the output\. +. +.TP +\fB\-\-only\-cops\fR +Specify a comma\-separated \fIcops\fR list to check for violations of only the listed RuboCop cops\. +. +.TP +\fB\-\-except\-cops\fR +Specify a comma\-separated \fIcops\fR list to skip checking for violations of the listed RuboCop cops\. +. +.SS "\fBswitch\fR \fIformula\fR \fIversion\fR" +Symlink all of the specific \fIversion\fR of \fIformula\fR\'s install to Homebrew prefix\. +. +.SS "\fBtap\fR [\fIoptions\fR] \fIuser\fR\fB/\fR\fIrepo\fR [\fIURL\fR]" +Tap a formula repository\. +. +.P +List all installed taps when no arguments are passed\. +. +.P +With \fIURL\fR unspecified, taps a formula repository from GitHub using HTTPS\. Since so many taps are hosted on GitHub, this command is a shortcut for \fBbrew tap\fR \fIuser\fR\fB/\fR\fIrepo\fR \fBhttps://github\.com/\fR\fIuser\fR\fB/homebrew\-\fR\fIrepo\fR\. +. +.P +With \fIURL\fR specified, taps a formula repository from anywhere, using any transport protocol that \fBgit\fR handles\. The one\-argument form of \fBtap\fR simplifies but also limits\. This two\-argument command makes no assumptions, so taps can be cloned from places other than GitHub and using protocols other than HTTPS, e\.g\., SSH, GIT, HTTP, FTP(S), RSYNC\. +. +.TP +\fB\-\-full\fR +Use a full clone when tapping a repository\. By default, the repository is cloned as a shallow copy (\fB\-\-depth=1\fR)\. To convert a shallow copy to a full copy, you can retap passing \fB\-\-full\fR without first untapping\. +. +.TP +\fB\-\-force\-auto\-update\fR +Auto\-update tap even if it is not hosted on GitHub\. By default, only taps hosted on GitHub are auto\-updated (for performance reasons)\. +. +.TP +\fB\-\-repair\fR +Migrate tapped formulae from symlink\-based to directory\-based structure\. +. +.TP +\fB\-\-list\-pinned\fR +List all pinned taps\. +. +.TP +\fB\-q\fR, \fB\-\-quieter\fR +Suppress any warnings\. +. +.SS "\fBtap\-info\fR [\fIoptions\fR] [\fItap\fR]" +Display detailed information about one or more provided \fItap\fR\. Display a brief summary of all installed taps if no \fItap\fR are passed\. +. +.TP +\fB\-\-installed\fR +Display information on all installed taps\. +. +.TP +\fB\-\-json\fR +Print a JSON representation of \fItaps\fR\. Currently the only accepted value for \fIversion\fR is \fBv1\fR\. See the docs for examples of using the JSON output: \fIhttps://docs\.brew\.sh/Querying\-Brew\fR +. +.SS "\fBtap\-pin\fR \fItap\fR" +Pin \fItap\fR, prioritising its formulae over core when formula names are supplied by the user\. See also \fBtap\-unpin\fR\. +. +.SS "\fBtap\-unpin\fR \fItap\fR" +Unpin \fItap\fR so its formulae are no longer prioritised\. See also \fBtap\-pin\fR\. +. +.SS "\fBuninstall\fR, \fBrm\fR, \fBremove\fR [\fIoptions\fR] \fIformula\fR" +Uninstall \fIformula\fR\. +. +.TP +\fB\-\-ignore\-dependencies\fR +Don\'t fail uninstall, even if \fIformula\fR is a dependency of any installed formulae\. +. +.SS "\fBunlink\fR [\fIoptions\fR] \fIformula\fR" +Remove symlinks for \fIformula\fR from the Homebrew prefix\. This can be useful for temporarily disabling a formula: \fBbrew unlink\fR \fIformula\fR \fB&&\fR \fIcommands\fR \fB&& brew link\fR \fIformula\fR +. +.TP +\fB\-n\fR, \fB\-\-dry\-run\fR +List all files which would be unlinked, but will not actually unlink or delete any files\. +. +.SS "\fBunpack\fR [\fIoptions\fR] \fIformula\fR" +Unpack the source files for \fIformula\fR into subdirectories of the current working directory\. +. +.TP +\fB\-\-destdir\fR +Create subdirectories in the directory named by \fIpath\fR instead\. +. +.TP +\fB\-\-patch\fR +Patches for \fIformula\fR will be applied to the unpacked source\. +. +.TP +\fB\-g\fR, \fB\-\-git\fR +Initialise a Git repository in the unpacked source\. This is useful for creating patches for the software\. +. +.SS "\fBunpin\fR \fIformula\fR" +Unpin \fIformula\fR, allowing them to be upgraded by \fBbrew upgrade\fR \fIformula\fR\. See also \fBpin\fR\. +. +.SS "\fBuntap\fR \fItap\fR" +Remove a tapped repository\. +. +.SS "\fBupdate\fR [\fIoptions\fR]" +Fetch the newest version of Homebrew and all formulae from GitHub using \fBgit\fR(1) and perform any necessary migrations\. +. +.TP +\fB\-\-merge\fR +\fBgit merge\fR is used to include updates (rather than \fBgit rebase\fR)\. +. +.TP +\fB\-\-force\fR +Always do a slower, full update check (even if unnecessary)\. +. +.SS "\fBupdate\-reset\fR [\fIrepository\fR]" +Fetches and resets Homebrew and all tap repositories (or any specified \fBrepository\fR) using \fBgit\fR(1) to their latest \fBorigin/master\fR\. Note this will destroy all your uncommitted or committed changes\. +. +.SS "\fBupgrade\fR [\fIoptions\fR] \fIformula\fR" +Upgrade outdated, unpinned brews (with existing and any appended install options)\. +. +.P +If \fIformula\fR are given, upgrade only the specified brews (unless they are pinned; see \fBpin\fR, \fBunpin\fR)\. +. +.TP +\fB\-s\fR, \fB\-\-build\-from\-source\fR +Compile \fIformula\fR from source even if a bottle is available\. +. +.TP +\fB\-\-force\-bottle\fR +Install from a bottle if it exists for the current or newest version of macOS, even if it would not normally be used for installation\. +. +.TP +\fB\-\-fetch\-HEAD\fR +Fetch the upstream repository to detect if the HEAD installation of the formula is outdated\. Otherwise, the repository\'s HEAD will be checked for updates when a new stable or development version has been released\. +. +.TP +\fB\-\-ignore\-pinned\fR +Set a 0 exit code even if pinned formulae are not upgraded\. +. +.TP +\fB\-\-keep\-tmp\fR +Don\'t delete the temporary files created during installation\. +. +.TP +\fB\-\-display\-times\fR +Print install times for each formula at the end of the run\. +. +.SS "\fBuses\fR [\fIoptions\fR] \fIformula\fR" +Show the formulae that specify \fIformula\fR as a dependency\. When given multiple formula arguments, show the intersection of formulae that use \fIformula\fR\. +. +.P +By default, \fBuses\fR shows all formulae that specify \fIformula\fR as a required or recommended dependency\. +. +.P +By default, \fBuses\fR shows usage of \fIformula\fR by stable builds\. +. +.TP +\fB\-\-recursive\fR +Resolve more than one level of dependencies\. +. +.TP +\fB\-\-installed\fR +Only list installed formulae\. +. +.TP +\fB\-\-include\-build\fR +Include all formulae that specify \fIformula\fR as \fB:build\fR type dependency\. +. +.TP +\fB\-\-include\-test\fR +Include all formulae that specify \fIformula\fR as \fB:test\fR type dependency\. +. +.TP +\fB\-\-include\-optional\fR +Include all formulae that specify \fIformula\fR as \fB:optional\fR type dependency\. +. +.TP +\fB\-\-skip\-recommended\fR +Skip all formulae that specify \fIformula\fR as \fB:recommended\fR type dependency\. +. +.TP +\fB\-\-devel\fR +Show usage of \fIformula\fR by development build\. +. +.TP +\fB\-\-HEAD\fR +Show usage of \fIformula\fR by HEAD build\. +. +.SS "\fB\-\-cache\fR [\fIoptions\fR] [\fIformula\fR]" +Display Homebrew\'s download cache\. See also \fBHOMEBREW_CACHE\fR\. +. +.P +If \fIformula\fR is provided, display the file or directory used to cache \fIformula\fR\. +. +.TP +\fB\-s\fR, \fB\-\-build\-from\-source\fR +Show the cache file used when building from source\. +. +.TP +\fB\-\-force\-bottle\fR +Show the cache file used when pouring a bottle\. +. +.SS "\fB\-\-cache\fR [\fIformula\fR]" +Display Homebrew\'s Cellar path\. \fIDefault:\fR \fB$(brew \-\-prefix)/Cellar\fR, or if that directory doesn\'t exist, \fB$(brew \-\-repository)/Cellar\fR\. +. +.P +If \fIformula\fR is provided, display the location in the cellar where \fIformula\fR would be installed, without any sort of versioned directory as the last path\. +. +.SS "\fB\-\-env\fR [\fIoptions\fR]" +Show a summary of the Homebrew build environment as a plain list\. +. +.P +If the command\'s output is sent through a pipe and no shell is specified, the list is formatted for export to \fBbash\fR(1) unless \fB\-\-plain\fR is passed\. +. +.TP +\fB\-\-shell\fR +Generate a list of environment variables for the specified shell, or \fB\-\-shell=auto\fR to detect the current shell\. +. +.TP +\fB\-\-plain\fR +Plain output even when piped\. +. +.SS "\fB\-\-prefix\fR [\fIformula\fR]" +Display Homebrew\'s install path\. \fIDefault:\fR \fB/usr/local\fR on macOS and \fB/home/linuxbrew/\.linuxbrew\fR on Linux\. +. +.P +If \fIformula\fR is provided, display the location in the cellar where \fIformula\fR is or would be installed\. +. +.SS "\fB\-\-repository\fR [\fIformula\fR]" +Display where Homebrew\'s \fB\.git\fR directory is located\. +. +.P +If \fIuser\fR\fB/\fR\fIrepo\fR are provided, display where tap \fIuser\fR\fB/\fR\fIrepo\fR\'s directory is located\. +. +.SS "\fB\-\-version\fR" +Print the version number of Homebrew, Homebrew/homebrew\-core and Homebrew/homebrew\-cask (if tapped) to standard output and exit\. . .SH "DEVELOPER COMMANDS" . -.SS "\fBaudit\fR [\fIoptions\fR] \fIformulae\fR" -Check \fIformulae\fR for Homebrew coding style violations\. This should be run 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 \fIformulae\fR are provided, all of them are checked\. +.SS "\fBaudit\fR [\fIoptions\fR] \fIformula\fR" +Check \fIformula\fR for Homebrew coding style violations\. This should be run 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 \fIformula\fR are provided, all of them are checked\. . .TP \fB\-\-strict\fR @@ -772,7 +815,7 @@ Specify a comma\-separated \fIcops\fR list to check for violations of only the l \fB\-\-except\-cops\fR Specify a comma\-separated \fIcops\fR list to skip checking for violations of the listed RuboCop cops\. . -.SS "\fBbottle\fR [\fIoptions\fR] \fIformulae\fR" +.SS "\fBbottle\fR [\fIoptions\fR] \fIformula\fR" Generate a bottle (binary package) from a formula that was installed with \fB\-\-build\-bottle\fR\. If the formula specifies a rebuild version, it will be incremented in the generated DSL\. Passing \fB\-\-keep\-old\fR will attempt to keep it at its original value, while \fB\-\-no\-rebuild\fR will remove it\. . .TP @@ -914,7 +957,7 @@ Set the version of the new formula to the provided \fIversion\fR\. \fB\-\-tap\fR Generate the new formula in the provided tap, specified as \fIuser\fR\fB/\fR\fIrepo\fR\. . -.SS "\fBedit\fR [\fIformulae\fR]" +.SS "\fBedit\fR [\fIformula\fR]" Open a formula in the editor set by \fBEDITOR\fR or \fBHOMEBREW_EDITOR\fR, or open the Homebrew repository for editing if no \fIformula\fR is provided\. . .SS "\fBextract\fR [\fIoptions\fR] \fIformula\fR \fItap\fR" @@ -924,7 +967,7 @@ Look through repository history to find the most recent version of \fIformula\fR \fB\-\-version\fR Extract the provided \fIversion\fR of \fIformula\fR instead of the most recent\. . -.SS "\fBformula\fR \fIformulae\fR" +.SS "\fBformula\fR \fIformula\fR" Display the path where a formula is located\. . .SS "\fBirb\fR [\fIoptions\fR]" @@ -938,7 +981,7 @@ Show several examples\. \fB\-\-pry\fR Use Pry instead of IRB\. Implied if \fBHOMEBREW_PRY\fR is set\. . -.SS "\fBlinkage\fR [\fIoptions\fR] [\fIformulae\fR]" +.SS "\fBlinkage\fR [\fIoptions\fR] [\fIformula\fR]" Check the library links for kegs of installed formulae\. Raises an error if run on uninstalled formulae\. . .TP @@ -964,32 +1007,14 @@ Return a failing status code if changes are detected in the manpage outputs\. Th \fB\-\-link\fR This is now done automatically by \fBbrew update\fR\. . -.SS "\fBmirror\fR \fIformulae\fR" -Reuploads the stable URL for a formula to Bintray to use it as a mirror\. +.SS "\fBprof\fR \fIcommand\fR" +Run Homebrew with the Ruby profiler e\.g\. \fBbrew prof readall\fR\. . -.SS "\fBprof\fR [\fIruby options\fR]" -Run Homebrew with the Ruby profiler\. -. -.P -\fIExample:\fR \fBbrew prof readall\fR -. -.SS "\fBpull\fR [\fIoptions\fR] \fIpatch sources\fR" +.SS "\fBpull\fR [\fIoptions\fR] \fIpatch\fR" Get a patch from a GitHub commit or pull request and apply it to Homebrew\. Optionally, publish updated bottles for the formulae changed by the patch\. . .P -Each \fIpatch source\fR may be one of: -. -.P -~ The ID number of a PR (pull request) in the homebrew/core GitHub repository -. -.P -~ 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\. -. -.P -~ The URL of a commit on GitHub -. -.P -~ A "https://jenkins\.brew\.sh/job/\.\.\." string specifying a testing job ID +Each \fIpatch\fR may be the number of a PR in homebrew/core, the URL of a PR on GitHub, the URL of a commit on GitHub or a "https://jenkins\.brew\.sh/job/\.\.\." testing job URL\. . .TP \fB\-\-bottle\fR @@ -1042,11 +1067,8 @@ Print the merged pull requests on Homebrew/brew between two Git refs\. If no \fI \fB\-\-markdown\fR Print as a Markdown list\. . -.SS "\fBruby\fR [\fIruby options\fR]" -Run a Ruby instance with Homebrew\'s libraries loaded\. -. -.P -\fIExample:\fR \fBbrew ruby \-e "puts :gcc\.f\.deps"\fR or \fBbrew ruby script\.rb\fR +.SS "\fBruby\fR [\fB\-e\fR]:" +Run a Ruby instance with Homebrew\'s libraries loaded e\.g\. \fBbrew ruby \-e "puts :gcc\.f\.deps"\fR or \fBbrew ruby script\.rb\fR . .TP \fB\-e\fR @@ -1055,7 +1077,7 @@ Execute the provided string argument as a script\. .SS "\fBtap\-new\fR \fIuser\fR\fB/\fR\fIrepo\fR" Generate the template files for a new tap\. . -.SS "\fBtest\fR [\fIoptions\fR] \fIformulae\fR" +.SS "\fBtest\fR [\fIoptions\fR] \fIformula\fR" Run the test method provided by an installed formula\. There is no standard output or return code, but generally it should notify the user if something is wrong with the installed formula\. . .P @@ -1098,7 +1120,7 @@ Run only \fItest_script\fR\fB_spec\.rb\fR\. Appending \fB:\fR\fIline_number\fR w . .TP \fB\-\-seed\fR -Randomize tests with the provided \fIvalue\fR instead of a random seed\. +Randomise tests with the provided \fIvalue\fR instead of a random seed\. . .SS "\fBupdate\-test\fR [\fIoptions\fR]" Run a test of \fBbrew update\fR with a new repository clone\. If no arguments are passed, use \fBorigin/master\fR as the start commit\. @@ -1119,10 +1141,8 @@ Use provided \fIcommit\fR as the start commit\. \fB\-\-before\fR Use the commit at provided \fIdate\fR as the start commit\. . -.TP -\fBvendor\-gems\fR +.SS "\fBvendor\-gems\fR" Install and commit Homebrew\'s vendored gems\. - . .SH "GLOBAL OPTIONS" These options are applicable across all sub\-commands\. @@ -1145,102 +1165,24 @@ Override warnings and enable potentially unsafe operations\. . .SH "OFFICIAL EXTERNAL COMMANDS" . -.TP -\fBbundle\fR \fIcommand\fR -Bundler for non\-Ruby dependencies from Homebrew\. +.SS "\fBbundle\fR \fIsubcommand\fR:" +Bundler for non\-Ruby dependencies from Homebrew, Homebrew Cask and the Mac App Store\. See \fBbrew bundle \-\-help\fR\. . -.IP -\fBbrew bundle\fR [\fBinstall\fR] [\fB\-v\fR|\fB\-\-verbose\fR] [\fB\-\-no\-upgrade\fR] [\fB\-\-file=\fR\fIpath\fR|\fB\-\-global\fR] - Install or upgrade all dependencies in a Brewfile\. -. -.IP -\fBbrew bundle dump\fR [\fB\-\-force\fR] [\fB\-\-describe\fR] [\fB\-\-file=\fR\fIpath\fR|\fB\-\-global\fR] - Write all installed casks/formulae/taps into a Brewfile\. -. -.IP -\fBbrew bundle cleanup\fR [\fB\-\-force\fR] [\fB\-\-zap\fR] [\fB\-\-file=\fR\fIpath\fR|\fB\-\-global\fR] - Uninstall all dependencies not listed in a Brewfile\. -. -.IP -\fBbrew bundle check\fR [\fB\-\-no\-upgrade\fR] [\fB\-\-file=\fR\fIpath\fR|\fB\-\-global\fR] [\fB\-\-verbose\fR] - Check if all dependencies are installed in a Brewfile\. Missing dependencies are listed in verbose mode\. \fBcheck\fR will exit on the first category missing a dependency unless in verbose mode\. -. -.IP -\fBbrew bundle exec\fR \fIcommand\fR - Run an external command in an isolated build environment\. -. -.IP -\fBbrew bundle list\fR [\fB\-\-all\fR|\fB\-\-brews\fR|\fB\-\-casks\fR|\fB\-\-taps\fR|\fB\-\-mas\fR] [\fB\-\-file=\fR\fIpath\fR|\fB\-\-global\fR] - List all dependencies present in a Brewfile, optionally limiting by types\. By default, only brew dependencies are output\. -. -.IP -If \fB\-v\fR or \fB\-\-verbose\fR are passed, print verbose output\. -. -.IP -If \fB\-\-no\-upgrade\fR is passed, don\'t run \fBbrew upgrade\fR on outdated dependencies\. Note they may still be upgraded by \fBbrew install\fR if needed\. -. -.IP -If \fB\-\-force\fR is passed, uninstall dependencies or overwrite an existing Brewfile\. -. -.IP -If \fB\-\-zap\fR is passed, casks will be removed using the \fBzap\fR command instead of \fBuninstall\fR\. -. -.IP -If \fB\-\-file=\fR\fIpath\fR is passed, the Brewfile path is set accordingly\. Use \fB\-\-file=\-\fR to output to console\. -. -.IP -If \fB\-\-global\fR is passed, set the Brewfile path to \fB~/\.Brewfile\fR\. -. -.IP -If \fB\-\-describe\fR is passed, output a description comment above each line\. This comment will not be output if the dependency does not have a description\. -. -.IP -If \fB\-h\fR or \fB\-\-help\fR are passed, print this help message and exit\. -. -.IP +.P \fBHomebrew/homebrew\-bundle\fR \fIhttps://github\.com/Homebrew/homebrew\-bundle\fR . -.TP -\fBcask\fR [\fB\-\-version\fR | \fBaudit\fR | \fBcat\fR | \fBcleanup\fR | \fBcreate\fR | \fBdoctor\fR | \fBedit\fR | \fBfetch\fR | \fBhome\fR | \fBinfo\fR] -Install macOS applications distributed as binaries\. +.SS "\fBcask\fR \fIsubcommand\fR:" +Install macOS applications distributed as binaries\. See brew\-cask(1)\. . -.IP +.P \fBHomebrew/homebrew\-cask\fR \fIhttps://github\.com/Homebrew/homebrew\-cask\fR . -.TP -\fBservices\fR \fIcommand\fR -Integrates Homebrew formulae with macOS\' \fBlaunchctl\fR manager\. +.SS "\fBservices\fR \fIsubcommand\fR:" +Manage background services with macOS\' \fBlaunchctl\fR(1) daemon manager\. See \fBbrew services \-\-help\fR\. . -.IP -[\fBsudo\fR] \fBbrew services list\fR - List all running services for the current user (or root)\. -. -.IP -[\fBsudo\fR] \fBbrew services run\fR (\fIformula\fR|\fB\-\-all\fR) - Run the service \fIformula\fR without registering to launch at login (or boot)\. -. -.IP -[\fBsudo\fR] \fBbrew services start\fR (\fIformula\fR|\fB\-\-all\fR) - Start the service \fIformula\fR immediately and register it to launch at login (or boot)\. -. -.IP -[\fBsudo\fR] \fBbrew services stop\fR (\fIformula\fR|\fB\-\-all\fR) - Stop the service \fIformula\fR immediately and unregister it from launching at login (or boot)\. -. -.IP -[\fBsudo\fR] \fBbrew services restart\fR (\fIformula\fR|\fB\-\-all\fR) - Stop (if necessary) and start the service \fIformula\fR immediately and register it to launch at login (or boot)\. -. -.IP -[\fBsudo\fR] \fBbrew services cleanup\fR - Remove all unused services\. -. -.IP -If \fBsudo\fR is passed, operate on \fB/Library/LaunchDaemons\fR (started at boot)\. Otherwise, operate on \fB~/Library/LaunchAgents\fR (started at login)\. -. -.IP +.P \fBHomebrew/homebrew\-services\fR \fIhttps://github\.com/Homebrew/homebrew\-services\fR . @@ -1372,7 +1314,7 @@ If set, Homebrew will fail on the failure of installation from a bottle rather t . .TP \fBHOMEBREW_NO_COLOR\fR -If set, Homebrew will not print text with color added\. +If set, Homebrew will not print text with colour added\. . .TP \fBHOMEBREW_NO_EMOJI\fR From 901d738ce1aee98242f5a07a24bb24b8dd1f34f4 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:35:50 +0000 Subject: [PATCH 117/199] docs/querying-brew: point to `brew info --help`. --- docs/Querying-Brew.md | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/docs/Querying-Brew.md b/docs/Querying-Brew.md index 0f407c3bbe..625eaffdee 100644 --- a/docs/Querying-Brew.md +++ b/docs/Querying-Brew.md @@ -12,16 +12,7 @@ To enable users to do rich queries without the problems above, Homebrew provides ## `brew info --json` -`brew info` outputs JSON-formatted information about formulae. This JSON can then be parsed using your tools of choice. - -From the manpage: - - * `info --json= (--all|--installed|)`: - Print a JSON representation of ``. Currently the only accepted value - for `` is `v1`. - - Pass `--all` to get information on all formulae, or `--installed` to get - information on all installed formulae. +`brew info` outputs JSON-formatted information about formulae. This JSON can then be parsed using your tools of choice. See more details in `brew info --help`. The current schema version is `v1`. Note that fields may be added to the schema as needed without incrementing the schema. Any significant breaking changes will cause a change to the schema version. From fd4e45c688631db4c24841e98a811376d4a58e08 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Jan 2019 21:59:55 +0000 Subject: [PATCH 118/199] lines_spec: fix a typo. --- Library/Homebrew/cmd/update-report.rb | 1 + Library/Homebrew/test/rubocops/lines_spec.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb index 92497f6972..6d31330b08 100644 --- a/Library/Homebrew/cmd/update-report.rb +++ b/Library/Homebrew/cmd/update-report.rb @@ -4,6 +4,7 @@ require "formulary" require "descriptions" require "cleanup" require "description_cache_store" +require "cli_parser" module Homebrew module_function diff --git a/Library/Homebrew/test/rubocops/lines_spec.rb b/Library/Homebrew/test/rubocops/lines_spec.rb index 7598d8f696..193d2b8cda 100644 --- a/Library/Homebrew/test/rubocops/lines_spec.rb +++ b/Library/Homebrew/test/rubocops/lines_spec.rb @@ -650,7 +650,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do RUBY end - it "dependecies which have to vendored" do + it "dependencies which have to vendored" do expect_offense(<<~RUBY) class Foo < Formula desc "foo" From 72a95edcfb2ba6622adea1baf3471163226d15d1 Mon Sep 17 00:00:00 2001 From: Bryce Glover Date: Sun, 27 Jan 2019 18:49:25 -0500 Subject: [PATCH 119/199] [cleaner.rb] clean_dirs: Remove symbolic links if they point to static libra- ries. Reopens Homebrew/homebrew-core#35269. Closes Homebrew/homebrew-core#35269. --- Library/Homebrew/cleaner.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cleaner.rb b/Library/Homebrew/cleaner.rb index 9eed49ac61..6fc4ef0774 100644 --- a/Library/Homebrew/cleaner.rb +++ b/Library/Homebrew/cleaner.rb @@ -88,10 +88,12 @@ class Cleaner Find.prune if @f.skip_clean? path - next if path.symlink? || path.directory? + next if path.directory? if path.extname == ".la" path.unlink + elsif path.symlink? + # Skip it. elsif path.basename.to_s == "perllocal.pod" # Both this file & the .packlist one below are completely unnecessary # to package & causes pointless conflict with other formulae. They are From 15403183f2eff07cb8c07298b3bbe3e3ca49f88d Mon Sep 17 00:00:00 2001 From: Reto Kromer Date: Thu, 31 Jan 2019 20:33:16 +0100 Subject: [PATCH 120/199] fix typo --- Library/Homebrew/cmd/cat.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/cat.rb b/Library/Homebrew/cmd/cat.rb index b7cfb1af96..b7d3976555 100644 --- a/Library/Homebrew/cmd/cat.rb +++ b/Library/Homebrew/cmd/cat.rb @@ -8,7 +8,7 @@ module Homebrew usage_banner <<~EOS `cat` - Display the source to . + Display the source of . EOS end end From 7c1d3bef2b8a3c40dc4150a0355339c0d36f4c2d Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 1 Feb 2019 13:57:50 +0000 Subject: [PATCH 121/199] Commit typo manpage updates. --- docs/Manpage.md | 2 +- manpages/brew-cask.1 | 2 +- manpages/brew.1 | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/Manpage.md b/docs/Manpage.md index 7ecec9fa7f..e2d21f0fbb 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -49,7 +49,7 @@ If `regenerate-uuid` is passed, regenerate UUID used in Homebrew's analytics. ### `cat` *`formula`* -Display the source to *`formula`*. +Display the source of *`formula`*. ### `cleanup` [*`options`*] [*`formula`*|*`cask`*] diff --git a/manpages/brew-cask.1 b/manpages/brew-cask.1 index bbbd2aec8f..3e5bbc21e0 100644 --- a/manpages/brew-cask.1 +++ b/manpages/brew-cask.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BREW\-CASK" "1" "January 2019" "Homebrew" "brew-cask" +.TH "BREW\-CASK" "1" "February 2019" "Homebrew" "brew-cask" . .SH "NAME" \fBbrew\-cask\fR \- a friendly binary installer for macOS diff --git a/manpages/brew.1 b/manpages/brew.1 index 789cde567a..a8c9a6c862 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BREW" "1" "January 2019" "Homebrew" "brew" +.TH "BREW" "1" "February 2019" "Homebrew" "brew" . .SH "NAME" \fBbrew\fR \- The missing package manager for macOS @@ -45,7 +45,7 @@ If \fBstate\fR is passed, display anonymous user behaviour analytics state\. Rea If \fBregenerate\-uuid\fR is passed, regenerate UUID used in Homebrew\'s analytics\. . .SS "\fBcat\fR \fIformula\fR" -Display the source to \fIformula\fR\. +Display the source of \fIformula\fR\. . .SS "\fBcleanup\fR [\fIoptions\fR] [\fIformula\fR|\fIcask\fR]" Remove stale lock files and outdated downloads for formulae and casks, and remove old versions of installed formulae\. If arguments are specified, only do this for the specified formulae and casks\. From b0124c4fb0fea355eb8e94a7a154858aa4d361fc Mon Sep 17 00:00:00 2001 From: Danny Weinberg Date: Fri, 1 Feb 2019 14:22:36 -0800 Subject: [PATCH 122/199] Cask handle already downloaded file The current logic for curl_download tries to restart any existing partial download, but this fails for some servers when the file is already fully downloaded, returning a status code 416. This updates the function to check for the file being already downloaded and if so bails early. The following command used to fail when run more than once but now works as expected: ``` brew cask info https://raw.githubusercontent.com/homebrew/homebrew-cask/master/Casks/docker.rb ``` --- Library/Homebrew/test/cask/cmd/info_spec.rb | 28 +++++++++++++++++++++ Library/Homebrew/utils/curl.rb | 18 ++++++++++--- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/test/cask/cmd/info_spec.rb b/Library/Homebrew/test/cask/cmd/info_spec.rb index 1685b22483..ae5ad215ef 100644 --- a/Library/Homebrew/test/cask/cmd/info_spec.rb +++ b/Library/Homebrew/test/cask/cmd/info_spec.rb @@ -136,4 +136,32 @@ describe Cask::Cmd::Info, :cask do Caffeine.app (App) EOS end + + it "can run be run with a url twice" do + expect { + described_class.run("https://raw.githubusercontent.com/Homebrew/homebrew-cask" \ + "/d0b2c58652ae5eff20a7a4ac93292a08b250912b/Casks/docker.rb") + described_class.run("https://raw.githubusercontent.com/Homebrew/homebrew-cask" \ + "/d0b2c58652ae5eff20a7a4ac93292a08b250912b/Casks/docker.rb") + }.to output(<<~EOS).to_stdout + ==> Downloading https://raw.githubusercontent.com/Homebrew/homebrew-cask/d0b2c58652ae5eff20a7a4ac93292a08b250912b/Casks/docker.rb. + docker: 2.0.0.2-ce-mac81,30215 (auto_updates) + https://www.docker.com/community-edition + Not installed + ==> Names + Docker Community Edition + Docker CE + ==> Artifacts + Docker.app (App) + ==> Downloading https://raw.githubusercontent.com/Homebrew/homebrew-cask/d0b2c58652ae5eff20a7a4ac93292a08b250912b/Casks/docker.rb. + docker: 2.0.0.2-ce-mac81,30215 (auto_updates) + https://www.docker.com/community-edition + Not installed + ==> Names + Docker Community Edition + Docker CE + ==> Artifacts + Docker.app (App) + EOS + end end diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index 5b0c5a66db..bcc47d4394 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -51,10 +51,20 @@ def curl_download(*args, to: nil, **options) destination = Pathname(to) destination.dirname.mkpath - continue_at = if destination.exist? && - curl_output("--location", "--range", "0-1", - "--write-out", "%{http_code}", - "--output", "/dev/null", *args, **options).stdout.to_i == 206 # Partial Content + range_stdout = curl_output("--location", "--range", "0-1", + "--dump-header", "-", + "--write-out", "%{http_code}", + "--output", "/dev/null", *args, **options).stdout + headers, _, http_status = range_stdout.partition("\r\n\r\n") + + supports_partial_download = http_status.to_i == 206 # Partial Content + if supports_partial_download && + destination.exist? && + destination.size == %r{^.*Content-Range: bytes \d+-\d+/(\d+)\r\n.*$}m.match(headers)[1].to_i + return # We've already downloaded all the bytes + end + + continue_at = if destination.exist? && supports_partial_download "-" else 0 From 4101bfda8189c37cf612e1fd676b590eacf6e3c3 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 2 Feb 2019 18:34:44 +0100 Subject: [PATCH 123/199] update-reset: avoid hanging on shallow-since. For some reason this seems to hang when there's been no commits since the latest tag. Not a problem in `brew update`. --- Library/Homebrew/cmd/update-reset.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Library/Homebrew/cmd/update-reset.sh b/Library/Homebrew/cmd/update-reset.sh index 7e1d44b93d..70e2867a62 100644 --- a/Library/Homebrew/cmd/update-reset.sh +++ b/Library/Homebrew/cmd/update-reset.sh @@ -35,14 +35,7 @@ homebrew-update-reset() { [[ -d "$DIR/.git" ]] || continue cd "$DIR" || continue echo "==> Fetching $DIR..." - - if [[ "$DIR" = "$HOMEBREW_REPOSITORY" ]]; then - latest_tag="$(git ls-remote --tags --refs -q origin | tail -n1 | cut -f2)" - git fetch --force origin --shallow-since="$latest_tag" - else - git fetch --force --tags origin - fi - + git fetch --force --tags origin echo echo "==> Resetting $DIR..." From 267d72198833aae29d5fe1baca06a00915b1cc4d Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sun, 3 Feb 2019 09:34:00 +0100 Subject: [PATCH 124/199] Note HOMEBREW_NO_INSTALL_CLEANUP in the help/manual --- Library/Homebrew/cmd/install.rb | 2 ++ Library/Homebrew/cmd/reinstall.rb | 2 ++ Library/Homebrew/cmd/upgrade.rb | 2 ++ Library/Homebrew/manpages/brew.1.md.erb | 4 ++-- docs/Manpage.md | 10 ++++++++-- manpages/brew.1 | 11 ++++++++++- 6 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index a04140527e..061d78ea23 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -20,6 +20,8 @@ module Homebrew is usually the name of the formula to install, but it can be specified in several different ways. + + Unless `HOMEBREW_NO_INSTALL_CLEANUP` is set, `brew cleanup` will be run for the installed formulae or, every 30 days, for all formulae. EOS switch :debug, diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index 35fdecee02..19527ec3cd 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -14,6 +14,8 @@ module Homebrew `reinstall` [] Uninstall and then install (with existing and any appended install options). + + Unless `HOMEBREW_NO_INSTALL_CLEANUP` is set, `brew cleanup` will be run for the reinstalled formulae or, every 30 days, for all formulae. EOS switch :debug, description: "If brewing fails, open an interactive debugging session with access to IRB "\ diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 93b96c9ce5..d82636f209 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -18,6 +18,8 @@ module Homebrew If are given, upgrade only the specified brews (unless they are pinned; see `pin`, `unpin`). + + Unless `HOMEBREW_NO_INSTALL_CLEANUP` is set, `brew cleanup` will be run for the upgraded formulae or, every 30 days, for all formulae. EOS switch :debug, description: "If brewing fails, open an interactive debugging session with access to IRB "\ diff --git a/Library/Homebrew/manpages/brew.1.md.erb b/Library/Homebrew/manpages/brew.1.md.erb index fda085b6c4..37cd35c7a7 100644 --- a/Library/Homebrew/manpages/brew.1.md.erb +++ b/Library/Homebrew/manpages/brew.1.md.erb @@ -238,8 +238,8 @@ Note that environment variables must have a value set to be detected. For exampl * `HOMEBREW_NO_INSTALL_CLEANUP`: If set, `brew install`, `brew upgrade` and `brew reinstall` will never - automatically remove the previously installed version(s) of the - installed/upgraded formulae. + automatically cleanup the installed/upgraded/reinstalled formulae or all + formulae every 30 days. * `HOMEBREW_PRY`: If set, Homebrew will use Pry for the `brew irb` command. diff --git a/docs/Manpage.md b/docs/Manpage.md index e2d21f0fbb..62a7601566 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -217,6 +217,8 @@ Install *`formula`*. *`formula`* is usually the name of the formula to install, but it can be specified in several different ways. +Unless `HOMEBREW_NO_INSTALL_CLEANUP` is set, `brew cleanup` will be run for the installed formulae or, every 30 days, for all formulae. + * `--env`: If `std` is passed, use the standard build environment instead of superenv.If `super` is passed, use superenv even if the formula specifies the standard build environment. * `--ignore-dependencies`: @@ -362,6 +364,8 @@ all formulae or to determine if any current formulae have Ruby issues. Uninstall and then install *`formula`* (with existing and any appended install options). +Unless `HOMEBREW_NO_INSTALL_CLEANUP` is set, `brew cleanup` will be run for the reinstalled formulae or, every 30 days, for all formulae. + * `-s`, `--build-from-source`: Compile *`formula`* from source even if a bottle is available. * `--force-bottle`: @@ -538,6 +542,8 @@ Upgrade outdated, unpinned brews (with existing and any appended install options If *`formula`* are given, upgrade only the specified brews (unless they are pinned; see `pin`, `unpin`). +Unless `HOMEBREW_NO_INSTALL_CLEANUP` is set, `brew cleanup` will be run for the upgraded formulae or, every 30 days, for all formulae. + * `-s`, `--build-from-source`: Compile *`formula`* from source even if a bottle is available. * `--force-bottle`: @@ -1107,8 +1113,8 @@ Note that environment variables must have a value set to be detected. For exampl * `HOMEBREW_NO_INSTALL_CLEANUP`: If set, `brew install`, `brew upgrade` and `brew reinstall` will never - automatically remove the previously installed version(s) of the - installed/upgraded formulae. + automatically cleanup the installed/upgraded/reinstalled formulae or all + formulae every 30 days. * `HOMEBREW_PRY`: If set, Homebrew will use Pry for the `brew irb` command. diff --git a/manpages/brew.1 b/manpages/brew.1 index a8c9a6c862..744b2382ca 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -259,6 +259,9 @@ Install \fIformula\fR\. .P \fIformula\fR is usually the name of the formula to install, but it can be specified in several different ways\. . +.P +Unless \fBHOMEBREW_NO_INSTALL_CLEANUP\fR is set, \fBbrew cleanup\fR will be run for the installed formulae or, every 30 days, for all formulae\. +. .TP \fB\-\-env\fR If \fBstd\fR is passed, use the standard build environment instead of superenv\.If \fBsuper\fR is passed, use superenv even if the formula specifies the standard build environment\. @@ -453,6 +456,9 @@ Syntax\-check all of Homebrew\'s Ruby files\. .SS "\fBreinstall\fR [\fIoptions\fR] \fIformula\fR" Uninstall and then install \fIformula\fR (with existing and any appended install options)\. . +.P +Unless \fBHOMEBREW_NO_INSTALL_CLEANUP\fR is set, \fBbrew cleanup\fR will be run for the reinstalled formulae or, every 30 days, for all formulae\. +. .TP \fB\-s\fR, \fB\-\-build\-from\-source\fR Compile \fIformula\fR from source even if a bottle is available\. @@ -652,6 +658,9 @@ Upgrade outdated, unpinned brews (with existing and any appended install options .P If \fIformula\fR are given, upgrade only the specified brews (unless they are pinned; see \fBpin\fR, \fBunpin\fR)\. . +.P +Unless \fBHOMEBREW_NO_INSTALL_CLEANUP\fR is set, \fBbrew cleanup\fR will be run for the upgraded formulae or, every 30 days, for all formulae\. +. .TP \fB\-s\fR, \fB\-\-build\-from\-source\fR Compile \fIformula\fR from source even if a bottle is available\. @@ -1336,7 +1345,7 @@ If set, Homebrew will not use the GitHub API, e\.g\. for searches or fetching re . .TP \fBHOMEBREW_NO_INSTALL_CLEANUP\fR -If set, \fBbrew install\fR, \fBbrew upgrade\fR and \fBbrew reinstall\fR will never automatically remove the previously installed version(s) of the installed/upgraded formulae\. +If set, \fBbrew install\fR, \fBbrew upgrade\fR and \fBbrew reinstall\fR will never automatically cleanup the installed/upgraded/reinstalled formulae or all formulae every 30 days\. . .TP \fBHOMEBREW_PRY\fR From 6fe75fb1542995cdc641ca77f0529bfbb66f958e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sun, 3 Feb 2019 15:32:30 +0100 Subject: [PATCH 125/199] cleanup: fix stale cask detection. This method is also run to check formulae and if a formula and cask have the same name (e.g. `cmake`) then this method would mark all formulae downloads to being stale. Instead, check the `dirname` (which we're using for globs anyway) to double check that this is definitely a stale cask. --- Library/Homebrew/cleanup.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Library/Homebrew/cleanup.rb b/Library/Homebrew/cleanup.rb index 386d2e5da7..c2c03614ba 100644 --- a/Library/Homebrew/cleanup.rb +++ b/Library/Homebrew/cleanup.rb @@ -112,6 +112,8 @@ module CleanupRefinement def stale_cask?(scrub) return false unless name = basename.to_s[/\A(.*?)\-\-/, 1] + return if dirname.basename.to_s != "Cask" + cask = begin Cask::CaskLoader.load(name) rescue Cask::CaskUnavailableError From 6db1b0abd869c091a889c5342203599a3291d3eb Mon Sep 17 00:00:00 2001 From: Danny Weinberg Date: Sun, 3 Feb 2019 10:52:09 -0800 Subject: [PATCH 126/199] Handle regex not finding anything --- Library/Homebrew/utils/curl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index bcc47d4394..d66fec1dcb 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -60,7 +60,7 @@ def curl_download(*args, to: nil, **options) supports_partial_download = http_status.to_i == 206 # Partial Content if supports_partial_download && destination.exist? && - destination.size == %r{^.*Content-Range: bytes \d+-\d+/(\d+)\r\n.*$}m.match(headers)[1].to_i + destination.size == %r{^.*Content-Range: bytes \d+-\d+/(\d+)\r\n.*$}m.match(headers)&.[](1)&.to_i return # We've already downloaded all the bytes end From ba057ad239355a453bef328532497f11d509a930 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Mon, 4 Feb 2019 08:38:24 +0100 Subject: [PATCH 127/199] Fixes #5663 --- Library/Homebrew/cmd/upgrade.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index d82636f209..34ef98199f 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -56,6 +56,8 @@ module Homebrew odisabled("'HOMEBREW_UPGRADE_CLEANUP'") end + upgrade_args.parse + FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed? Install.perform_preinstall_checks From ff4544eebd4fb711b44b80bdd6e569caf1dce9a8 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Mon, 4 Feb 2019 15:06:06 +0100 Subject: [PATCH 128/199] cmd/update: Add quiet flag --- Library/Homebrew/cmd/update-report.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb index 6d31330b08..fc27295bd6 100644 --- a/Library/Homebrew/cmd/update-report.rb +++ b/Library/Homebrew/cmd/update-report.rb @@ -26,6 +26,7 @@ module Homebrew switch "--preinstall", description: "Run in 'auto-update' mode (faster, less output)." switch :force + switch :quiet switch :debug switch :verbose hide_from_man_page! From 947b90961bd4a5d903f39ba870d92da9e711d2f7 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 4 Feb 2019 17:09:31 +0100 Subject: [PATCH 129/199] Note leadership changes Today the Homebrew maintainers elected a new PLC, TSC and project lead. Documentation is to follow detailing exactly the responsibilities for each of these roles but adjust these to reflect the current state until that point. --- Library/Homebrew/dev-cmd/man.rb | 18 +++++++-------- Library/Homebrew/manpages/brew.1.md.erb | 12 +++++----- README.md | 8 +++---- docs/Maintainer-Guidelines.md | 29 +++---------------------- docs/Manpage.md | 8 +++---- manpages/brew.1 | 8 +++---- 6 files changed, 30 insertions(+), 53 deletions(-) diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index 1baaeff8f4..c08461e7d2 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -67,22 +67,22 @@ module Homebrew variables[:global_options] = global_options_manpage readme = HOMEBREW_REPOSITORY/"README.md" - variables[:lead_maintainer] = - readme.read[/(Homebrew's lead maintainer .*\.)/, 1] + variables[:lead] = + readme.read[/(Homebrew's project lead .*\.)/, 1] .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') - variables[:leadership] = + variables[:plc] = readme.read[/(Homebrew's project leadership committee .*\.)/, 1] .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') - variables[:brew_maintainers] = - readme.read[%r{(Homebrew/brew's other current maintainers .*\.)}, 1] + variables[:tsc] = + readme.read[/(Homebrew's technical steering committee .*\.)/, 1] .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') - variables[:linux_maintainers] = + variables[:linux] = readme.read[%r{(Homebrew/brew's Linux support \(and Linuxbrew\) maintainers are .*\.)}, 1] .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') - variables[:core_maintainers] = - readme.read[%r{(Homebrew/homebrew-core's other current maintainers .*\.)}, 1] + variables[:maintainers] = + readme.read[/(Homebrew's other current maintainers .*\.)/, 1] .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') - variables[:former_maintainers] = + variables[:alumni] = readme.read[/(Former maintainers .*\.)/, 1] .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') diff --git a/Library/Homebrew/manpages/brew.1.md.erb b/Library/Homebrew/manpages/brew.1.md.erb index 37cd35c7a7..3b54fdc84a 100644 --- a/Library/Homebrew/manpages/brew.1.md.erb +++ b/Library/Homebrew/manpages/brew.1.md.erb @@ -308,17 +308,17 @@ Homebrew Documentation: ## AUTHORS -<%= lead_maintainer.concat("\n") %> +<%= lead.concat("\n") %> -<%= leadership.concat("\n") %> +<%= plc.concat("\n") %> -<%= brew_maintainers.concat("\n") %> +<%= tsc.concat("\n") %> -<%= linux_maintainers.concat("\n") %> +<%= linux.concat("\n") %> -<%= core_maintainers.concat("\n") %> +<%= maintainers.concat("\n") %> -<%= former_maintainers.concat("\n") %> +<%= alumni.concat("\n") %> ## BUGS diff --git a/README.md b/README.md index d52c81ebae..fde855ec17 100644 --- a/README.md +++ b/README.md @@ -35,15 +35,15 @@ Good luck! Please report security issues to our [HackerOne](https://hackerone.com/homebrew/). ## Who Are You? -Homebrew's lead maintainer is [Mike McQuaid](https://github.com/mikemcquaid). +Homebrew's project lead is [Mike McQuaid](https://github.com/MikeMcQuaid). -Homebrew's project leadership committee is [Mike McQuaid](https://github.com/mikemcquaid), [Misty De Meo](https://github.com/mistydemeo) and [Markus Reiter](https://github.com/reitermarkus). +Homebrew's project leadership committee is [Misty De Meo](https://github.com/mistydemeo), [Shaun Jackman](https://github.com/sjackman), [Jonathan Chang](https://github.com/jonchang), [Mike McQuaid](https://github.com/MikeMcQuaid) and [Markus Reiter](https://github.com/reitermarkus). -Homebrew/brew's other current maintainers are [Claudia Pellegrino](https://github.com/claui), [Michka Popoff](https://github.com/imichka), [Shaun Jackman](https://github.com/sjackman), [Chongyu Zhu](https://github.com/lembacon), [Vitor Galvao](https://github.com/vitorgalvao), [Misty De Meo](https://github.com/mistydemeo), [Gautham Goli](https://github.com/GauthamGoli), [Markus Reiter](https://github.com/reitermarkus), [Steven Peters](https://github.com/scpeters), [Jonathan Chang](https://github.com/jonchang) and [William Woodruff](https://github.com/woodruffw). +Homebrew's technical steering committee is [Michka Popoff](https://github.com/imichka), [FX Coudert](https://github.com/fxcoudert), [Markus Reiter](https://github.com/reitermarkus), [Misty De Meo](https://github.com/mistydemeo) and [Mike McQuaid](https://github.com/MikeMcQuaid). Homebrew/brew's Linux support (and Linuxbrew) maintainers are [Michka Popoff](https://github.com/imichka) and [Shaun Jackman](https://github.com/sjackman). -Homebrew/homebrew-core's other current maintainers are [Claudia Pellegrino](https://github.com/claui), [Igor Kapkov](https://github.com/igas), [Michka Popoff](https://github.com/imichka), [Shaun Jackman](https://github.com/sjackman), [Chongyu Zhu](https://github.com/lembacon), [Izaak Beekman](https://github.com/zbeekman), [Sean Molenaar](https://github.com/SMillerDev), [Jan Viljanen](https://github.com/javian), [Jason Tedor](https://github.com/jasontedor), [Viktor Szakats](https://github.com/vszakats), [FX Coudert](https://github.com/fxcoudert), [Thierry Moisan](https://github.com/moisan), [Steven Peters](https://github.com/scpeters), [Misty De Meo](https://github.com/mistydemeo) and [Tom Schoonjans](https://github.com/tschoonj). +Homebrew's other current maintainers are [Claudia Pellegrino](https://github.com/claui), [Chongyu Zhu](https://github.com/lembacon), [Vitor Galvao](https://github.com/vitorgalvao), [Gautham Goli](https://github.com/GauthamGoli), [Steven Peters](https://github.com/scpeters), [William Woodruff](https://github.com/woodruffw), [Igor Kapkov](https://github.com/igas), [Izaak Beekman](https://github.com/zbeekman), [Sean Molenaar](https://github.com/SMillerDev), [Jan Viljanen](https://github.com/javian), [Jason Tedor](https://github.com/jasontedor), [Viktor Szakats](https://github.com/vszakats), [Thierry Moisan](https://github.com/moisan), [Steven Peters](https://github.com/scpeters) and [Tom Schoonjans](https://github.com/tschoonj). Former maintainers with significant contributions include [JCount](https://github.com/jcount), [commitay](https://github.com/commitay), [Dominyk Tiller](https://github.com/DomT4), [Tim Smith](https://github.com/tdsmith), [Baptiste Fontaine](https://github.com/bfontaine), [Xu Cheng](https://github.com/xu-cheng), [Martin Afanasjew](https://github.com/UniqMartin), [Brett Koonce](https://github.com/asparagui), [Charlie Sharpsteen](https://github.com/Sharpie), [Jack Nagel](https://github.com/jacknagel), [Adam Vandenberg](https://github.com/adamv), [Andrew Janke](https://github.com/apjanke), [Alex Dunn](https://github.com/dunn), [neutric](https://github.com/neutric), [Tomasz Pajor](https://github.com/nijikon), [Uladzislau Shablinski](https://github.com/vladshablinsky), [Alyssa Ross](https://github.com/alyssais), [ilovezfs](https://github.com/ilovezfs) and Homebrew's creator: [Max Howell](https://github.com/mxcl). diff --git a/docs/Maintainer-Guidelines.md b/docs/Maintainer-Guidelines.md index ea8bf96313..c513331259 100644 --- a/docs/Maintainer-Guidelines.md +++ b/docs/Maintainer-Guidelines.md @@ -156,30 +156,7 @@ All maintainers (and lead maintainer) communication through any medium is bound Maintainers should feel free to pleasantly disagree with the work and decisions of other maintainers. Healthy, friendly, technical disagreement between maintainers is actively encouraged and should occur in public on the issue tracker to make the project better. Interpersonal issues should be handled privately in Slack, ideally with moderation. If work or decisions are insufficiently documented or explained any maintainer or contributor should feel free to ask for clarification. No maintainer may ever justify a decision with e.g. "because I say so" or "it was I who did X" alone. Off-topic discussions on the issue tracker, [bike-shedding](https://en.wikipedia.org/wiki/Law_of_triviality) and personal attacks are forbidden. -## Lead maintainer guidelines -There should be one lead maintainer for Homebrew. Decisions are determined by a consensus of the maintainers. When a consensus is not reached, the lead maintainer has the final say in determining the outcome of any decision (though this power should be used sparingly). They should also be seen as the product manager for Homebrew itself and ensuring that changes made to the entire Homebrew ecosystem are consistent and providing an increasingly positive experience for Homebrew's users. +## Project lead guidelines +There should be one project lead for Homebrew. On February 4th (to coincide with Homebrew maintainers' conference), Mike stepped down as lead maintainer of Homebrew and was elected by a supermajority of Homebrew maintainers into the new project lead role. -In the same way that Homebrew maintainers are expected to be spending more of their time reviewing and merging contributions from non-maintainer contributors than making their own contributions, the lead maintainer should be spending most of their time reviewing work from and mentoring other maintainers. - -Individual Homebrew repositories should not have formal lead maintainers (although those who do the most work will have the loudest voices). - -Maintainers should feel even more free to pleasantly disagree with the work and decisions of the lead maintainer: with greater authority comes greater responsibility to handle and moderate technical disagreements. - -Homebrew's last lead maintainer will be Mike McQuaid. On February 4th (to coincide with Homebrew maintainers' conference), Mike will step down as lead maintainer of Homebrew and his responsibilities will be passed on to the project leadership committee and/or a new, technical steering committee and/or something else. - -Some food for thought and discussion before those dates: - -- [How the Apache Software Foundation Works](https://www.apache.org/foundation/how-it-works.html) -- [Debian Project Leader documentation]() -- [Debian Technical Committee documentation](https://www.debian.org/devel/tech-ctte) -- [Debian's Organizational Structure](https://www.debian.org/intro/organization) -- [QEMU SFC PLC documentation](https://wiki.qemu.org/Conservancy) -- [libgit2 SFC PLC creation discussion](https://github.com/libgit2/discussions/issues/9) - -Some essential TODO before these dates: - -- Decide how to spend more of Homebrew's money to be useful for the project -- Decide how technical and non-technical decisions are reached and conflicts resolved -- Move Homebrew to a new CI system which does not require ideally any manual system administration -- Onboard as many new maintainers as possible -- Generally hand off and document any other responsibilities that are (and always have been) done by Mike McQuaid alone onto other groups of people +Additional documentation for the project lead and governance are to follow. diff --git a/docs/Manpage.md b/docs/Manpage.md index 62a7601566..1e24759320 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1183,15 +1183,15 @@ Homebrew Documentation: ## AUTHORS -Homebrew's lead maintainer is Mike McQuaid. +Homebrew's project lead is Mike McQuaid. -Homebrew's project leadership committee is Mike McQuaid, Misty De Meo and Markus Reiter. +Homebrew's project leadership committee is Misty De Meo, Shaun Jackman, Jonathan Chang, Mike McQuaid and Markus Reiter. -Homebrew/brew's other current maintainers are Claudia Pellegrino, Michka Popoff, Shaun Jackman, Chongyu Zhu, Vitor Galvao, Misty De Meo, Gautham Goli, Markus Reiter, Steven Peters, Jonathan Chang and William Woodruff. +Homebrew's technical steering committee is Michka Popoff, FX Coudert, Markus Reiter, Misty De Meo and Mike McQuaid. Homebrew/brew's Linux support (and Linuxbrew) maintainers are Michka Popoff and Shaun Jackman. -Homebrew/homebrew-core's other current maintainers are Claudia Pellegrino, Igor Kapkov, Michka Popoff, Shaun Jackman, Chongyu Zhu, Izaak Beekman, Sean Molenaar, Jan Viljanen, Jason Tedor, Viktor Szakats, FX Coudert, Thierry Moisan, Steven Peters, Misty De Meo and Tom Schoonjans. +Homebrew's other current maintainers are Claudia Pellegrino, Chongyu Zhu, Vitor Galvao, Gautham Goli, Steven Peters, William Woodruff, Igor Kapkov, Izaak Beekman, Sean Molenaar, Jan Viljanen, Jason Tedor, Viktor Szakats, Thierry Moisan, Steven Peters and Tom Schoonjans. Former maintainers with significant contributions include JCount, commitay, Dominyk Tiller, Tim Smith, Baptiste Fontaine, Xu Cheng, Martin Afanasjew, Brett Koonce, Charlie Sharpsteen, Jack Nagel, Adam Vandenberg, Andrew Janke, Alex Dunn, neutric, Tomasz Pajor, Uladzislau Shablinski, Alyssa Ross, ilovezfs and Homebrew's creator: Max Howell. diff --git a/manpages/brew.1 b/manpages/brew.1 index 744b2382ca..50e2e68102 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1431,19 +1431,19 @@ Homebrew Documentation: \fIhttps://docs\.brew\.sh\fR \fBbrew\-cask\fR(1), \fBgit\fR(1), \fBgit\-log\fR(1) . .SH "AUTHORS" -Homebrew\'s lead maintainer is Mike McQuaid\. +Homebrew\'s project lead is Mike McQuaid\. . .P -Homebrew\'s project leadership committee is Mike McQuaid, Misty De Meo and Markus Reiter\. +Homebrew\'s project leadership committee is Misty De Meo, Shaun Jackman, Jonathan Chang, Mike McQuaid and Markus Reiter\. . .P -Homebrew/brew\'s other current maintainers are Claudia Pellegrino, Michka Popoff, Shaun Jackman, Chongyu Zhu, Vitor Galvao, Misty De Meo, Gautham Goli, Markus Reiter, Steven Peters, Jonathan Chang and William Woodruff\. +Homebrew\'s technical steering committee is Michka Popoff, FX Coudert, Markus Reiter, Misty De Meo and Mike McQuaid\. . .P Homebrew/brew\'s Linux support (and Linuxbrew) maintainers are Michka Popoff and Shaun Jackman\. . .P -Homebrew/homebrew\-core\'s other current maintainers are Claudia Pellegrino, Igor Kapkov, Michka Popoff, Shaun Jackman, Chongyu Zhu, Izaak Beekman, Sean Molenaar, Jan Viljanen, Jason Tedor, Viktor Szakats, FX Coudert, Thierry Moisan, Steven Peters, Misty De Meo and Tom Schoonjans\. +Homebrew\'s other current maintainers are Claudia Pellegrino, Chongyu Zhu, Vitor Galvao, Gautham Goli, Steven Peters, William Woodruff, Igor Kapkov, Izaak Beekman, Sean Molenaar, Jan Viljanen, Jason Tedor, Viktor Szakats, Thierry Moisan, Steven Peters and Tom Schoonjans\. . .P Former maintainers with significant contributions include JCount, commitay, Dominyk Tiller, Tim Smith, Baptiste Fontaine, Xu Cheng, Martin Afanasjew, Brett Koonce, Charlie Sharpsteen, Jack Nagel, Adam Vandenberg, Andrew Janke, Alex Dunn, neutric, Tomasz Pajor, Uladzislau Shablinski, Alyssa Ross, ilovezfs and Homebrew\'s creator: Max Howell\. From 516e2b41d5d13104359bdc0d15914dc708d29985 Mon Sep 17 00:00:00 2001 From: Colin Dean Date: Mon, 4 Feb 2019 17:19:38 +0100 Subject: [PATCH 130/199] Update docs/Maintainer-Guidelines.md Co-Authored-By: MikeMcQuaid --- docs/Maintainer-Guidelines.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Maintainer-Guidelines.md b/docs/Maintainer-Guidelines.md index c513331259..b703880126 100644 --- a/docs/Maintainer-Guidelines.md +++ b/docs/Maintainer-Guidelines.md @@ -157,6 +157,6 @@ All maintainers (and lead maintainer) communication through any medium is bound Maintainers should feel free to pleasantly disagree with the work and decisions of other maintainers. Healthy, friendly, technical disagreement between maintainers is actively encouraged and should occur in public on the issue tracker to make the project better. Interpersonal issues should be handled privately in Slack, ideally with moderation. If work or decisions are insufficiently documented or explained any maintainer or contributor should feel free to ask for clarification. No maintainer may ever justify a decision with e.g. "because I say so" or "it was I who did X" alone. Off-topic discussions on the issue tracker, [bike-shedding](https://en.wikipedia.org/wiki/Law_of_triviality) and personal attacks are forbidden. ## Project lead guidelines -There should be one project lead for Homebrew. On February 4th (to coincide with Homebrew maintainers' conference), Mike stepped down as lead maintainer of Homebrew and was elected by a supermajority of Homebrew maintainers into the new project lead role. +There should be one project lead for Homebrew. On February 4, 2019, coinciding with the Homebrew maintainers' conference, Mike McQuaid stepped down as lead maintainer of Homebrew. He was elected by a supermajority of Homebrew maintainers into the new project lead role. Additional documentation for the project lead and governance are to follow. From 5755b5a8284848a4114a91fbcdedd32e0d930152 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 4 Feb 2019 18:12:18 +0100 Subject: [PATCH 131/199] README: add EricFromCanada. Welcome to the team! --- README.md | 2 +- docs/Manpage.md | 2 +- manpages/brew.1 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fde855ec17..a301a3a3ac 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Homebrew's technical steering committee is [Michka Popoff](https://github.com/im Homebrew/brew's Linux support (and Linuxbrew) maintainers are [Michka Popoff](https://github.com/imichka) and [Shaun Jackman](https://github.com/sjackman). -Homebrew's other current maintainers are [Claudia Pellegrino](https://github.com/claui), [Chongyu Zhu](https://github.com/lembacon), [Vitor Galvao](https://github.com/vitorgalvao), [Gautham Goli](https://github.com/GauthamGoli), [Steven Peters](https://github.com/scpeters), [William Woodruff](https://github.com/woodruffw), [Igor Kapkov](https://github.com/igas), [Izaak Beekman](https://github.com/zbeekman), [Sean Molenaar](https://github.com/SMillerDev), [Jan Viljanen](https://github.com/javian), [Jason Tedor](https://github.com/jasontedor), [Viktor Szakats](https://github.com/vszakats), [Thierry Moisan](https://github.com/moisan), [Steven Peters](https://github.com/scpeters) and [Tom Schoonjans](https://github.com/tschoonj). +Homebrew's other current maintainers are [Claudia Pellegrino](https://github.com/claui), [Chongyu Zhu](https://github.com/lembacon), [Vitor Galvao](https://github.com/vitorgalvao), [Gautham Goli](https://github.com/GauthamGoli), [Steven Peters](https://github.com/scpeters), [William Woodruff](https://github.com/woodruffw), [Igor Kapkov](https://github.com/igas), [Izaak Beekman](https://github.com/zbeekman), [Sean Molenaar](https://github.com/SMillerDev), [Jan Viljanen](https://github.com/javian), [Jason Tedor](https://github.com/jasontedor), [Eric Knibbe](https://github.com/EricFromCanada), [Viktor Szakats](https://github.com/vszakats), [Thierry Moisan](https://github.com/moisan), [Steven Peters](https://github.com/scpeters) and [Tom Schoonjans](https://github.com/tschoonj). Former maintainers with significant contributions include [JCount](https://github.com/jcount), [commitay](https://github.com/commitay), [Dominyk Tiller](https://github.com/DomT4), [Tim Smith](https://github.com/tdsmith), [Baptiste Fontaine](https://github.com/bfontaine), [Xu Cheng](https://github.com/xu-cheng), [Martin Afanasjew](https://github.com/UniqMartin), [Brett Koonce](https://github.com/asparagui), [Charlie Sharpsteen](https://github.com/Sharpie), [Jack Nagel](https://github.com/jacknagel), [Adam Vandenberg](https://github.com/adamv), [Andrew Janke](https://github.com/apjanke), [Alex Dunn](https://github.com/dunn), [neutric](https://github.com/neutric), [Tomasz Pajor](https://github.com/nijikon), [Uladzislau Shablinski](https://github.com/vladshablinsky), [Alyssa Ross](https://github.com/alyssais), [ilovezfs](https://github.com/ilovezfs) and Homebrew's creator: [Max Howell](https://github.com/mxcl). diff --git a/docs/Manpage.md b/docs/Manpage.md index 1e24759320..067dc132a3 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1191,7 +1191,7 @@ Homebrew's technical steering committee is Michka Popoff, FX Coudert, Markus Rei Homebrew/brew's Linux support (and Linuxbrew) maintainers are Michka Popoff and Shaun Jackman. -Homebrew's other current maintainers are Claudia Pellegrino, Chongyu Zhu, Vitor Galvao, Gautham Goli, Steven Peters, William Woodruff, Igor Kapkov, Izaak Beekman, Sean Molenaar, Jan Viljanen, Jason Tedor, Viktor Szakats, Thierry Moisan, Steven Peters and Tom Schoonjans. +Homebrew's other current maintainers are Claudia Pellegrino, Chongyu Zhu, Vitor Galvao, Gautham Goli, Steven Peters, William Woodruff, Igor Kapkov, Izaak Beekman, Sean Molenaar, Jan Viljanen, Jason Tedor, Eric Knibbe, Viktor Szakats, Thierry Moisan, Steven Peters and Tom Schoonjans. Former maintainers with significant contributions include JCount, commitay, Dominyk Tiller, Tim Smith, Baptiste Fontaine, Xu Cheng, Martin Afanasjew, Brett Koonce, Charlie Sharpsteen, Jack Nagel, Adam Vandenberg, Andrew Janke, Alex Dunn, neutric, Tomasz Pajor, Uladzislau Shablinski, Alyssa Ross, ilovezfs and Homebrew's creator: Max Howell. diff --git a/manpages/brew.1 b/manpages/brew.1 index 50e2e68102..7eeaa55cdc 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1443,7 +1443,7 @@ Homebrew\'s technical steering committee is Michka Popoff, FX Coudert, Markus Re Homebrew/brew\'s Linux support (and Linuxbrew) maintainers are Michka Popoff and Shaun Jackman\. . .P -Homebrew\'s other current maintainers are Claudia Pellegrino, Chongyu Zhu, Vitor Galvao, Gautham Goli, Steven Peters, William Woodruff, Igor Kapkov, Izaak Beekman, Sean Molenaar, Jan Viljanen, Jason Tedor, Viktor Szakats, Thierry Moisan, Steven Peters and Tom Schoonjans\. +Homebrew\'s other current maintainers are Claudia Pellegrino, Chongyu Zhu, Vitor Galvao, Gautham Goli, Steven Peters, William Woodruff, Igor Kapkov, Izaak Beekman, Sean Molenaar, Jan Viljanen, Jason Tedor, Eric Knibbe, Viktor Szakats, Thierry Moisan, Steven Peters and Tom Schoonjans\. . .P Former maintainers with significant contributions include JCount, commitay, Dominyk Tiller, Tim Smith, Baptiste Fontaine, Xu Cheng, Martin Afanasjew, Brett Koonce, Charlie Sharpsteen, Jack Nagel, Adam Vandenberg, Andrew Janke, Alex Dunn, neutric, Tomasz Pajor, Uladzislau Shablinski, Alyssa Ross, ilovezfs and Homebrew\'s creator: Max Howell\. From 418a5f56dc7da143df0e0a1f75b16eb593b25f66 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Mon, 4 Feb 2019 22:10:47 +0100 Subject: [PATCH 132/199] cli_parser: Dont raise FormulaUnavailableError --- Library/Homebrew/cli_parser.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Library/Homebrew/cli_parser.rb b/Library/Homebrew/cli_parser.rb index 54d3297054..160071f87f 100644 --- a/Library/Homebrew/cli_parser.rb +++ b/Library/Homebrew/cli_parser.rb @@ -162,6 +162,8 @@ module Homebrew end end end + rescue FormulaUnavailableError + [] end def hide_from_man_page! From 41c33074846bd4695aa4e85bd7da60beda365f6d Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Tue, 5 Feb 2019 06:44:04 +0100 Subject: [PATCH 133/199] With symlink Cellar, don't try to find /usr/local prefix --- bin/brew | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/brew b/bin/brew index 9406a5d374..c9640a3091 100755 --- a/bin/brew +++ b/bin/brew @@ -39,7 +39,7 @@ then fi # Try to find a /usr/local HOMEBREW_PREFIX where possible (for bottles) -if [[ -L "/usr/local/bin/brew" ]] +if [[ -L "/usr/local/bin/brew" && ! -L "$HOMEBREW_PREFIX/Cellar" ]] then USR_LOCAL_BREW_FILE_DIRECTORY="$(symlink_target_directory "/usr/local/bin/brew" "/usr/local/bin")" USR_LOCAL_HOMEBREW_REPOSITORY="${USR_LOCAL_BREW_FILE_DIRECTORY%/*}" From 04473795b1abed43463cb4668a75cf3b0ea30b75 Mon Sep 17 00:00:00 2001 From: Jan Viljanen Date: Tue, 5 Feb 2019 06:52:19 +0100 Subject: [PATCH 134/199] docs: Remove Linux from the unsupported tap list --- docs/Interesting-Taps-and-Forks.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/Interesting-Taps-and-Forks.md b/docs/Interesting-Taps-and-Forks.md index bdd9a375cc..0b849b2141 100644 --- a/docs/Interesting-Taps-and-Forks.md +++ b/docs/Interesting-Taps-and-Forks.md @@ -32,5 +32,3 @@ Your taps are Git repositories located at `$(brew --repository)/Library/Taps`. ## Unsupported interesting forks * [mistydemeo/tigerbrew](https://github.com/mistydemeo/tigerbrew): Experimental Tiger PowerPC version. - -* [Linuxbrew/brew](https://github.com/Linuxbrew/brew): Experimental Linux version. From 3dc0df5a774272766e2187b46df97742b3aec28a Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Tue, 5 Feb 2019 13:38:08 +0000 Subject: [PATCH 135/199] missing_formula.rb: add help message for cargo ...modeled after the existing message for pip. Also sync format of the gfortran and lzma messages, and use typographic apostrophe in the *tex message. --- Library/Homebrew/missing_formula.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/missing_formula.rb b/Library/Homebrew/missing_formula.rb index 4cf229b125..758db9dc8b 100644 --- a/Library/Homebrew/missing_formula.rb +++ b/Library/Homebrew/missing_formula.rb @@ -15,7 +15,7 @@ module Homebrew EOS when "tex", "tex-live", "texlive", "latex" then <<~EOS Installing TeX from source is weird and gross, requires a lot of patches, - and only builds 32-bit (and thus can't use Homebrew dependencies) + and only builds 32-bit (and thus can’t use Homebrew dependencies) We recommend using a MacTeX distribution: https://www.tug.org/mactex/ @@ -36,8 +36,10 @@ module Homebrew You can read more about it at: #{Formatter.url("https://github.com/MacRuby/MacRuby")} EOS - when /(lib)?lzma/ - "lzma is now part of the xz formula." + when /(lib)?lzma/ then <<~EOS + lzma is now part of the xz formula, and can be installed with: + brew install xz. + EOS when "gtest", "googletest", "google-test" then <<~EOS Installing gtest system-wide is not recommended; it should be vendored in your projects that use it. @@ -54,7 +56,7 @@ module Homebrew Install gsutil with `pip2 install gsutil` EOS when "gfortran" then <<~EOS - GNU Fortran is now provided as part of GCC, and can be installed with: + GNU Fortran is now part of the GCC formula, and can be installed with: brew install gcc EOS when "play" then <<~EOS @@ -79,6 +81,9 @@ module Homebrew If you wish to use the 2.x release you can install with Homebrew Cask: brew cask install ngrok EOS + when "cargo" then <<~EOS + Homebrew provides cargo via: `brew install rust`. + EOS end end alias generic_blacklisted_reason blacklisted_reason From 2dccfe1d022a3501dfec15a3d0e4ae3a5588827c Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Tue, 5 Feb 2019 14:05:57 +0000 Subject: [PATCH 136/199] Update missing_formula.rb --- Library/Homebrew/missing_formula.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/missing_formula.rb b/Library/Homebrew/missing_formula.rb index 758db9dc8b..46e86d5215 100644 --- a/Library/Homebrew/missing_formula.rb +++ b/Library/Homebrew/missing_formula.rb @@ -15,7 +15,7 @@ module Homebrew EOS when "tex", "tex-live", "texlive", "latex" then <<~EOS Installing TeX from source is weird and gross, requires a lot of patches, - and only builds 32-bit (and thus can’t use Homebrew dependencies) + and only builds 32-bit (and thus can't use Homebrew dependencies) We recommend using a MacTeX distribution: https://www.tug.org/mactex/ @@ -23,9 +23,10 @@ module Homebrew brew cask install mactex EOS when "pip" then <<~EOS - Homebrew provides pip via: `brew install python`. However you will then - have two Pythons installed on your Mac, so alternatively you can install - pip via the instructions at: + pip is part of the python formula, and can be installed with: + brew install python + However you will then have two Pythons installed on your Mac, + so alternatively you can install pip via the instructions at: #{Formatter.url("https://pip.readthedocs.io/en/stable/installing/")} EOS when "pil" then <<~EOS @@ -38,7 +39,7 @@ module Homebrew EOS when /(lib)?lzma/ then <<~EOS lzma is now part of the xz formula, and can be installed with: - brew install xz. + brew install xz EOS when "gtest", "googletest", "google-test" then <<~EOS Installing gtest system-wide is not recommended; it should be vendored @@ -82,7 +83,8 @@ module Homebrew brew cask install ngrok EOS when "cargo" then <<~EOS - Homebrew provides cargo via: `brew install rust`. + cargo is part of the rust formula, and can be installed with: + brew install rust EOS end end From ff5dddab9935f304ba73fadcf42170c13c88c59b Mon Sep 17 00:00:00 2001 From: Gary Bartlett Date: Wed, 6 Feb 2019 06:31:57 -0800 Subject: [PATCH 137/199] Add support for java version strings without periods, e.g. "12-ea" (java-beta). --- Library/Homebrew/requirements/java_requirement.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/requirements/java_requirement.rb b/Library/Homebrew/requirements/java_requirement.rb index bc59ea1f68..71e6a5a2ba 100644 --- a/Library/Homebrew/requirements/java_requirement.rb +++ b/Library/Homebrew/requirements/java_requirement.rb @@ -129,7 +129,7 @@ class JavaRequirement < Requirement end def satisfies_version(java) - java_version_s = system_command(java, args: ["-version"], print_stderr: false).stderr[/\d+\.\d/] + java_version_s = system_command(java, args: ["-version"], print_stderr: false).stderr[/\d+(\.\d)?/] return false unless java_version_s java_version = Version.create(java_version_s) From b9b1b24e4e0c607bd27137f3a1928e1b6ee97908 Mon Sep 17 00:00:00 2001 From: tueksta Date: Wed, 6 Feb 2019 18:25:46 +0100 Subject: [PATCH 138/199] Calculate actual delta in usage --- Library/Homebrew/cleanup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/cleanup.rb b/Library/Homebrew/cleanup.rb index c2c03614ba..cc79326f80 100644 --- a/Library/Homebrew/cleanup.rb +++ b/Library/Homebrew/cleanup.rb @@ -321,7 +321,7 @@ module Homebrew yield end - @disk_cleanup_size += disk_usage + @disk_cleanup_size += disk_usage - path.disk_usage end def cleanup_lockfiles(*lockfiles) From 2090f057a0b72fc2718c01a3e824790c10c25f80 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Wed, 6 Feb 2019 21:18:06 +0100 Subject: [PATCH 139/199] Create parent directory for artifacts with `sudo` if necessary. --- Library/Homebrew/cask/artifact/moved.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/artifact/moved.rb b/Library/Homebrew/cask/artifact/moved.rb index eb97424f9a..e7d8d24847 100644 --- a/Library/Homebrew/cask/artifact/moved.rb +++ b/Library/Homebrew/cask/artifact/moved.rb @@ -40,7 +40,11 @@ module Cask end ohai "Moving #{self.class.english_name} '#{source.basename}' to '#{target}'." - target.dirname.mkpath + if target.dirname.parent.writable? + target.dirname.mkpath + else + command.run!("/bin/mkdir", args: ["-p", target.dirname], sudo: true) + end if target.parent.writable? FileUtils.move(source, target) From 9abd7d31bd1db07e572a5f2dbc864ab538e811bc Mon Sep 17 00:00:00 2001 From: tueksta Date: Wed, 6 Feb 2019 22:50:17 +0100 Subject: [PATCH 140/199] Fix dry run --- Library/Homebrew/cleanup.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cleanup.rb b/Library/Homebrew/cleanup.rb index cc79326f80..d20673cdbf 100644 --- a/Library/Homebrew/cleanup.rb +++ b/Library/Homebrew/cleanup.rb @@ -316,12 +316,13 @@ module Homebrew if dry_run? puts "Would remove: #{path} (#{path.abv})" + @disk_cleanup_size += disk_usage else puts "Removing: #{path}... (#{path.abv})" yield + @disk_cleanup_size += disk_usage - path.disk_usage end - @disk_cleanup_size += disk_usage - path.disk_usage end def cleanup_lockfiles(*lockfiles) From 4abacfd85d7ce00a0864f7130108eab36dc1145d Mon Sep 17 00:00:00 2001 From: tueksta Date: Wed, 6 Feb 2019 23:19:25 +0100 Subject: [PATCH 141/199] style --- Library/Homebrew/cleanup.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/Library/Homebrew/cleanup.rb b/Library/Homebrew/cleanup.rb index d20673cdbf..e1ca918c7c 100644 --- a/Library/Homebrew/cleanup.rb +++ b/Library/Homebrew/cleanup.rb @@ -322,7 +322,6 @@ module Homebrew yield @disk_cleanup_size += disk_usage - path.disk_usage end - end def cleanup_lockfiles(*lockfiles) From 8a6a46da36a1bd2b4e4d6d5527a0d657a7cb0495 Mon Sep 17 00:00:00 2001 From: Gary Bartlett Date: Wed, 6 Feb 2019 14:48:19 -0800 Subject: [PATCH 142/199] Add additional support for java minor versions > 9. --- Library/Homebrew/requirements/java_requirement.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/requirements/java_requirement.rb b/Library/Homebrew/requirements/java_requirement.rb index 71e6a5a2ba..aa29e116b7 100644 --- a/Library/Homebrew/requirements/java_requirement.rb +++ b/Library/Homebrew/requirements/java_requirement.rb @@ -129,7 +129,7 @@ class JavaRequirement < Requirement end def satisfies_version(java) - java_version_s = system_command(java, args: ["-version"], print_stderr: false).stderr[/\d+(\.\d)?/] + java_version_s = system_command(java, args: ["-version"], print_stderr: false).stderr[/\d+(\.\d+)?/] return false unless java_version_s java_version = Version.create(java_version_s) From f20319a516befac13947a3e6384f699dc87b97d8 Mon Sep 17 00:00:00 2001 From: Harry Mallon Date: Wed, 6 Feb 2019 17:53:15 +0000 Subject: [PATCH 143/199] cmd/repository: Fix man pages and help --- Library/Homebrew/cmd/--repository.rb | 2 +- docs/Manpage.md | 2 +- manpages/brew.1 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/cmd/--repository.rb b/Library/Homebrew/cmd/--repository.rb index 4ae25e5983..39eb60fe94 100644 --- a/Library/Homebrew/cmd/--repository.rb +++ b/Library/Homebrew/cmd/--repository.rb @@ -6,7 +6,7 @@ module Homebrew def __repository_args Homebrew::CLI::Parser.new do usage_banner <<~EOS - `--repository` [] + `--repository` [`/`] Display where Homebrew's `.git` directory is located. diff --git a/docs/Manpage.md b/docs/Manpage.md index 067dc132a3..f41fc7025b 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -624,7 +624,7 @@ Display Homebrew's install path. *Default:* `/usr/local` on macOS and If *`formula`* is provided, display the location in the cellar where *`formula`* is or would be installed. -### `--repository` [*`formula`*] +### `--repository` [*`user`*`/`*`repo`*] Display where Homebrew's `.git` directory is located. diff --git a/manpages/brew.1 b/manpages/brew.1 index 7eeaa55cdc..c98b8b6f0f 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -766,7 +766,7 @@ Display Homebrew\'s install path\. \fIDefault:\fR \fB/usr/local\fR on macOS and .P If \fIformula\fR is provided, display the location in the cellar where \fIformula\fR is or would be installed\. . -.SS "\fB\-\-repository\fR [\fIformula\fR]" +.SS "\fB\-\-repository\fR [\fIuser\fR\fB/\fR\fIrepo\fR]" Display where Homebrew\'s \fB\.git\fR directory is located\. . .P From 1304c329d04d986d93975daf01e4ae094b4eb0c4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Thu, 7 Feb 2019 19:27:02 +0000 Subject: [PATCH 144/199] Bump parallel_tests from 2.27.1 to 2.28.0 in /Library/Homebrew/test Bumps [parallel_tests](https://github.com/grosser/parallel_tests) from 2.27.1 to 2.28.0. - [Release notes](https://github.com/grosser/parallel_tests/releases) - [Commits](https://github.com/grosser/parallel_tests/compare/v2.27.1...v2.28.0) Signed-off-by: dependabot[bot] --- Library/Homebrew/test/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/test/Gemfile.lock b/Library/Homebrew/test/Gemfile.lock index fa60a178e1..05bfdd11b2 100644 --- a/Library/Homebrew/test/Gemfile.lock +++ b/Library/Homebrew/test/Gemfile.lock @@ -15,7 +15,7 @@ GEM json (2.1.0) mustache (1.1.0) parallel (1.13.0) - parallel_tests (2.27.1) + parallel_tests (2.28.0) parallel parser (2.6.0.0) ast (~> 2.4.0) From e09eaf5b3144983b792ff71167274f8da2cd356c Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Thu, 7 Feb 2019 21:13:13 +0100 Subject: [PATCH 145/199] Only use `sudo` if it is actually needed. --- Library/Homebrew/cask/artifact/moved.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/cask/artifact/moved.rb b/Library/Homebrew/cask/artifact/moved.rb index e7d8d24847..67b0ca2e5a 100644 --- a/Library/Homebrew/cask/artifact/moved.rb +++ b/Library/Homebrew/cask/artifact/moved.rb @@ -40,13 +40,13 @@ module Cask end ohai "Moving #{self.class.english_name} '#{source.basename}' to '#{target}'." - if target.dirname.parent.writable? + if target.dirname.ascend.find(&:directory?).writable? target.dirname.mkpath else command.run!("/bin/mkdir", args: ["-p", target.dirname], sudo: true) end - if target.parent.writable? + if target.dirname.writable? FileUtils.move(source, target) else command.run!("/bin/mv", args: [source, target], sudo: true) From 0fcc62db311bb279cf7069b15ddafa13a121d383 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Wed, 6 Feb 2019 19:04:29 +0100 Subject: [PATCH 146/199] Run `uninstall rmdir:` after uninstalling artifacts. --- .../cask/artifact/abstract_uninstall.rb | 29 ++++++++---------- Library/Homebrew/cask/artifact/uninstall.rb | 9 +++++- Library/Homebrew/cask/installer.rb | 18 ++++++++++- .../artifact/shared_examples/uninstall_zap.rb | 26 ---------------- .../test/cask/artifact/uninstall_spec.rb | 30 +++++++++++++++++++ .../Homebrew/test/cask/artifact/zap_spec.rb | 28 +++++++++++++++++ 6 files changed, 96 insertions(+), 44 deletions(-) diff --git a/Library/Homebrew/cask/artifact/abstract_uninstall.rb b/Library/Homebrew/cask/artifact/abstract_uninstall.rb index 64e909b666..531e20c653 100644 --- a/Library/Homebrew/cask/artifact/abstract_uninstall.rb +++ b/Library/Homebrew/cask/artifact/abstract_uninstall.rb @@ -2,6 +2,8 @@ require "timeout" require "utils/user" require "cask/artifact/abstract_artifact" +require "extend/hash_validator" +using HashValidator module Cask module Artifact @@ -27,6 +29,8 @@ module Cask attr_reader :directives def initialize(cask, directives) + directives.assert_valid_keys!(*ORDERED_DIRECTIVES) + super(cask) directives[:signal] = [*directives[:signal]].flatten.each_slice(2).to_a @directives = directives @@ -49,30 +53,23 @@ module Cask private def dispatch_uninstall_directives(**options) - ohai "Running #{stanza} process for #{@cask}; your password may be necessary" - - warn_for_unknown_directives(directives) - ORDERED_DIRECTIVES.each do |directive_sym| - next unless directives.key?(directive_sym) - - args = directives[directive_sym] - send("uninstall_#{directive_sym}", *(args.is_a?(Hash) ? [args] : args), **options) + dispatch_uninstall_directive(directive_sym, **options) end end + def dispatch_uninstall_directive(directive_sym, **options) + return unless directives.key?(directive_sym) + + args = directives[directive_sym] + + send("uninstall_#{directive_sym}", *(args.is_a?(Hash) ? [args] : args), **options) + end + def stanza self.class.dsl_key end - def warn_for_unknown_directives(directives) - unknown_keys = directives.keys - ORDERED_DIRECTIVES - return if unknown_keys.empty? - - opoo "Unknown arguments to #{stanza} -- #{unknown_keys.inspect}. " \ - "Running \"brew update; brew cleanup\" will likely fix it." - end - # Preserve prior functionality of script which runs first. Should rarely be needed. # :early_script should not delete files, better defer that to :script. # If Cask writers never need :early_script it may be removed in the future. diff --git a/Library/Homebrew/cask/artifact/uninstall.rb b/Library/Homebrew/cask/artifact/uninstall.rb index 6e2b12098c..93b6ada85c 100644 --- a/Library/Homebrew/cask/artifact/uninstall.rb +++ b/Library/Homebrew/cask/artifact/uninstall.rb @@ -4,7 +4,14 @@ module Cask module Artifact class Uninstall < AbstractUninstall def uninstall_phase(**options) - dispatch_uninstall_directives(**options) + ORDERED_DIRECTIVES.reject { |directive_sym| directive_sym == :rmdir } + .each do |directive_sym| + dispatch_uninstall_directive(directive_sym, **options) + end + end + + def post_uninstall_phase(**options) + dispatch_uninstall_directive(:rmdir, **options) end end end diff --git a/Library/Homebrew/cask/installer.rb b/Library/Homebrew/cask/installer.rb index 407f5a9b39..5c2b58ebd2 100644 --- a/Library/Homebrew/cask/installer.rb +++ b/Library/Homebrew/cask/installer.rb @@ -217,6 +217,13 @@ module Cask odebug "Reverting installation of artifact of class #{artifact.class}" artifact.uninstall_phase(command: @command, verbose: verbose?, force: force?) end + + already_installed_artifacts.each do |artifact| + next unless artifact.respond_to?(:post_uninstall_phase) + + odebug "Reverting installation of artifact of class #{artifact.class}" + artifact.post_uninstall_phase(command: @command, verbose: verbose?, force: force?) + end ensure purge_versioned_files raise e @@ -425,9 +432,18 @@ module Cask artifacts.each do |artifact| next unless artifact.respond_to?(:uninstall_phase) - odebug "Un-installing artifact of class #{artifact.class}" + odebug "Uninstalling artifact of class #{artifact.class}" artifact.uninstall_phase(command: @command, verbose: verbose?, skip: clear, force: force?, upgrade: upgrade?) end + + artifacts.each do |artifact| + next unless artifact.respond_to?(:post_uninstall_phase) + + odebug "Post-uninstalling artifact of class #{artifact.class}" + artifact.post_uninstall_phase( + command: @command, verbose: verbose?, skip: clear, force: force?, upgrade: upgrade?, + ) + end end def zap diff --git a/Library/Homebrew/test/cask/artifact/shared_examples/uninstall_zap.rb b/Library/Homebrew/test/cask/artifact/shared_examples/uninstall_zap.rb index dd034e041e..b77f9599a8 100644 --- a/Library/Homebrew/test/cask/artifact/shared_examples/uninstall_zap.rb +++ b/Library/Homebrew/test/cask/artifact/shared_examples/uninstall_zap.rb @@ -218,32 +218,6 @@ shared_examples "#uninstall_phase or #zap_phase" do end end - context "using :rmdir" do - let(:fake_system_command) { NeverSudoSystemCommand } - let(:cask) { Cask::CaskLoader.load(cask_path("with-#{artifact_dsl_key}-rmdir")) } - let(:empty_directory) { Pathname.new("#{TEST_TMPDIR}/empty_directory_path") } - let(:ds_store) { empty_directory.join(".DS_Store") } - - before do - empty_directory.mkdir - FileUtils.touch ds_store - end - - after do - FileUtils.rm_rf empty_directory - end - - it "is supported" do - expect(empty_directory).to exist - expect(ds_store).to exist - - subject.public_send(:"#{artifact_dsl_key}_phase", command: fake_system_command) - - expect(ds_store).not_to exist - expect(empty_directory).not_to exist - end - end - [:script, :early_script].each do |script_type| context "using #{script_type.inspect}" do let(:fake_system_command) { NeverSudoSystemCommand } diff --git a/Library/Homebrew/test/cask/artifact/uninstall_spec.rb b/Library/Homebrew/test/cask/artifact/uninstall_spec.rb index cfee17fb85..5d5a70c704 100644 --- a/Library/Homebrew/test/cask/artifact/uninstall_spec.rb +++ b/Library/Homebrew/test/cask/artifact/uninstall_spec.rb @@ -4,4 +4,34 @@ describe Cask::Artifact::Uninstall, :cask do describe "#uninstall_phase" do include_examples "#uninstall_phase or #zap_phase" end + + describe "#post_uninstall_phase" do + subject(:artifact) { cask.artifacts.find { |a| a.is_a?(described_class) } } + + context "using :rmdir" do + let(:fake_system_command) { NeverSudoSystemCommand } + let(:cask) { Cask::CaskLoader.load(cask_path("with-uninstall-rmdir")) } + let(:empty_directory) { Pathname.new("#{TEST_TMPDIR}/empty_directory_path") } + let(:ds_store) { empty_directory.join(".DS_Store") } + + before do + empty_directory.mkdir + FileUtils.touch ds_store + end + + after do + FileUtils.rm_rf empty_directory + end + + it "is supported" do + expect(empty_directory).to exist + expect(ds_store).to exist + + artifact.post_uninstall_phase(command: fake_system_command) + + expect(ds_store).not_to exist + expect(empty_directory).not_to exist + end + end + end end diff --git a/Library/Homebrew/test/cask/artifact/zap_spec.rb b/Library/Homebrew/test/cask/artifact/zap_spec.rb index a5cef6c530..15122dda81 100644 --- a/Library/Homebrew/test/cask/artifact/zap_spec.rb +++ b/Library/Homebrew/test/cask/artifact/zap_spec.rb @@ -3,5 +3,33 @@ require_relative "shared_examples/uninstall_zap" describe Cask::Artifact::Zap, :cask do describe "#zap_phase" do include_examples "#uninstall_phase or #zap_phase" + + context "using :rmdir" do + subject(:artifact) { cask.artifacts.find { |a| a.is_a?(described_class) } } + + let(:fake_system_command) { NeverSudoSystemCommand } + let(:cask) { Cask::CaskLoader.load(cask_path("with-zap-rmdir")) } + let(:empty_directory) { Pathname.new("#{TEST_TMPDIR}/empty_directory_path") } + let(:ds_store) { empty_directory.join(".DS_Store") } + + before do + empty_directory.mkdir + FileUtils.touch ds_store + end + + after do + FileUtils.rm_rf empty_directory + end + + it "is supported" do + expect(empty_directory).to exist + expect(ds_store).to exist + + artifact.zap_phase(command: fake_system_command) + + expect(ds_store).not_to exist + expect(empty_directory).not_to exist + end + end end end From 6cac67bcd0850f3c1ec26008ba54c24c1d26d762 Mon Sep 17 00:00:00 2001 From: Chongyu Zhu Date: Sat, 9 Feb 2019 23:10:50 +0800 Subject: [PATCH 147/199] python_virtualenv_constants: upgrade virtualenv to 16.4.0 --- Library/Homebrew/language/python_virtualenv_constants.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/language/python_virtualenv_constants.rb b/Library/Homebrew/language/python_virtualenv_constants.rb index 341c455028..3b7eec5aa3 100644 --- a/Library/Homebrew/language/python_virtualenv_constants.rb +++ b/Library/Homebrew/language/python_virtualenv_constants.rb @@ -1,6 +1,6 @@ PYTHON_VIRTUALENV_URL = - "https://files.pythonhosted.org/packages/8b/f4" \ - "/360aa656ddb0f4168aeaa1057d8784b95d1ce12f34332c1cf52420b6db4e" \ - "/virtualenv-16.3.0.tar.gz".freeze + "https://files.pythonhosted.org/packages/51/aa" \ + "/c395a6e6eaaedfa5a04723b6446a1df783b16cca6fec66e671cede514688" \ + "/virtualenv-16.4.0.tar.gz".freeze PYTHON_VIRTUALENV_SHA256 = - "729f0bcab430e4ef137646805b5b1d8efbb43fe53d4a0f33328624a84a5121f7".freeze + "cceab52aa7d4df1e1871a70236eb2b89fcfe29b6b43510d9738689787c513261".freeze From f1c217b32b0f32fbe2159d16dc052455ae34720d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Sun, 10 Feb 2019 13:56:34 +0000 Subject: [PATCH 148/199] Bump rubocop from 0.63.1 to 0.64.0 in /Library/Homebrew/test Bumps [rubocop](https://github.com/rubocop-hq/rubocop) from 0.63.1 to 0.64.0. - [Release notes](https://github.com/rubocop-hq/rubocop/releases) - [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.63.1...v0.64.0) Signed-off-by: dependabot[bot] --- Library/Homebrew/test/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/test/Gemfile.lock b/Library/Homebrew/test/Gemfile.lock index fa60a178e1..291baf768c 100644 --- a/Library/Homebrew/test/Gemfile.lock +++ b/Library/Homebrew/test/Gemfile.lock @@ -46,7 +46,7 @@ GEM rspec-support (3.8.0) rspec-wait (0.0.9) rspec (>= 3, < 4) - rubocop (0.63.1) + rubocop (0.64.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.5, != 2.5.1.1) From 74dbe00ecadf2fe4b2a3288aa393e1e33708b39c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Mon, 11 Feb 2019 06:54:15 +0000 Subject: [PATCH 149/199] Bump rubocop from 0.63.1 to 0.64.0 in /Library/Homebrew/vendor Bumps [rubocop](https://github.com/rubocop-hq/rubocop) from 0.63.1 to 0.64.0. - [Release notes](https://github.com/rubocop-hq/rubocop/releases) - [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.63.1...v0.64.0) Signed-off-by: dependabot[bot] --- Library/Homebrew/vendor/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/vendor/Gemfile.lock b/Library/Homebrew/vendor/Gemfile.lock index cbb0bd6da9..c6ab320754 100644 --- a/Library/Homebrew/vendor/Gemfile.lock +++ b/Library/Homebrew/vendor/Gemfile.lock @@ -43,7 +43,7 @@ GEM plist (3.5.0) powerpack (0.1.2) rainbow (3.0.0) - rubocop (0.63.1) + rubocop (0.64.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.5, != 2.5.1.1) From db7997e1a0acde9f11ee9ae0b91833f493eff2ef Mon Sep 17 00:00:00 2001 From: Maxim Belkin Date: Mon, 11 Feb 2019 01:02:31 -0600 Subject: [PATCH 150/199] exceptions.rb: move alternative solution to a new line --- Library/Homebrew/exceptions.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index 5358065c59..782ba830be 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -471,7 +471,7 @@ class BuildFlagsError < RuntimeError EOS message << <<~EOS.chomp! if bottled - Alternatively, remove the #{flag_text} to attempt bottle installation. + \nAlternatively, remove the #{flag_text} to attempt bottle installation. EOS super message From ae1e4e7022b56e10122f7c7d12f6a0740a9ce4d0 Mon Sep 17 00:00:00 2001 From: Mike Miller Date: Sun, 10 Feb 2019 23:30:54 -0800 Subject: [PATCH 151/199] Set DISPLAY environment variable for browser on Linux Fixes #5692 --- Library/Homebrew/utils.rb | 4 ++++ bin/brew | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 9f68554e7f..4fa07af9a1 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -388,6 +388,10 @@ def exec_browser(*args) browser ||= OS::PATH_OPEN if defined?(OS::PATH_OPEN) return unless browser + if ENV["HOMEBREW_DISPLAY"] + ENV["DISPLAY"] = ENV["HOMEBREW_DISPLAY"] + end + safe_exec(browser, *args) end diff --git a/bin/brew b/bin/brew index c9640a3091..edf2dded7f 100755 --- a/bin/brew +++ b/bin/brew @@ -54,7 +54,7 @@ HOMEBREW_LIBRARY="$HOMEBREW_REPOSITORY/Library" # Whitelist and copy to HOMEBREW_* all variables previously mentioned in # manpage or used elsewhere by Homebrew. for VAR in AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY BINTRAY_USER BINTRAY_KEY \ - BROWSER EDITOR GIT NO_COLOR PATH VISUAL + BROWSER DISPLAY EDITOR GIT NO_COLOR PATH VISUAL do # Skip if variable value is empty. [[ -z "${!VAR}" ]] && continue From 190deb36b5c84a3d097d239eb4efae099d1f1642 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 11 Feb 2019 09:45:54 +0000 Subject: [PATCH 152/199] brew vendor-gems: commit updates. --- Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb b/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb index 11e6185af5..29ffecb742 100644 --- a/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb @@ -37,6 +37,6 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/powerpack-0.1.2/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rainbow-3.0.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.10.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.4.1/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.63.1/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.64.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.32.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.1.0/lib" From 3060125c45f8527c51272e553879633cf360c7dc Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 11 Feb 2019 09:50:09 +0000 Subject: [PATCH 153/199] rubocop: autofix problems. --- .../test/cask/artifact/shared_examples/uninstall_zap.rb | 2 +- Library/Homebrew/test/cask/installer_spec.rb | 2 +- Library/Homebrew/test/descriptions_spec.rb | 4 ++-- Library/Homebrew/test/messages_spec.rb | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/test/cask/artifact/shared_examples/uninstall_zap.rb b/Library/Homebrew/test/cask/artifact/shared_examples/uninstall_zap.rb index b77f9599a8..4b6f1bca27 100644 --- a/Library/Homebrew/test/cask/artifact/shared_examples/uninstall_zap.rb +++ b/Library/Homebrew/test/cask/artifact/shared_examples/uninstall_zap.rb @@ -255,7 +255,7 @@ shared_examples "#uninstall_phase or #zap_phase" do .with( "osascript", args: ["-e", 'tell application "System Events" to delete every login item whose name is "Fancy"'], - ) + ) .and_return(instance_double("SystemCommand::Result")) subject.public_send(:"#{artifact_dsl_key}_phase", command: fake_system_command) diff --git a/Library/Homebrew/test/cask/installer_spec.rb b/Library/Homebrew/test/cask/installer_spec.rb index a03290e124..ac19ed13bd 100644 --- a/Library/Homebrew/test/cask/installer_spec.rb +++ b/Library/Homebrew/test/cask/installer_spec.rb @@ -111,7 +111,7 @@ describe Cask::Installer, :cask do expect { Cask::Installer.new(with_installer_manual).install }.to output( - <<~EOS + <<~EOS, ==> Satisfying dependencies ==> Downloading file:#{HOMEBREW_LIBRARY_PATH}/test/support/fixtures/cask/caffeine.zip ==> Verifying SHA-256 checksum for Cask 'with-installer-manual'. diff --git a/Library/Homebrew/test/descriptions_spec.rb b/Library/Homebrew/test/descriptions_spec.rb index 7374068414..9fe327fd0e 100644 --- a/Library/Homebrew/test/descriptions_spec.rb +++ b/Library/Homebrew/test/descriptions_spec.rb @@ -20,7 +20,7 @@ describe Descriptions do descriptions_hash["somedev/external/foo"] = "External foo" expect { subject.print }.to output( - <<~EOS + <<~EOS, homebrew/core/foo: Core foo somedev/external/foo: External foo EOS @@ -33,7 +33,7 @@ describe Descriptions do descriptions_hash["otherdev/external/foo"] = "Other external foo" expect { subject.print }.to output( - <<~EOS + <<~EOS, homebrew/core/foo: Core foo otherdev/external/foo: Other external foo somedev/external/foo: External foo diff --git a/Library/Homebrew/test/messages_spec.rb b/Library/Homebrew/test/messages_spec.rb index ae5a9fadfc..527b35d23e 100644 --- a/Library/Homebrew/test/messages_spec.rb +++ b/Library/Homebrew/test/messages_spec.rb @@ -61,7 +61,7 @@ describe Messages do it "prints caveat details" do expect { messages.display_messages }.to output( - <<~EOS + <<~EOS, ==> Caveats ==> foo Zsh completions were installed @@ -88,7 +88,7 @@ describe Messages do it "prints installation times" do expect { messages.display_messages }.to output( - <<~EOS + <<~EOS, ==> Installation times foo 1.100 s EOS From c44c8da5e0becf02ef6d6180fadb8efa8df69714 Mon Sep 17 00:00:00 2001 From: Maxim Belkin Date: Mon, 11 Feb 2019 05:27:22 -0600 Subject: [PATCH 154/199] exceptions.rb: remove unnecessary chomps remove `chomp!` from method 'initialize' in class 'BuildFlagsError' --- Library/Homebrew/exceptions.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index 782ba830be..183551578c 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -463,15 +463,15 @@ class BuildFlagsError < RuntimeError require_text = "requires" end - message = <<~EOS.chomp! + message = <<~EOS The following #{flag_text}: #{flags.join(", ")} #{require_text} building tools, but none are installed. #{DevelopmentTools.installation_instructions} EOS - message << <<~EOS.chomp! if bottled - \nAlternatively, remove the #{flag_text} to attempt bottle installation. + message << <<~EOS if bottled + Alternatively, remove the #{flag_text} to attempt bottle installation. EOS super message From 9090e3745550f81c8ddac849f5efbb2f23e3fbca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Mon, 11 Feb 2019 20:27:25 +0000 Subject: [PATCH 155/199] Bump github-pages from 193 to 194 in /docs Bumps [github-pages](https://github.com/github/pages-gem) from 193 to 194. - [Release notes](https://github.com/github/pages-gem/releases) - [Commits](https://github.com/github/pages-gem/compare/v193...v194) Signed-off-by: dependabot[bot] --- docs/Gemfile.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 1d6932b8e5..48a6245605 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -31,9 +31,9 @@ GEM ffi (1.10.0) forwardable-extended (2.6.0) gemoji (3.0.0) - github-pages (193) + github-pages (194) activesupport (= 4.2.10) - github-pages-health-check (= 1.8.1) + github-pages-health-check (= 1.16.0) jekyll (= 3.7.4) jekyll-avatar (= 0.6.0) jekyll-coffeescript (= 1.1.1) @@ -41,7 +41,7 @@ GEM jekyll-default-layout (= 0.1.4) jekyll-feed (= 0.11.0) jekyll-gist (= 1.5.0) - jekyll-github-metadata (= 2.9.4) + jekyll-github-metadata (= 2.11.0) jekyll-mentions (= 1.4.1) jekyll-optional-front-matter (= 0.3.0) jekyll-paginate (= 1.1.0) @@ -73,14 +73,14 @@ GEM listen (= 3.1.5) mercenary (~> 0.3) minima (= 2.5.0) - nokogiri (>= 1.8.2, < 2.0) + nokogiri (>= 1.8.5, < 2.0) rouge (= 2.2.1) terminal-table (~> 1.4) - github-pages-health-check (1.8.1) + github-pages-health-check (1.16.0) addressable (~> 2.3) dnsruby (~> 1.60) octokit (~> 4.0) - public_suffix (~> 2.0) + public_suffix (~> 3.0) typhoeus (~> 1.3) html-pipeline (2.10.0) activesupport (>= 2) @@ -128,8 +128,8 @@ GEM jekyll (~> 3.3) jekyll-gist (1.5.0) octokit (~> 4.2) - jekyll-github-metadata (2.9.4) - jekyll (~> 3.1) + jekyll-github-metadata (2.11.0) + jekyll (~> 3.4) octokit (~> 4.0, != 4.4.0) jekyll-mentions (1.4.1) html-pipeline (~> 2.3) @@ -222,7 +222,7 @@ GEM parallel (1.13.0) pathutil (0.16.2) forwardable-extended (~> 2.6) - public_suffix (2.0.5) + public_suffix (3.0.3) rake (12.3.2) rb-fsevent (0.10.3) rb-inotify (0.10.0) From ea9977f3c3ee45925debd032fdd373440a2c92d1 Mon Sep 17 00:00:00 2001 From: Misty De Meo Date: Mon, 11 Feb 2019 15:11:19 -0800 Subject: [PATCH 156/199] formula_installer: handle attempts to load invalid casks Certain casks in the main cask repository may be invalid, for whatever reason. Without handling this exception, the user will get a cask-related exception while the formula of the same name is installed, and their installation will abort half-completed. Fixes #5709. --- Library/Homebrew/formula_installer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index e3cc0ea746..45f2f08499 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -790,7 +790,7 @@ class FormulaInstaller cask_installed_with_formula_name = begin Cask::CaskLoader.load(formula.name).installed? - rescue Cask::CaskUnavailableError + rescue Cask::CaskUnavailableError, Cask::CaskInvalidError false end From bbc7cf2250af43c17908f63a7be5828a5f7ffba2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Tue, 12 Feb 2019 17:45:15 +0000 Subject: [PATCH 157/199] Bump github-pages from 194 to 195 in /docs Bumps [github-pages](https://github.com/github/pages-gem) from 194 to 195. - [Release notes](https://github.com/github/pages-gem/releases) - [Commits](https://github.com/github/pages-gem/compare/v194...v195) Signed-off-by: dependabot[bot] --- docs/Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 48a6245605..bb9e6cdf10 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -31,7 +31,7 @@ GEM ffi (1.10.0) forwardable-extended (2.6.0) gemoji (3.0.0) - github-pages (194) + github-pages (195) activesupport (= 4.2.10) github-pages-health-check (= 1.16.0) jekyll (= 3.7.4) @@ -41,7 +41,7 @@ GEM jekyll-default-layout (= 0.1.4) jekyll-feed (= 0.11.0) jekyll-gist (= 1.5.0) - jekyll-github-metadata (= 2.11.0) + jekyll-github-metadata (= 2.12.1) jekyll-mentions (= 1.4.1) jekyll-optional-front-matter (= 0.3.0) jekyll-paginate (= 1.1.0) @@ -128,7 +128,7 @@ GEM jekyll (~> 3.3) jekyll-gist (1.5.0) octokit (~> 4.2) - jekyll-github-metadata (2.11.0) + jekyll-github-metadata (2.12.1) jekyll (~> 3.4) octokit (~> 4.0, != 4.4.0) jekyll-mentions (1.4.1) From 6819cbf9677e7bbefda2223135ecc94f47d461ef Mon Sep 17 00:00:00 2001 From: Mike Miller Date: Tue, 12 Feb 2019 11:37:35 -0800 Subject: [PATCH 158/199] Set DISPLAY from HOMEBREW_DISPLAY unconditionally No need to test for existence, ruby ENV does the right thing. --- Library/Homebrew/utils.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 4fa07af9a1..d6ea652c8a 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -388,9 +388,7 @@ def exec_browser(*args) browser ||= OS::PATH_OPEN if defined?(OS::PATH_OPEN) return unless browser - if ENV["HOMEBREW_DISPLAY"] - ENV["DISPLAY"] = ENV["HOMEBREW_DISPLAY"] - end + ENV["DISPLAY"] = ENV["HOMEBREW_DISPLAY"] safe_exec(browser, *args) end From cf4d5c80c0804bec1a217891ba2a6b87b0193f8d Mon Sep 17 00:00:00 2001 From: Mike Miller Date: Tue, 12 Feb 2019 12:39:59 -0800 Subject: [PATCH 159/199] man: mention HOMEBREW_DISPLAY in man page --- Library/Homebrew/manpages/brew.1.md.erb | 6 ++++++ docs/Manpage.md | 6 ++++++ manpages/brew.1 | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/Library/Homebrew/manpages/brew.1.md.erb b/Library/Homebrew/manpages/brew.1.md.erb index 3b54fdc84a..7d45775eef 100644 --- a/Library/Homebrew/manpages/brew.1.md.erb +++ b/Library/Homebrew/manpages/brew.1.md.erb @@ -162,6 +162,12 @@ Note that environment variables must have a value set to be detected. For exampl If set, Homebrew will tweak behaviour to be more relevant for Homebrew developers (active or budding), e.g. turning warnings into errors. + * `HOMEBREW_DISPLAY`: + If set, Homebrew will use this X11 display when opening a page in a browser, + for example with `brew home`. Primarily useful on Linux. + + *Default:* the value of the user's `DISPLAY` environment variable. + * `HOMEBREW_EDITOR`: If set, Homebrew will use this editor when editing a single formula, or several formulae in the same directory. diff --git a/docs/Manpage.md b/docs/Manpage.md index 067dc132a3..067a4f47e8 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1037,6 +1037,12 @@ Note that environment variables must have a value set to be detected. For exampl If set, Homebrew will tweak behaviour to be more relevant for Homebrew developers (active or budding), e.g. turning warnings into errors. + * `HOMEBREW_DISPLAY`: + If set, Homebrew will use this X11 display when opening a page in a browser, + for example with `brew home`. Primarily useful on Linux. + + *Default:* the value of the user's `DISPLAY` environment variable. + * `HOMEBREW_EDITOR`: If set, Homebrew will use this editor when editing a single formula, or several formulae in the same directory. diff --git a/manpages/brew.1 b/manpages/brew.1 index 7eeaa55cdc..c20055caef 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1266,6 +1266,13 @@ If set, any commands that can emit debugging information will do so\. If set, Homebrew will tweak behaviour to be more relevant for Homebrew developers (active or budding), e\.g\. turning warnings into errors\. . .TP +\fBHOMEBREW_DISPLAY\fR +If set, Homebrew will use this X11 display when opening a page in a browser, for example with \fBbrew home\fR\. Primarily useful on Linux\. +. +.IP +\fIDefault:\fR the value of the user\'s \fBDISPLAY\fR environment variable\. +. +.TP \fBHOMEBREW_EDITOR\fR If set, Homebrew will use this editor when editing a single formula, or several formulae in the same directory\. . From e7c5d91151720b914f8297b72e0314dbdb04e2e4 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 13 Feb 2019 09:39:21 +0000 Subject: [PATCH 160/199] cleanup: add --prune-prefix option. From https://discourse.brew.sh/t/error-calling-brew-prune-is-disabled/4142/4 and https://github.com/github/homebrew-bootstrap/pull/72 it seems this is worth having as a dedicated flag. --- Library/Homebrew/cmd/cleanup.rb | 6 ++++++ Library/Homebrew/cmd/prune.rb | 2 +- docs/Manpage.md | 2 ++ manpages/brew.1 | 4 ++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/cleanup.rb b/Library/Homebrew/cmd/cleanup.rb index 5a6f957928..19bbef2e8a 100644 --- a/Library/Homebrew/cmd/cleanup.rb +++ b/Library/Homebrew/cmd/cleanup.rb @@ -22,6 +22,8 @@ module Homebrew description: "Scrub the cache, including downloads for even the latest versions. "\ "Note downloads for any installed formula or cask will still not be deleted. "\ "If you want to delete those too: `rm -rf \"$(brew --cache)\"`" + switch "--prune-prefix", + description: "Only prune the symlinks and directories from the prefix and remove no other files." switch :verbose switch :debug end @@ -31,6 +33,10 @@ module Homebrew cleanup_args.parse cleanup = Cleanup.new(*args.remaining, dry_run: args.dry_run?, scrub: args.s?, days: args.prune&.to_i) + if args.prune_prefix? + cleanup.prune_prefix_symlinks_and_directories + return + end cleanup.clean! diff --git a/Library/Homebrew/cmd/prune.rb b/Library/Homebrew/cmd/prune.rb index 89500eb633..cc9661849d 100644 --- a/Library/Homebrew/cmd/prune.rb +++ b/Library/Homebrew/cmd/prune.rb @@ -23,6 +23,6 @@ module Homebrew def prune prune_args.parse - odisabled("'brew prune'", "'brew cleanup'") + odisabled("'brew prune'", "'brew cleanup --prune-prefix'") end end diff --git a/docs/Manpage.md b/docs/Manpage.md index f41fc7025b..e0b23a4236 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -63,6 +63,8 @@ only do this for the specified formulae and casks. Show what would be removed, but do not actually remove anything. * `-s`: Scrub the cache, including downloads for even the latest versions. Note downloads for any installed formula or cask will still not be deleted. If you want to delete those too: `rm -rf "$(brew --cache)"` +* `--prune-prefix`: + Only prune the symlinks and directories from the prefix and remove no other files. ### `command` *`cmd`* diff --git a/manpages/brew.1 b/manpages/brew.1 index c98b8b6f0f..416e329d81 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -62,6 +62,10 @@ Show what would be removed, but do not actually remove anything\. \fB\-s\fR Scrub the cache, including downloads for even the latest versions\. Note downloads for any installed formula or cask will still not be deleted\. If you want to delete those too: \fBrm \-rf "$(brew \-\-cache)"\fR . +.TP +\fB\-\-prune\-prefix\fR +Only prune the symlinks and directories from the prefix and remove no other files\. +. .SS "\fBcommand\fR \fIcmd\fR" Display the path to the file which is used when invoking \fBbrew\fR \fIcmd\fR\. . From ede9891bf244b08ca01bf0abcaf5def529cca811 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 13 Feb 2019 12:56:36 +0000 Subject: [PATCH 161/199] cleanup: don't remove portable ruby on periodic cleanups. Otherwise we end up deleting the running Ruby version. Fixes #5707. --- Library/Homebrew/cleanup.rb | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/Library/Homebrew/cleanup.rb b/Library/Homebrew/cleanup.rb index e1ca918c7c..4b102b39d5 100644 --- a/Library/Homebrew/cleanup.rb +++ b/Library/Homebrew/cleanup.rb @@ -180,25 +180,32 @@ module Homebrew return false unless periodic_clean_due? ohai "`brew cleanup` has not been run in #{CLEANUP_DEFAULT_DAYS} days, running now..." - clean!(quiet: true) + clean!(quiet: true, periodic: true) end - def clean!(quiet: false) + def clean!(quiet: false, periodic: false) if args.empty? Formula.installed.sort_by(&:name).each do |formula| cleanup_formula(formula, quiet: quiet) end cleanup_cache cleanup_logs - cleanup_portable_ruby cleanup_lockfiles - return if dry_run? - - cleanup_old_cache_db - rm_ds_store prune_prefix_symlinks_and_directories - HOMEBREW_CACHE.mkpath - FileUtils.touch PERIODIC_CLEAN_FILE + + unless dry_run? + cleanup_old_cache_db + rm_ds_store + HOMEBREW_CACHE.mkpath + FileUtils.touch PERIODIC_CLEAN_FILE + end + + # Cleaning up Ruby needs to be done last to avoid requiring additional + # files afterwards. Additionally, don't allow it on periodic cleans to + # avoid having to try to do a `brew install` when we've just deleted + # the running Ruby process... + return if periodic + cleanup_portable_ruby else args.each do |arg| formula = begin From 0c4449858120c2b4e1ca1785dba166138609f31d Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 13 Feb 2019 13:29:37 +0000 Subject: [PATCH 162/199] download_strategy: more robust filename content encoding handling. Fixes #5713. --- Library/Homebrew/download_strategy.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 3e86038a75..8481378f93 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -371,12 +371,16 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy parse_content_disposition = lambda do |line| next unless content_disposition = content_disposition_parser.parse(line, true) + filename = nil + if filename_with_encoding = content_disposition.parameters["filename*"] encoding, encoded_filename = filename_with_encoding.split("''", 2) - URI.decode_www_form_component(encoded_filename).encode(encoding) - else - content_disposition.filename + if encoding && encoded_filename + filename = URI.decode_www_form_component(encoded_filename).encode(encoding) + end end + + filename || content_disposition.filename end filenames = lines.map(&parse_content_disposition).compact From 1b609ceeb344512319edc50ff72e0d0026f702a7 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 13 Feb 2019 15:02:18 +0000 Subject: [PATCH 163/199] Update maintainer documentation. - Fix Markdown format - Note Linux in the mission statement - Update the maintainer guidelines based on current state - Loosen the new maintainer expectations - Clarify what things the PLC should be added to - Add documentation for making a new Homebrew release --- docs/Maintainer-Guidelines.md | 32 +++++++++++++++++--------- docs/New-Maintainer-Checklist.md | 37 +++++++++++++++--------------- docs/README.md | 4 ++++ docs/Releases.md | 39 ++++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 29 deletions(-) create mode 100644 docs/Releases.md diff --git a/docs/Maintainer-Guidelines.md b/docs/Maintainer-Guidelines.md index b703880126..129d11515c 100644 --- a/docs/Maintainer-Guidelines.md +++ b/docs/Maintainer-Guidelines.md @@ -11,7 +11,7 @@ This document is current practice. If you wish to change or discuss any of the b ## Mission -Homebrew aims to be the missing package manager for macOS. Its primary goal is to be useful to as many people as possible, while remaining maintainable to a professional, high standard by a small group of volunteers. Where possible and sensible, it should seek to use features of macOS to blend in with the macOS and Apple ecosystems. +Homebrew aims to be the missing package manager for macOS (and Linux). Its primary goal is to be useful to as many people as possible, while remaining maintainable to a professional, high standard by a small group of volunteers. Where possible and sensible, it should seek to use features of macOS to blend in with the macOS and Apple ecosystems. On Linux and Windows, it should seek to be as self-contained as possible. ## Quick checklist @@ -34,13 +34,14 @@ Checking dependencies is important, because they will probably stick around forever. Nobody really checks if they are necessary or not. Use the `:optional` and `:recommended` modifiers as appropriate. -Depend on as little stuff as possible. Disable X11 functionality by default. -For example, we build Wireshark, but not the heavy GTK/Qt GUI by default. +Depend on as little stuff as possible. Disable X11 functionality if possible. +For example, we build Wireshark, but not the heavy GUI. Homebrew is about Unix software. Stuff that builds to an `.app` should -probably be in Homebrew Cask instead. +be in Homebrew Cask instead. ### Naming + The name is the strictest item, because avoiding a later name change is desirable. @@ -55,6 +56,7 @@ underscores and hyphens and so on. We now accept versioned formulae as long as they [meet the requirements](Versions.md). ### Merging, rebasing, cherry-picking + Merging should be done in the `Homebrew/brew` repository to preserve history & GPG commit signing, and squash/merge via GitHub should be used for formulae where those formulae don't need bottles or the change does not require new bottles to be pulled. @@ -71,6 +73,7 @@ the commits. Our main branch history should be useful to other people, not confusing. ### Testing + We need to at least check that it builds. Use the [Brew Test Bot](Brew-Test-Bot.md) for this. Verify the formula works if possible. If you can’t tell (e.g. if it’s a @@ -94,23 +97,24 @@ that bug must be fixed, or worked around in the formula to yield a passing test, before the PR can be merged. ## Common “gotchas” -1. [Ensure you have set your username and email address - properly](https://help.github.com/articles/setting-your-email-in-git/) -2. Sign off cherry-picks if you amended them ([GitX-dev](https://github.com/rowanj/gitx) - can do this, otherwise there is a command-line flag for it) -3. If the commit fixes a bug, use “Fixes \#104” syntax to close the bug - report and link to the commit + +1. [Ensure you have set your username and email address properly](https://help.github.com/articles/setting-your-email-in-git/) +2. Sign off cherry-picks if you amended them (use `git -s`) +3. If the commit fixes a bug, use “Fixes \#104” syntax to close the bug report and link to the commit ### Duplicates + We now accept stuff that comes with macOS as long as it uses `keg_only :provided_by_macos` to be keg-only by default. ### Add comments + It may be enough to refer to an issue ticket, but make sure changes are clear so that if you came to them unaware of the surrounding issues they would make sense to you. Many times on other projects I’ve seen code removed because the new guy didn’t know why it was there. Regressions suck. ### Don’t allow bloated diffs + Amend a cherry-pick to remove commits that are only changes in whitespace. They are not acceptable because our history is important and `git blame` should be useful. @@ -121,9 +125,11 @@ of modification that is not whitespace in it. But be careful about making changes to inline patches—make sure they still apply. ### Adding or updating formulae -Any one maintainer is necessary to approve and merge the addition of a new or updated formula which passes CI. However, if the formula addition or update proves controversial the maintainer who adds it will be expected to answer requests and fix problems that arise with it in future. + +Only one maintainer is necessary to approve and merge the addition of a new or updated formula which passes CI. However, if the formula addition or update proves controversial the maintainer who adds it will be expected to answer requests and fix problems that arise with it in future. ### Removing formulae + Formulae that: - work on at least 2/3 of our supported macOS versions in the default Homebrew prefix @@ -134,14 +140,17 @@ Formulae that: should not be removed from Homebrew. The exception to this rule are [versioned formulae](Versions.md) for which there are higher standards of usage and a maximum number of versions for a given formula. ### Closing issues/PRs + Maintainers (including the lead maintainer) should not close issues or pull requests (note a merge is not considered a close in this case) opened by other maintainers unless they are stale (i.e. have seen no updates for 28 days) in which case they can be closed by any maintainer. Any maintainer is encouraged to reopen a closed issue when they wish to do additional work on the issue. Any maintainer can merge any PR they have carefully reviewed and is passing CI that has been opened by any other maintainer. If you do not wish to have other maintainers merge your PRs: please use the `do not merge` label to indicate that until you're ready to merge it yourself. ## Reverting PRs + Any maintainer can revert a PR created by another maintainer after a user submitted issue or CI failure that results. The maintainer who created the original PR should be given no less than an hour to fix the issue themselves or decide to revert the PR themselves if they would rather. ## Communication + Maintainers have a variety of ways to communicate with each other: - Homebrew's public repositories on GitHub @@ -157,6 +166,7 @@ All maintainers (and lead maintainer) communication through any medium is bound Maintainers should feel free to pleasantly disagree with the work and decisions of other maintainers. Healthy, friendly, technical disagreement between maintainers is actively encouraged and should occur in public on the issue tracker to make the project better. Interpersonal issues should be handled privately in Slack, ideally with moderation. If work or decisions are insufficiently documented or explained any maintainer or contributor should feel free to ask for clarification. No maintainer may ever justify a decision with e.g. "because I say so" or "it was I who did X" alone. Off-topic discussions on the issue tracker, [bike-shedding](https://en.wikipedia.org/wiki/Law_of_triviality) and personal attacks are forbidden. ## Project lead guidelines + There should be one project lead for Homebrew. On February 4, 2019, coinciding with the Homebrew maintainers' conference, Mike McQuaid stepped down as lead maintainer of Homebrew. He was elected by a supermajority of Homebrew maintainers into the new project lead role. Additional documentation for the project lead and governance are to follow. diff --git a/docs/New-Maintainer-Checklist.md b/docs/New-Maintainer-Checklist.md index 3d83da9859..0709b3a560 100644 --- a/docs/New-Maintainer-Checklist.md +++ b/docs/New-Maintainer-Checklist.md @@ -2,24 +2,24 @@ **This is a guide used by existing maintainers to invite new maintainers. You might find it interesting but there's nothing here users should have to know.** -There's someone who has been making consistently high-quality contributions to Homebrew for a long time and shown themselves able to make slightly more advanced contributions than just e.g. formula updates? Let's invite them to be a maintainer! +There's someone who has been making consistently high-quality contributions to Homebrew and shown themselves able to make slightly more advanced contributions than just e.g. formula updates? Let's invite them to be a maintainer! First, send them the invitation email: -``` +```markdown The Homebrew team and I really appreciate your help on issues, pull requests and your contributions to Homebrew. We would like to invite you to have commit access and be a Homebrew maintainer. If you agree to be a maintainer, you should spend a significant proportion of -the time you are working on Homebrew fixing user-reported issues, resolving any -issues that arise from your code in a timely fashion and reviewing user -contributions. You should also be making contributions to Homebrew every month -unless you are ill or on vacation (and please let another maintainer know if -that's the case so we're aware you won't be able to help while you are out). +the time you are working on Homebrew applying and self-merging widely used +changes (e.g. version updates), triaging, fixing and debugging user-reported +issues, or reviewing user pull requests. You should also be making contributions +to Homebrew at least once per quarter. -You will need to watch Homebrew/brew and/or Homebrew/homebrew-core. Let us know -which (or both) so we can grant you commit access appropriately. +You will should watch or regularly check Homebrew/brew and/or +Homebrew/homebrew-core. Let us know which (or both) so we can grant you commit +access appropriately. If you're no longer able to perform all of these tasks, please continue to contribute to Homebrew, but we will ask you to step down as a maintainer. @@ -34,8 +34,8 @@ A few requests: multiple formulae and let it auto-close issues wherever possible (it may take ~5m). When this isn't necessary use GitHub's "Merge pull request" button in "create a merge commit" mode for Homebrew/brew or "squash and - merge" for a single formulae change. If in doubt, check with e.g. GitX that - you've not accidentally added merge commits. + merge" for a single formulae change. If in doubt, check with e.g. Fork.app + that you've not accidentally added merge commits. - Still create your branches on your fork rather than in the main repository. Note GitHub's UI will create edits and reverts on the main repository if you make edits or click "Revert" on the Homebrew/brew repository rather than your @@ -63,18 +63,19 @@ If they accept, follow a few steps to get them set up: - Ask them to (regularly) review remove any unneeded [GitHub personal access tokens](https://github.com/settings/tokens). - Add them to [Homebrew/brew's README](https://github.com/Homebrew/brew/edit/master/README.md). -If they are also interested in doing system administration work: +If they are interested in doing system administration work or Homebrew/brew releases: - Invite them to the [`homebrew-ops` private operations mailing list](https://lists.sfconservancy.org/mailman/admin/homebrew-ops/members/add). - Invite them to the [`homebrew` private 1Password](https://homebrew.1password.com/people). -If they want to consume raw anonymous aggregate analytics data (rather than use `brew formula-analytics`): +If they are elected to of the Homebrew's [Software Freedom Conservancy](https://sfconservancy.org) Project Leadership Committee: -- Invite them to [Google Analytics](https://analytics.google.com/analytics/web/?authuser=1#management/Settings/a76679469w115400090p120682403/%3Fm.page%3DAccountUsers/). - -Once they have been active maintainers for at least a year and had some activity on more than one Homebrew organisation repository (or one repository and helped with system administration work): - -- Homebrew's [Software Freedom Conservancy](https://sfconservancy.org) Project Leadership Committee can take a vote on whether to extend an offer to the maintainer to join the committee. If they accept, email their name, email and employer to homebrew@sfconservancy.org, make them [owners on the Homebrew GitHub organisation](https://github.com/orgs/Homebrew/people) and add them to the relevant section of the [Homebrew/brew's README](https://github.com/Homebrew/brew/edit/master/README.md). +- Email their name, email and employer to homebrew@sfconservancy.org +- Make them [owners on the Homebrew GitHub organisation](https://github.com/orgs/Homebrew/people) +- Invite them to the [**@Homebrew/plc** team](https://github.com/orgs/Homebrew/teams/plc/members) +- Invite them to [Google Analytics](https://analytics.google.com/analytics/web/#management/Settings/a76679469w115400090p120682403/%3Fm.page%3DAccountUsers/) and add them to the relevant section of the [Homebrew/brew's README](https://github.com/Homebrew/brew/edit/master/README.md). +- Invite them to the [`homebrew` private 1Password](https://homebrew.1password.com/people). +- Make them owners on the [`machomebrew` private maintainers Slack](https://machomebrew.slack.com/admin)). If there are problems, ask them to step down as a maintainer and revoke their access to all of the above. diff --git a/docs/README.md b/docs/README.md index e022ca1a28..84a33413d3 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,6 +1,7 @@ # Documentation ## Users + - [`brew` man-page (command documentation)](Manpage.md) - [Troubleshooting](Troubleshooting.md) - [Installation](Installation.md) @@ -27,6 +28,7 @@ - [Kickstarter Supporters](Kickstarter-Supporters.md) ## Contributors + - [How To Open A Pull Request (and get it merged)](How-To-Open-a-Homebrew-Pull-Request.md) - [Formula Cookbook](Formula-Cookbook.md) - [Acceptable Formulae](Acceptable-Formulae.md) @@ -41,8 +43,10 @@ - [Prose Style Guidelines](Prose-Style-Guidelines.md) ## Maintainers + - [New Maintainer Checklist](New-Maintainer-Checklist.md) - [Maintainers: Avoiding Burnout](Maintainers-Avoiding-Burnout.md) - [Maintainer Guidelines](Maintainer-Guidelines.md) - [Brew Test Bot For Maintainers](Brew-Test-Bot-For-Core-Contributors.md) - [Common Issues for Maintainers](Common-Issues-for-Core-Contributors.md) +- [Releases](Releases.md) diff --git a/docs/Releases.md b/docs/Releases.md new file mode 100644 index 0000000000..babdf92476 --- /dev/null +++ b/docs/Releases.md @@ -0,0 +1,39 @@ +# Releases + +Since Homebrew 1.0.0 most Homebrew users (those who haven't run a `dev-cmd` or +set `HOMEBREW_DEVELOPER=1`) require tags on the [Homebrew/brew repository](https://github.com/homebrew/brew) +in order to get new versions of Homebrew. There are a few steps in making a new +Homebrew release: + +1. Check the [Homebrew/brew pull requests](https://github.com/homebrew/brew/pulls) + and [issues](https://github.com/homebrew/brew/issues) to see if there is + anything pressing that needs to be fixed or merged before the next release. + If so, fix and merge these changes. +2. After no code changes have happened for at least a few hours (ideally 24 hours) + and you are confident there's no major regressions on the current `master` + branch you can create a new Git tag. Ideally this should be signed with your + GPG key. This can then be pushed to GitHub. +3. Use `brew release-notes --markdown $PREVIOUS_TAG` to generate the release + notes for the release. [Create a new release on GitHub](https://github.com/Homebrew/brew/releases) + based on the new tag. + +If this is a major or minor release (e.g. X.0.0 or X.Y.0) then there are a few more steps: + +1. Before creating the tag you should delete any `odisabled` code, make any + `odeprecated` code `odisabled` and add any new `odeprecations` that are + desired. +2. Write up a release notes blog post to https://brew.sh + e.g. https://github.com/Homebrew/brew.sh/pull/319. + This should use `brew release-notes` as input but have the wording adjusted + to be more human readable and explain not just what has changed but why. +3. When the release has shipped and the blog post has been merged, tweet the + blog post as the @MacHomebrew Twitter account or tweet it yourself and + retweet it with the @MacHomebrew Twitter account (credentials are in + 1Password). +4. Send the email to the Homebrew TinyLetter email list (credentials are in + 1Password). +5. Consider whether to submit it to other sources e.g. Hacker News, Reddit. + + - Pros: gets a wider reach and user feedback + - Cons: negative comments are common and people take this as a chance to + complain about Homebrew (regardless of their usage) From 948b367ac3b2fa947b87175386cbf885bb41f1de Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 13 Feb 2019 15:43:17 +0000 Subject: [PATCH 164/199] brew.rb: don't try to uninstall brew-cask keg. This is long gone at this point so no need to keep this code around. --- Library/Homebrew/brew.rb | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index 129c99aa67..ad8734b629 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -92,11 +92,6 @@ begin # `Homebrew.help` never returns, except for external/unknown commands. end - # Uninstall old brew-cask if it's still around; we just use the tap now. - if cmd == "cask" && (HOMEBREW_CELLAR/"brew-cask").exist? - system(HOMEBREW_BREW_FILE, "uninstall", "--force", "brew-cask") - end - if ENV["HOMEBREW_BUILD_FROM_SOURCE"] odisabled("HOMEBREW_BUILD_FROM_SOURCE", "--build-from-source") end From bf873783d20bfe170d442157c08d615c42fa80af Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 14 Feb 2019 09:13:00 +0000 Subject: [PATCH 165/199] Apply suggestions from code review Co-Authored-By: MikeMcQuaid --- docs/New-Maintainer-Checklist.md | 4 ++-- docs/Releases.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/New-Maintainer-Checklist.md b/docs/New-Maintainer-Checklist.md index 0709b3a560..ebdd68d402 100644 --- a/docs/New-Maintainer-Checklist.md +++ b/docs/New-Maintainer-Checklist.md @@ -17,7 +17,7 @@ changes (e.g. version updates), triaging, fixing and debugging user-reported issues, or reviewing user pull requests. You should also be making contributions to Homebrew at least once per quarter. -You will should watch or regularly check Homebrew/brew and/or +You should watch or regularly check Homebrew/brew and/or Homebrew/homebrew-core. Let us know which (or both) so we can grant you commit access appropriately. @@ -68,7 +68,7 @@ If they are interested in doing system administration work or Homebrew/brew rele - Invite them to the [`homebrew-ops` private operations mailing list](https://lists.sfconservancy.org/mailman/admin/homebrew-ops/members/add). - Invite them to the [`homebrew` private 1Password](https://homebrew.1password.com/people). -If they are elected to of the Homebrew's [Software Freedom Conservancy](https://sfconservancy.org) Project Leadership Committee: +If they are elected to the Homebrew's [Software Freedom Conservancy](https://sfconservancy.org) Project Leadership Committee: - Email their name, email and employer to homebrew@sfconservancy.org - Make them [owners on the Homebrew GitHub organisation](https://github.com/orgs/Homebrew/people) diff --git a/docs/Releases.md b/docs/Releases.md index babdf92476..9f779b7a25 100644 --- a/docs/Releases.md +++ b/docs/Releases.md @@ -14,7 +14,7 @@ Homebrew release: branch you can create a new Git tag. Ideally this should be signed with your GPG key. This can then be pushed to GitHub. 3. Use `brew release-notes --markdown $PREVIOUS_TAG` to generate the release - notes for the release. [Create a new release on GitHub](https://github.com/Homebrew/brew/releases) + notes for the release. [Create a new release on GitHub](https://github.com/Homebrew/brew/releases/new) based on the new tag. If this is a major or minor release (e.g. X.0.0 or X.Y.0) then there are a few more steps: From f8d84249aaf748ba4e5699b2327623b69083737d Mon Sep 17 00:00:00 2001 From: Ben Muschol Date: Fri, 15 Feb 2019 00:31:13 -0500 Subject: [PATCH 166/199] Prioritize CLI arguments over env vars when they conflict --- Library/Homebrew/cli_parser.rb | 24 +++++++++++++++++++++--- Library/Homebrew/test/cli_parser_spec.rb | 19 +++++++++++++++++-- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/cli_parser.rb b/Library/Homebrew/cli_parser.rb index 160071f87f..d18811ef94 100644 --- a/Library/Homebrew/cli_parser.rb +++ b/Library/Homebrew/cli_parser.rb @@ -27,6 +27,7 @@ module Homebrew Homebrew.args.instance_eval { undef tap } @constraints = [] @conflicts = [] + @switch_sources = {} @processed_options = [] @desc_line_length = 43 @hide_from_man_page = false @@ -58,7 +59,7 @@ module Homebrew set_constraints(name, required_for: required_for, depends_on: depends_on) end - enable_switch(*names) if !env.nil? && !ENV["HOMEBREW_#{env.to_s.upcase}"].nil? + enable_switch(*names, source: :env_var) if !env.nil? && !ENV["HOMEBREW_#{env.to_s.upcase}"].nil? end alias switch_option switch @@ -172,12 +173,19 @@ module Homebrew private - def enable_switch(*names) + def enable_switch(*names, source: :cli_arg) names.each do |name| + @switch_sources[option_to_name(name)] = source Homebrew.args["#{option_to_name(name)}?"] = true end end + def disable_switch(*names) + names.each do |name| + Homebrew.args.delete_field("#{option_to_name(name)}?") + end + end + # These are common/global switches accessible throughout Homebrew def common_switch(name) Homebrew::CLI::Parser.global_options.fetch(name, name) @@ -225,7 +233,17 @@ module Homebrew next if violations.count < 2 - raise OptionConflictError, violations.map(&method(:name_to_option)) + env_var_options = violations.select do |option| + @switch_sources[option_to_name(option)] == :env_var + end + + if violations.count - env_var_options.count == 1 + env_var_options.each do |option| + disable_switch option + end + else + raise OptionConflictError, violations.map(&method(:name_to_option)) + end end end diff --git a/Library/Homebrew/test/cli_parser_spec.rb b/Library/Homebrew/test/cli_parser_spec.rb index 975f5ed86b..caaa71d78f 100644 --- a/Library/Homebrew/test/cli_parser_spec.rb +++ b/Library/Homebrew/test/cli_parser_spec.rb @@ -145,8 +145,8 @@ describe Homebrew::CLI::Parser do describe "test constraints for switch options" do subject(:parser) { described_class.new do - switch "-a", "--switch-a" - switch "-b", "--switch-b" + switch "-a", "--switch-a", env: "switch_a" + switch "-b", "--switch-b", env: "switch_b" switch "--switch-c", required_for: "--switch-a" switch "--switch-d", depends_on: "--switch-b" @@ -177,6 +177,21 @@ describe Homebrew::CLI::Parser do parser.parse(["--switch-b"]) expect(Homebrew.args.switch_b?).to be true end + + it "prioritizes cli arguments over env vars when they conflict" do + allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_A").and_return("1") + allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_B").and_return("0") + parser.parse(["--switch-b"]) + expect(Homebrew.args.switch_a?).to be_falsy + expect(Homebrew.args.switch_b?).to be true + end + + it "raises an exception on constraint violation when both are env vars" do + allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_A").and_return("1") + allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_B").and_return("1") + allow(ENV).to receive(:[]) + expect { parser.parse(["--switch-a", "--switch-b"]) }.to raise_error(Homebrew::CLI::OptionConflictError) + end end describe "test immutability of args" do From 440fb185dd6f702bce85691c6fda4cc50876b47d Mon Sep 17 00:00:00 2001 From: Ben Muschol Date: Fri, 15 Feb 2019 01:16:07 -0500 Subject: [PATCH 167/199] Fix 1 style conflict, keep the other for consistency --- Library/Homebrew/cli_parser.rb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Library/Homebrew/cli_parser.rb b/Library/Homebrew/cli_parser.rb index d18811ef94..c8616dbc4a 100644 --- a/Library/Homebrew/cli_parser.rb +++ b/Library/Homebrew/cli_parser.rb @@ -237,13 +237,9 @@ module Homebrew @switch_sources[option_to_name(option)] == :env_var end - if violations.count - env_var_options.count == 1 - env_var_options.each do |option| - disable_switch option - end - else - raise OptionConflictError, violations.map(&method(:name_to_option)) - end + select_cli_arg = violations.count - env_var_options.count == 1 + raise OptionConflictError, violations.map(&method(:name_to_option)) unless select_cli_arg + env_var_options.each(&method(:disable_switch)) end end From 1e1ce1c471dfaf83c8b3349a29bcb61d20ec8920 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 2 Feb 2019 17:11:37 +0100 Subject: [PATCH 168/199] Save config file for casks. --- Library/Homebrew/cask/cask.rb | 12 +- Library/Homebrew/cask/config.rb | 86 +++++------ Library/Homebrew/cask/installer.rb | 18 ++- .../test/cask/artifact/alt_target_spec.rb | 4 +- .../Homebrew/test/cask/artifact/app_spec.rb | 4 +- .../test/cask/artifact/binary_spec.rb | 4 +- .../cask/artifact/generic_artifact_spec.rb | 2 +- .../Homebrew/test/cask/artifact/suite_spec.rb | 2 +- .../cask/artifact/two_apps_correct_spec.rb | 6 +- .../Homebrew/test/cask/cmd/install_spec.rb | 11 +- Library/Homebrew/test/cask/cmd/list_spec.rb | 4 +- .../Homebrew/test/cask/cmd/uninstall_spec.rb | 8 +- .../Homebrew/test/cask/cmd/upgrade_spec.rb | 6 +- Library/Homebrew/test/cask/cmd/zap_spec.rb | 4 +- Library/Homebrew/test/cask/dsl_spec.rb | 2 +- Library/Homebrew/test/cask/installer_spec.rb | 12 +- Library/Homebrew/test/cask/quarantine_spec.rb | 138 +++++++++--------- .../spec/shared_context/homebrew_cask.rb | 2 +- 18 files changed, 171 insertions(+), 154 deletions(-) diff --git a/Library/Homebrew/cask/cask.rb b/Library/Homebrew/cask/cask.rb index 38c0ceb09a..4336cff60a 100644 --- a/Library/Homebrew/cask/cask.rb +++ b/Library/Homebrew/cask/cask.rb @@ -11,7 +11,7 @@ module Cask extend Searchable include Metadata - attr_reader :token, :sourcefile_path, :config + attr_reader :token, :sourcefile_path def self.each return to_enum unless block_given? @@ -31,7 +31,7 @@ module Cask @tap end - def initialize(token, sourcefile_path: nil, tap: nil, config: Config.global, &block) + def initialize(token, sourcefile_path: nil, tap: nil, config: nil, &block) @token = token @sourcefile_path = sourcefile_path @tap = tap @@ -77,6 +77,14 @@ module Cask metadata_master_container_path.join(*installed_version, "Casks", "#{token}.rb") end + def config + @config ||= Config.for_cask(self) + end + + def config_path + metadata_master_container_path/"dirs.json" + end + def outdated?(greedy = false) !outdated_versions(greedy).empty? end diff --git a/Library/Homebrew/cask/config.rb b/Library/Homebrew/cask/config.rb index 07ffee2ead..ed40737b47 100644 --- a/Library/Homebrew/cask/config.rb +++ b/Library/Homebrew/cask/config.rb @@ -1,12 +1,8 @@ +require "json" + module Cask - class Config - def self.global - @global ||= new - end - - attr_reader :binarydir - - def initialize( + class Config < DelegateClass(Hash) + DEFAULT_DIRS = { appdir: "/Applications", prefpanedir: "~/Library/PreferencePanes", qlplugindir: "~/Library/QuickLook", @@ -19,47 +15,51 @@ module Cask audio_unit_plugindir: "~/Library/Audio/Plug-Ins/Components", vst_plugindir: "~/Library/Audio/Plug-Ins/VST", vst3_plugindir: "~/Library/Audio/Plug-Ins/VST3", - screen_saverdir: "~/Library/Screen Savers" - ) + screen_saverdir: "~/Library/Screen Savers", + }.freeze - self.appdir = appdir - self.prefpanedir = prefpanedir - self.qlplugindir = qlplugindir - self.dictionarydir = dictionarydir - self.fontdir = fontdir - self.colorpickerdir = colorpickerdir - self.servicedir = servicedir - self.input_methoddir = input_methoddir - self.internet_plugindir = internet_plugindir - self.audio_unit_plugindir = audio_unit_plugindir - self.vst_plugindir = vst_plugindir - self.vst3_plugindir = vst3_plugindir - self.screen_saverdir = screen_saverdir - - # `binarydir` is not customisable. - @binarydir = HOMEBREW_PREFIX/"bin" + def self.global + @global ||= new end - [ - :appdir, - :prefpanedir, - :qlplugindir, - :dictionarydir, - :fontdir, - :colorpickerdir, - :servicedir, - :input_methoddir, - :internet_plugindir, - :audio_unit_plugindir, - :vst_plugindir, - :vst3_plugindir, - :screen_saverdir, - ].each do |dir| - attr_reader dir + def self.for_cask(cask) + if cask.config_path.exist? + from_file(cask.config_path) + else + global + end + end + + def self.from_file(path) + config = begin + JSON.parse(File.read(path)) + rescue JSON::ParserError => e + raise e, "Cannot parse #{path}: #{e}", e.backtrace + end + + new(Hash[config.map { |k, v| [k.to_sym, v] }]) + end + + def initialize(**dirs) + super(Hash[DEFAULT_DIRS.map { |(k, v)| [k, Pathname(dirs.fetch(k, v)).expand_path] }]) + end + + def binarydir + @binarydir ||= HOMEBREW_PREFIX/"bin" + end + + DEFAULT_DIRS.keys.each do |dir| + define_method(dir) do + self[dir] + end define_method(:"#{dir}=") do |path| - instance_variable_set(:"@#{dir}", Pathname(path).expand_path) + self[dir] = Pathname(path).expand_path end end + + def write(path) + path.atomic_write(to_json) + end end end diff --git a/Library/Homebrew/cask/installer.rb b/Library/Homebrew/cask/installer.rb index 5c2b58ebd2..74f1664972 100644 --- a/Library/Homebrew/cask/installer.rb +++ b/Library/Homebrew/cask/installer.rb @@ -39,7 +39,7 @@ module Cask end attr_predicate :binaries?, :force?, :skip_cask_deps?, :require_sha?, - :upgrade?, :verbose?, :installed_as_dependency?, + :reinstall?, :upgrade?, :verbose?, :installed_as_dependency?, :quarantine? def self.print_caveats(cask) @@ -79,7 +79,7 @@ module Cask def install odebug "Cask::Installer#install" - if @cask.installed? && !force? && !@reinstall && !upgrade? + if @cask.installed? && !force? && !reinstall? && !upgrade? raise CaskAlreadyInstalledError, @cask end @@ -87,7 +87,7 @@ module Cask print_caveats fetch - uninstall_existing_cask if @reinstall + uninstall_existing_cask if reinstall? oh1 "Installing Cask #{Formatter.identifier(@cask)}" opoo "macOS's Gatekeeper has been disabled for this Cask" unless quarantine? @@ -209,6 +209,8 @@ module Cask artifact.install_phase(command: @command, verbose: verbose?, force: force?) already_installed_artifacts.unshift(artifact) end + + save_config_file rescue => e begin already_installed_artifacts.each do |artifact| @@ -382,13 +384,23 @@ module Cask old_savedir&.rmtree end + def save_config_file + @cask.config.write(@cask.config_path) + end + def uninstall oh1 "Uninstalling Cask #{Formatter.identifier(@cask)}" uninstall_artifacts(clear: true) + remove_config_file unless reinstall? || upgrade? purge_versioned_files purge_caskroom_path if force? end + def remove_config_file + FileUtils.rm_f @cask.config_path + @cask.config_path.parent.rmdir_if_possible + end + def start_upgrade oh1 "Starting upgrade for Cask #{Formatter.identifier(@cask)}" diff --git a/Library/Homebrew/test/cask/artifact/alt_target_spec.rb b/Library/Homebrew/test/cask/artifact/alt_target_spec.rb index ef929154f6..b2808c420d 100644 --- a/Library/Homebrew/test/cask/artifact/alt_target_spec.rb +++ b/Library/Homebrew/test/cask/artifact/alt_target_spec.rb @@ -11,7 +11,7 @@ describe Cask::Artifact::App, :cask do } let(:source_path) { cask.staged_path.join("Caffeine.app") } - let(:target_path) { Cask::Config.global.appdir.join("AnotherName.app") } + let(:target_path) { cask.config.appdir.join("AnotherName.app") } before do InstallHelper.install_without_artifacts(cask) @@ -58,7 +58,7 @@ describe Cask::Artifact::App, :cask do expect(target_path).to be_a_directory expect(source_path).not_to exist - expect(Cask::Config.global.appdir.join("Caffeine Deluxe.app")).not_to exist + expect(cask.config.appdir.join("Caffeine Deluxe.app")).not_to exist expect(cask.staged_path.join("Caffeine Deluxe.app")).to be_a_directory end diff --git a/Library/Homebrew/test/cask/artifact/app_spec.rb b/Library/Homebrew/test/cask/artifact/app_spec.rb index 26abb19ad9..14917b4f42 100644 --- a/Library/Homebrew/test/cask/artifact/app_spec.rb +++ b/Library/Homebrew/test/cask/artifact/app_spec.rb @@ -5,7 +5,7 @@ describe Cask::Artifact::App, :cask do let(:app) { cask.artifacts.find { |a| a.is_a?(described_class) } } let(:source_path) { cask.staged_path.join("Caffeine.app") } - let(:target_path) { Cask::Config.global.appdir.join("Caffeine.app") } + let(:target_path) { cask.config.appdir.join("Caffeine.app") } let(:install_phase) { app.install_phase(command: command, force: force) } let(:uninstall_phase) { app.uninstall_phase(command: command, force: force) } @@ -53,7 +53,7 @@ describe Cask::Artifact::App, :cask do expect(target_path).to be_a_directory expect(source_path).not_to exist - expect(Cask::Config.global.appdir.join("Caffeine Deluxe.app")).not_to exist + expect(cask.config.appdir.join("Caffeine Deluxe.app")).not_to exist expect(cask.staged_path.join("Caffeine Deluxe.app")).to exist end diff --git a/Library/Homebrew/test/cask/artifact/binary_spec.rb b/Library/Homebrew/test/cask/artifact/binary_spec.rb index bd70904ebc..0aa60c38fe 100644 --- a/Library/Homebrew/test/cask/artifact/binary_spec.rb +++ b/Library/Homebrew/test/cask/artifact/binary_spec.rb @@ -5,7 +5,7 @@ describe Cask::Artifact::Binary, :cask do end } let(:artifacts) { cask.artifacts.select { |a| a.is_a?(described_class) } } - let(:expected_path) { Cask::Config.global.binarydir.join("binary") } + let(:expected_path) { cask.config.binarydir.join("binary") } after do FileUtils.rm expected_path if expected_path.exist? @@ -38,7 +38,7 @@ describe Cask::Artifact::Binary, :cask do end } - let(:expected_path) { Cask::Config.global.binarydir.join("naked_non_executable") } + let(:expected_path) { cask.config.binarydir.join("naked_non_executable") } it "makes the binary executable" do expect(FileUtils).to receive(:chmod) diff --git a/Library/Homebrew/test/cask/artifact/generic_artifact_spec.rb b/Library/Homebrew/test/cask/artifact/generic_artifact_spec.rb index ff28392175..83fb55fc58 100644 --- a/Library/Homebrew/test/cask/artifact/generic_artifact_spec.rb +++ b/Library/Homebrew/test/cask/artifact/generic_artifact_spec.rb @@ -10,7 +10,7 @@ describe Cask::Artifact::Artifact, :cask do } let(:source_path) { cask.staged_path.join("Caffeine.app") } - let(:target_path) { Cask::Config.global.appdir.join("Caffeine.app") } + let(:target_path) { cask.config.appdir.join("Caffeine.app") } before do InstallHelper.install_without_artifacts(cask) diff --git a/Library/Homebrew/test/cask/artifact/suite_spec.rb b/Library/Homebrew/test/cask/artifact/suite_spec.rb index 87f821aea2..3f4a2d6dc8 100644 --- a/Library/Homebrew/test/cask/artifact/suite_spec.rb +++ b/Library/Homebrew/test/cask/artifact/suite_spec.rb @@ -9,7 +9,7 @@ describe Cask::Artifact::Suite, :cask do end } - let(:target_path) { Cask::Config.global.appdir.join("Caffeine") } + let(:target_path) { cask.config.appdir.join("Caffeine") } let(:source_path) { cask.staged_path.join("Caffeine") } before do diff --git a/Library/Homebrew/test/cask/artifact/two_apps_correct_spec.rb b/Library/Homebrew/test/cask/artifact/two_apps_correct_spec.rb index a5375125ba..7381c832ba 100644 --- a/Library/Homebrew/test/cask/artifact/two_apps_correct_spec.rb +++ b/Library/Homebrew/test/cask/artifact/two_apps_correct_spec.rb @@ -11,10 +11,10 @@ describe Cask::Artifact::App, :cask do } let(:source_path_mini) { cask.staged_path.join("Caffeine Mini.app") } - let(:target_path_mini) { Cask::Config.global.appdir.join("Caffeine Mini.app") } + let(:target_path_mini) { cask.config.appdir.join("Caffeine Mini.app") } let(:source_path_pro) { cask.staged_path.join("Caffeine Pro.app") } - let(:target_path_pro) { Cask::Config.global.appdir.join("Caffeine Pro.app") } + let(:target_path_pro) { cask.config.appdir.join("Caffeine Pro.app") } before do InstallHelper.install_without_artifacts(cask) @@ -52,7 +52,7 @@ describe Cask::Artifact::App, :cask do expect(target_path_mini).to be_a_directory expect(source_path_mini).not_to exist - expect(Cask::Config.global.appdir.join("Caffeine Deluxe.app")).not_to exist + expect(cask.config.appdir.join("Caffeine Deluxe.app")).not_to exist expect(cask.staged_path.join("Caffeine Deluxe.app")).to exist end diff --git a/Library/Homebrew/test/cask/cmd/install_spec.rb b/Library/Homebrew/test/cask/cmd/install_spec.rb index c3113e1662..1efe513b4c 100644 --- a/Library/Homebrew/test/cask/cmd/install_spec.rb +++ b/Library/Homebrew/test/cask/cmd/install_spec.rb @@ -21,11 +21,12 @@ describe Cask::Cmd::Install, :cask do it "allows staging and activation of multiple Casks at once" do described_class.run("local-transmission", "local-caffeine") - - expect(Cask::CaskLoader.load(cask_path("local-transmission"))).to be_installed - expect(Cask::Config.global.appdir.join("Transmission.app")).to be_a_directory - expect(Cask::CaskLoader.load(cask_path("local-caffeine"))).to be_installed - expect(Cask::Config.global.appdir.join("Caffeine.app")).to be_a_directory + transmission = Cask::CaskLoader.load(cask_path("local-transmission")) + caffeine = Cask::CaskLoader.load(cask_path("local-caffeine")) + expect(transmission).to be_installed + expect(transmission.config.appdir.join("Transmission.app")).to be_a_directory + expect(caffeine).to be_installed + expect(caffeine.config.appdir.join("Caffeine.app")).to be_a_directory end it "skips double install (without nuking existing installation)" do diff --git a/Library/Homebrew/test/cask/cmd/list_spec.rb b/Library/Homebrew/test/cask/cmd/list_spec.rb index 2c819fcb30..7d63076e46 100644 --- a/Library/Homebrew/test/cask/cmd/list_spec.rb +++ b/Library/Homebrew/test/cask/cmd/list_spec.rb @@ -80,9 +80,9 @@ describe Cask::Cmd::List, :cask do described_class.run("local-transmission", "local-caffeine") }.to output(<<~EOS).to_stdout ==> Apps - #{Cask::Config.global.appdir.join("Transmission.app")} (#{Cask::Config.global.appdir.join("Transmission.app").abv}) + #{transmission.config.appdir.join("Transmission.app")} (#{transmission.config.appdir.join("Transmission.app").abv}) ==> Apps - Missing App: #{Cask::Config.global.appdir.join("Caffeine.app")} + Missing App: #{caffeine.config.appdir.join("Caffeine.app")} EOS end end diff --git a/Library/Homebrew/test/cask/cmd/uninstall_spec.rb b/Library/Homebrew/test/cask/cmd/uninstall_spec.rb index 215c9f9757..dc6a07e01d 100644 --- a/Library/Homebrew/test/cask/cmd/uninstall_spec.rb +++ b/Library/Homebrew/test/cask/cmd/uninstall_spec.rb @@ -51,9 +51,9 @@ describe Cask::Cmd::Uninstall, :cask do described_class.run("local-caffeine", "local-transmission") expect(caffeine).not_to be_installed - expect(Cask::Config.global.appdir.join("Transmission.app")).not_to exist + expect(caffeine.config.appdir.join("Transmission.app")).not_to exist expect(transmission).not_to be_installed - expect(Cask::Config.global.appdir.join("Caffeine.app")).not_to exist + expect(transmission.config.appdir.join("Caffeine.app")).not_to exist end it "calls `uninstall` before removing artifacts" do @@ -69,7 +69,7 @@ describe Cask::Cmd::Uninstall, :cask do }.not_to raise_error expect(cask).not_to be_installed - expect(Cask::Config.global.appdir.join("MyFancyApp.app")).not_to exist + expect(cask.config.appdir.join("MyFancyApp.app")).not_to exist end it "can uninstall Casks when the uninstall script is missing, but only when using `--force`" do @@ -79,7 +79,7 @@ describe Cask::Cmd::Uninstall, :cask do expect(cask).to be_installed - Cask::Config.global.appdir.join("MyFancyApp.app").rmtree + cask.config.appdir.join("MyFancyApp.app").rmtree expect { described_class.run("with-uninstall-script-app") } .to raise_error(Cask::CaskError, /uninstall script .* does not exist/) diff --git a/Library/Homebrew/test/cask/cmd/upgrade_spec.rb b/Library/Homebrew/test/cask/cmd/upgrade_spec.rb index b43bb6c9fa..16b2b82049 100644 --- a/Library/Homebrew/test/cask/cmd/upgrade_spec.rb +++ b/Library/Homebrew/test/cask/cmd/upgrade_spec.rb @@ -147,7 +147,7 @@ describe Cask::Cmd::Upgrade, :cask do it 'does not include the Casks with "auto_updates true" when the version did not change' do cask = Cask::CaskLoader.load("auto-updates") - cask_path = Cask::Config.global.appdir.join("MyFancyApp.app") + cask_path = cask.config.appdir.join("MyFancyApp.app") expect(cask).to be_installed expect(cask_path).to be_a_directory @@ -188,7 +188,7 @@ describe Cask::Cmd::Upgrade, :cask do it "restores the old Cask if the upgrade failed" do will_fail_if_upgraded = Cask::CaskLoader.load("will-fail-if-upgraded") - will_fail_if_upgraded_path = Cask::Config.global.appdir.join("container") + will_fail_if_upgraded_path = will_fail_if_upgraded.config.appdir.join("container") expect(will_fail_if_upgraded).to be_installed expect(will_fail_if_upgraded_path).to be_a_file @@ -206,7 +206,7 @@ describe Cask::Cmd::Upgrade, :cask do it "does not restore the old Cask if the upgrade failed pre-install" do bad_checksum = Cask::CaskLoader.load("bad-checksum") - bad_checksum_path = Cask::Config.global.appdir.join("Caffeine.app") + bad_checksum_path = bad_checksum.config.appdir.join("Caffeine.app") expect(bad_checksum).to be_installed expect(bad_checksum_path).to be_a_directory diff --git a/Library/Homebrew/test/cask/cmd/zap_spec.rb b/Library/Homebrew/test/cask/cmd/zap_spec.rb index f7071e0e1a..fd646477e8 100644 --- a/Library/Homebrew/test/cask/cmd/zap_spec.rb +++ b/Library/Homebrew/test/cask/cmd/zap_spec.rb @@ -23,8 +23,8 @@ describe Cask::Cmd::Zap, :cask do described_class.run("local-caffeine", "local-transmission") expect(caffeine).not_to be_installed - expect(Cask::Config.global.appdir.join("Caffeine.app")).not_to be_a_symlink + expect(caffeine.config.appdir.join("Caffeine.app")).not_to be_a_symlink expect(transmission).not_to be_installed - expect(Cask::Config.global.appdir.join("Transmission.app")).not_to be_a_symlink + expect(transmission.config.appdir.join("Transmission.app")).not_to be_a_symlink end end diff --git a/Library/Homebrew/test/cask/dsl_spec.rb b/Library/Homebrew/test/cask/dsl_spec.rb index 0532907f08..d26f237e27 100644 --- a/Library/Homebrew/test/cask/dsl_spec.rb +++ b/Library/Homebrew/test/cask/dsl_spec.rb @@ -468,7 +468,7 @@ describe Cask::DSL, :cask do let(:token) { "appdir-interpolation" } it "is allowed" do - expect(cask.artifacts.first.source).to eq(Cask::Config.global.appdir/"some/path") + expect(cask.artifacts.first.source).to eq(cask.config.appdir/"some/path") end end diff --git a/Library/Homebrew/test/cask/installer_spec.rb b/Library/Homebrew/test/cask/installer_spec.rb index ac19ed13bd..b9fbbf9171 100644 --- a/Library/Homebrew/test/cask/installer_spec.rb +++ b/Library/Homebrew/test/cask/installer_spec.rb @@ -10,7 +10,7 @@ describe Cask::Installer, :cask do Cask::Installer.new(caffeine).install expect(Cask::Caskroom.path.join("local-caffeine", caffeine.version)).to be_a_directory - expect(Cask::Config.global.appdir.join("Caffeine.app")).to be_a_directory + expect(caffeine.config.appdir.join("Caffeine.app")).to be_a_directory end it "works with dmg-based Casks" do @@ -19,7 +19,7 @@ describe Cask::Installer, :cask do Cask::Installer.new(asset).install expect(Cask::Caskroom.path.join("container-dmg", asset.version)).to be_a_directory - expect(Cask::Config.global.appdir.join("container")).to be_a_file + expect(asset.config.appdir.join("container")).to be_a_file end it "works with tar-gz-based Casks" do @@ -28,7 +28,7 @@ describe Cask::Installer, :cask do Cask::Installer.new(asset).install expect(Cask::Caskroom.path.join("container-tar-gz", asset.version)).to be_a_directory - expect(Cask::Config.global.appdir.join("container")).to be_a_file + expect(asset.config.appdir.join("container")).to be_a_file end it "works with xar-based Casks" do @@ -37,7 +37,7 @@ describe Cask::Installer, :cask do Cask::Installer.new(asset).install expect(Cask::Caskroom.path.join("container-xar", asset.version)).to be_a_directory - expect(Cask::Config.global.appdir.join("container")).to be_a_file + expect(asset.config.appdir.join("container")).to be_a_file end it "works with pure bzip2-based Casks" do @@ -46,7 +46,7 @@ describe Cask::Installer, :cask do Cask::Installer.new(asset).install expect(Cask::Caskroom.path.join("container-bzip2", asset.version)).to be_a_directory - expect(Cask::Config.global.appdir.join("container")).to be_a_file + expect(asset.config.appdir.join("container")).to be_a_file end it "works with pure gzip-based Casks" do @@ -55,7 +55,7 @@ describe Cask::Installer, :cask do Cask::Installer.new(asset).install expect(Cask::Caskroom.path.join("container-gzip", asset.version)).to be_a_directory - expect(Cask::Config.global.appdir.join("container")).to be_a_file + expect(asset.config.appdir.join("container")).to be_a_file end it "blows up on a bad checksum" do diff --git a/Library/Homebrew/test/cask/quarantine_spec.rb b/Library/Homebrew/test/cask/quarantine_spec.rb index b56818e228..c46706b00b 100644 --- a/Library/Homebrew/test/cask/quarantine_spec.rb +++ b/Library/Homebrew/test/cask/quarantine_spec.rb @@ -11,13 +11,11 @@ describe Cask::Quarantine, :cask do it "quarantines a nice fresh Cask" do Cask::Cmd::Install.run("local-transmission") - expect( - Cask::CaskLoader.load(cask_path("local-transmission")), - ).to be_installed + cask = Cask::CaskLoader.load(cask_path("local-transmission")) - expect( - Cask::Config.global.appdir.join("Transmission.app"), - ).to be_quarantined + expect(cask).to be_installed + + expect(cask.config.appdir.join("Transmission.app")).to be_quarantined end it "quarantines Cask fetches" do @@ -42,83 +40,81 @@ describe Cask::Quarantine, :cask do Cask::Cmd::Install.run("local-transmission") - expect( - Cask::CaskLoader.load(cask_path("local-transmission")), - ).to be_installed + cask = Cask::CaskLoader.load(cask_path("local-transmission")) - expect(Cask::Config.global.appdir.join("Transmission.app")).to be_quarantined + expect(cask).to be_installed + + expect(cask.config.appdir.join("Transmission.app")).to be_quarantined end it "quarantines dmg-based Casks" do Cask::Cmd::Install.run("container-dmg") - expect( - Cask::CaskLoader.load(cask_path("container-dmg")), - ).to be_installed + cask = Cask::CaskLoader.load(cask_path("container-dmg")) - expect(Cask::Config.global.appdir.join("container")).to be_quarantined + expect(cask).to be_installed + + expect(cask.config.appdir.join("container")).to be_quarantined end it "quarantines tar-gz-based Casks" do Cask::Cmd::Install.run("container-tar-gz") - expect( - Cask::CaskLoader.load(cask_path("container-tar-gz")), - ).to be_installed + cask = Cask::CaskLoader.load(cask_path("container-tar-gz")) - expect(Cask::Config.global.appdir.join("container")).to be_quarantined + expect(cask).to be_installed + + expect(cask.config.appdir.join("container")).to be_quarantined end it "quarantines xar-based Casks" do Cask::Cmd::Install.run("container-xar") - expect( - Cask::CaskLoader.load(cask_path("container-xar")), - ).to be_installed + cask = Cask::CaskLoader.load(cask_path("container-xar")) - expect(Cask::Config.global.appdir.join("container")).to be_quarantined + expect(cask).to be_installed + + expect(cask.config.appdir.join("container")).to be_quarantined end it "quarantines pure bzip2-based Casks" do Cask::Cmd::Install.run("container-bzip2") - expect( - Cask::CaskLoader.load(cask_path("container-bzip2")), - ).to be_installed + cask = Cask::CaskLoader.load(cask_path("container-bzip2")) - expect(Cask::Config.global.appdir.join("container")).to be_quarantined + expect(cask).to be_installed + + expect(cask.config.appdir.join("container")).to be_quarantined end it "quarantines pure gzip-based Casks" do Cask::Cmd::Install.run("container-gzip") - expect( - Cask::CaskLoader.load(cask_path("container-gzip")), - ).to be_installed + cask = Cask::CaskLoader.load(cask_path("container-gzip")) - expect(Cask::Config.global.appdir.join("container")).to be_quarantined + expect(cask).to be_installed + + expect(cask.config.appdir.join("container")).to be_quarantined end it "quarantines the pkg in naked-pkg-based Casks" do Cask::Cmd::Install.run("container-pkg") - naked_pkg = Cask::CaskLoader.load(cask_path("container-pkg")) + cask = Cask::CaskLoader.load(cask_path("container-pkg")) - expect(naked_pkg).to be_installed + expect(cask).to be_installed - expect( - Cask::Caskroom.path.join("container-pkg", naked_pkg.version, "container.pkg"), - ).to be_quarantined + expect(cask.staged_path/"container.pkg").to be_quarantined end it "quarantines a nested container" do Cask::Cmd::Install.run("nested-app") - expect( - Cask::CaskLoader.load(cask_path("nested-app")), - ).to be_installed + cask = Cask::CaskLoader.load(cask_path("nested-app")) - expect(Cask::Config.global.appdir.join("MyNestedApp.app")).to be_quarantined + expect(cask).to be_installed + + expect(cask.config.appdir.join("MyNestedApp.app")).to be_quarantined end end @@ -126,11 +122,11 @@ describe Cask::Quarantine, :cask do it "does not quarantine even a nice, fresh Cask" do Cask::Cmd::Install.run("local-transmission", "--no-quarantine") - expect( - Cask::CaskLoader.load(cask_path("local-transmission")), - ).to be_installed + cask = Cask::CaskLoader.load(cask_path("local-transmission")) - expect(Cask::Config.global.appdir.join("Transmission.app")).not_to be_quarantined + expect(cask).to be_installed + + expect(cask.config.appdir.join("Transmission.app")).not_to be_quarantined end it "does not quarantine Cask fetches" do @@ -155,61 +151,61 @@ describe Cask::Quarantine, :cask do Cask::Cmd::Install.run("local-transmission", "--no-quarantine") - expect( - Cask::CaskLoader.load(cask_path("local-transmission")), - ).to be_installed + cask = Cask::CaskLoader.load(cask_path("local-transmission")) - expect(Cask::Config.global.appdir.join("Transmission.app")).not_to be_quarantined + expect(cask).to be_installed + + expect(cask.config.appdir.join("Transmission.app")).not_to be_quarantined end it "does not quarantine dmg-based Casks" do Cask::Cmd::Install.run("container-dmg", "--no-quarantine") - expect( - Cask::CaskLoader.load(cask_path("container-dmg")), - ).to be_installed + cask = Cask::CaskLoader.load(cask_path("container-dmg")) - expect(Cask::Config.global.appdir.join("container")).not_to be_quarantined + expect(cask).to be_installed + + expect(cask.config.appdir.join("container")).not_to be_quarantined end it "does not quarantine tar-gz-based Casks" do Cask::Cmd::Install.run("container-tar-gz", "--no-quarantine") - expect( - Cask::CaskLoader.load(cask_path("container-tar-gz")), - ).to be_installed + cask = Cask::CaskLoader.load(cask_path("container-tar-gz")) - expect(Cask::Config.global.appdir.join("container")).not_to be_quarantined + expect(cask).to be_installed + + expect(cask.config.appdir.join("container")).not_to be_quarantined end it "does not quarantine xar-based Casks" do Cask::Cmd::Install.run("container-xar", "--no-quarantine") - expect( - Cask::CaskLoader.load(cask_path("container-xar")), - ).to be_installed + cask = Cask::CaskLoader.load(cask_path("container-xar")) - expect(Cask::Config.global.appdir.join("container")).not_to be_quarantined + expect(cask).to be_installed + + expect(cask.config.appdir.join("container")).not_to be_quarantined end it "does not quarantine pure bzip2-based Casks" do Cask::Cmd::Install.run("container-bzip2", "--no-quarantine") - expect( - Cask::CaskLoader.load(cask_path("container-bzip2")), - ).to be_installed + cask = Cask::CaskLoader.load(cask_path("container-bzip2")) - expect(Cask::Config.global.appdir.join("container")).not_to be_quarantined + expect(cask).to be_installed + + expect(cask.config.appdir.join("container")).not_to be_quarantined end it "does not quarantine pure gzip-based Casks" do Cask::Cmd::Install.run("container-gzip", "--no-quarantine") - expect( - Cask::CaskLoader.load(cask_path("container-gzip")), - ).to be_installed + cask = Cask::CaskLoader.load(cask_path("container-gzip")) - expect(Cask::Config.global.appdir.join("container")).not_to be_quarantined + expect(cask).to be_installed + + expect(cask.config.appdir.join("container")).not_to be_quarantined end it "does not quarantine the pkg in naked-pkg-based Casks" do @@ -227,11 +223,11 @@ describe Cask::Quarantine, :cask do it "does not quarantine a nested container" do Cask::Cmd::Install.run("nested-app", "--no-quarantine") - expect( - Cask::CaskLoader.load(cask_path("nested-app")), - ).to be_installed + cask = Cask::CaskLoader.load(cask_path("nested-app")) - expect(Cask::Config.global.appdir.join("MyNestedApp.app")).not_to be_quarantined + expect(cask).to be_installed + + expect(cask.config.appdir.join("MyNestedApp.app")).not_to be_quarantined end end end diff --git a/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb b/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb index f4432f5f06..bb228b66b4 100644 --- a/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb +++ b/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb @@ -14,7 +14,7 @@ HOMEBREW_CASK_DIRS = { RSpec.shared_context "Homebrew Cask", :needs_macos do before do HOMEBREW_CASK_DIRS.each do |method, path| - allow(Cask::Config.global).to receive(method).and_return(path) + Cask::Config.global.send("#{method}=", path) end end From fda6e0cab3901978f632358295db4a62413fd281 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 3 Feb 2019 02:40:27 +0100 Subject: [PATCH 169/199] Split cask config into three tiers. --- Library/Homebrew/cask/cmd.rb | 10 +-- Library/Homebrew/cask/config.rb | 79 ++++++++++++++----- .../Homebrew/test/cask/cmd/options_spec.rb | 30 ------- Library/Homebrew/test/cask/cmd_spec.rb | 4 +- .../spec/shared_context/homebrew_cask.rb | 40 ++++++---- 5 files changed, 90 insertions(+), 73 deletions(-) diff --git a/Library/Homebrew/cask/cmd.rb b/Library/Homebrew/cask/cmd.rb index a064a30333..f40b55d599 100644 --- a/Library/Homebrew/cask/cmd.rb +++ b/Library/Homebrew/cask/cmd.rb @@ -186,16 +186,14 @@ module Cask end def process_options(*args) - all_args = Shellwords.shellsplit(ENV["HOMEBREW_CASK_OPTS"] || "") + args - non_options = [] - if idx = all_args.index("--") - non_options += all_args.drop(idx) - all_args = all_args.first(idx) + if idx = args.index("--") + non_options += args.drop(idx) + args = args.first(idx) end - remaining = all_args.select do |arg| + remaining = args.select do |arg| begin !process_arguments([arg]).empty? rescue OptionParser::InvalidOption, OptionParser::MissingArgument, OptionParser::AmbiguousOption diff --git a/Library/Homebrew/cask/config.rb b/Library/Homebrew/cask/config.rb index ed40737b47..5eea14c647 100644 --- a/Library/Homebrew/cask/config.rb +++ b/Library/Homebrew/cask/config.rb @@ -1,27 +1,34 @@ require "json" +require "extend/hash_validator" +using HashValidator + module Cask - class Config < DelegateClass(Hash) + class Config DEFAULT_DIRS = { - appdir: "/Applications", - prefpanedir: "~/Library/PreferencePanes", - qlplugindir: "~/Library/QuickLook", - dictionarydir: "~/Library/Dictionaries", - fontdir: "~/Library/Fonts", - colorpickerdir: "~/Library/ColorPickers", - servicedir: "~/Library/Services", - input_methoddir: "~/Library/Input Methods", - internet_plugindir: "~/Library/Internet Plug-Ins", - audio_unit_plugindir: "~/Library/Audio/Plug-Ins/Components", - vst_plugindir: "~/Library/Audio/Plug-Ins/VST", - vst3_plugindir: "~/Library/Audio/Plug-Ins/VST3", - screen_saverdir: "~/Library/Screen Savers", + appdir: Pathname("/Applications").expand_path, + prefpanedir: Pathname("~/Library/PreferencePanes").expand_path, + qlplugindir: Pathname("~/Library/QuickLook").expand_path, + dictionarydir: Pathname("~/Library/Dictionaries").expand_path, + fontdir: Pathname("~/Library/Fonts").expand_path, + colorpickerdir: Pathname("~/Library/ColorPickers").expand_path, + servicedir: Pathname("~/Library/Services").expand_path, + input_methoddir: Pathname("~/Library/Input Methods").expand_path, + internet_plugindir: Pathname("~/Library/Internet Plug-Ins").expand_path, + audio_unit_plugindir: Pathname("~/Library/Audio/Plug-Ins/Components").expand_path, + vst_plugindir: Pathname("~/Library/Audio/Plug-Ins/VST").expand_path, + vst3_plugindir: Pathname("~/Library/Audio/Plug-Ins/VST3").expand_path, + screen_saverdir: Pathname("~/Library/Screen Savers").expand_path, }.freeze def self.global @global ||= new end + def self.clear + @global = nil + end + def self.for_cask(cask) if cask.config_path.exist? from_file(cask.config_path) @@ -37,11 +44,33 @@ module Cask raise e, "Cannot parse #{path}: #{e}", e.backtrace end - new(Hash[config.map { |k, v| [k.to_sym, v] }]) + new( + default: config.fetch("default", {}).map { |k, v| [k.to_sym, Pathname(v).expand_path] }.to_h, + env: config.fetch("env", {}).map { |k, v| [k.to_sym, Pathname(v).expand_path] }.to_h, + explicit: config.fetch("explicit", {}).map { |k, v| [k.to_sym, Pathname(v).expand_path] }.to_h, + ) end - def initialize(**dirs) - super(Hash[DEFAULT_DIRS.map { |(k, v)| [k, Pathname(dirs.fetch(k, v)).expand_path] }]) + attr_accessor :explicit + + def initialize(default: nil, env: nil, explicit: {}) + env&.assert_valid_keys!(*DEFAULT_DIRS.keys) + explicit.assert_valid_keys!(*DEFAULT_DIRS.keys) + + @default = default + @env = env + @explicit = explicit.map { |(k, v)| [k.to_sym, Pathname(v).expand_path] }.to_h + end + + def default + @default ||= DEFAULT_DIRS + end + + def env + @env ||= Shellwords.shellsplit(ENV.fetch("HOMEBREW_CASK_OPTS", "")) + .map { |arg| arg.split("=", 2) } + .map { |(flag, value)| [flag.sub(/^\-\-/, "").to_sym, Pathname(value).expand_path] } + .to_h end def binarydir @@ -50,14 +79,26 @@ module Cask DEFAULT_DIRS.keys.each do |dir| define_method(dir) do - self[dir] + explicit.fetch(dir, env.fetch(dir, default.fetch(dir))) end define_method(:"#{dir}=") do |path| - self[dir] = Pathname(path).expand_path + explicit[dir] = Pathname(path).expand_path end end + def merge(other) + self.class.new(**other.explicit.merge(explicit)) + end + + def to_json(*args) + { + default: default, + env: env, + explicit: explicit, + }.to_json(*args) + end + def write(path) path.atomic_write(to_json) end diff --git a/Library/Homebrew/test/cask/cmd/options_spec.rb b/Library/Homebrew/test/cask/cmd/options_spec.rb index ec565b57fc..0f254573f6 100644 --- a/Library/Homebrew/test/cask/cmd/options_spec.rb +++ b/Library/Homebrew/test/cask/cmd/options_spec.rb @@ -1,15 +1,11 @@ describe Cask::Cmd, :cask do it "supports setting the appdir" do - allow(Cask::Config.global).to receive(:appdir).and_call_original - described_class.new.process_options("help", "--appdir=/some/path/foo") expect(Cask::Config.global.appdir).to eq(Pathname.new("/some/path/foo")) end it "supports setting the appdir from ENV" do - allow(Cask::Config.global).to receive(:appdir).and_call_original - ENV["HOMEBREW_CASK_OPTS"] = "--appdir=/some/path/bar" described_class.new.process_options("help") @@ -18,16 +14,12 @@ describe Cask::Cmd, :cask do end it "supports setting the prefpanedir" do - allow(Cask::Config.global).to receive(:prefpanedir).and_call_original - described_class.new.process_options("help", "--prefpanedir=/some/path/foo") expect(Cask::Config.global.prefpanedir).to eq(Pathname.new("/some/path/foo")) end it "supports setting the prefpanedir from ENV" do - allow(Cask::Config.global).to receive(:prefpanedir).and_call_original - ENV["HOMEBREW_CASK_OPTS"] = "--prefpanedir=/some/path/bar" described_class.new.process_options("help") @@ -36,16 +28,12 @@ describe Cask::Cmd, :cask do end it "supports setting the qlplugindir" do - allow(Cask::Config.global).to receive(:qlplugindir).and_call_original - described_class.new.process_options("help", "--qlplugindir=/some/path/foo") expect(Cask::Config.global.qlplugindir).to eq(Pathname.new("/some/path/foo")) end it "supports setting the qlplugindir from ENV" do - allow(Cask::Config.global).to receive(:qlplugindir).and_call_original - ENV["HOMEBREW_CASK_OPTS"] = "--qlplugindir=/some/path/bar" described_class.new.process_options("help") @@ -54,16 +42,12 @@ describe Cask::Cmd, :cask do end it "supports setting the colorpickerdir" do - allow(Cask::Config.global).to receive(:colorpickerdir).and_call_original - described_class.new.process_options("help", "--colorpickerdir=/some/path/foo") expect(Cask::Config.global.colorpickerdir).to eq(Pathname.new("/some/path/foo")) end it "supports setting the colorpickerdir from ENV" do - allow(Cask::Config.global).to receive(:colorpickerdir).and_call_original - ENV["HOMEBREW_CASK_OPTS"] = "--colorpickerdir=/some/path/bar" described_class.new.process_options("help") @@ -72,16 +56,12 @@ describe Cask::Cmd, :cask do end it "supports setting the dictionarydir" do - allow(Cask::Config.global).to receive(:dictionarydir).and_call_original - described_class.new.process_options("help", "--dictionarydir=/some/path/foo") expect(Cask::Config.global.dictionarydir).to eq(Pathname.new("/some/path/foo")) end it "supports setting the dictionarydir from ENV" do - allow(Cask::Config.global).to receive(:dictionarydir).and_call_original - ENV["HOMEBREW_CASK_OPTS"] = "--dictionarydir=/some/path/bar" described_class.new.process_options("help") @@ -90,16 +70,12 @@ describe Cask::Cmd, :cask do end it "supports setting the fontdir" do - allow(Cask::Config.global).to receive(:fontdir).and_call_original - described_class.new.process_options("help", "--fontdir=/some/path/foo") expect(Cask::Config.global.fontdir).to eq(Pathname.new("/some/path/foo")) end it "supports setting the fontdir from ENV" do - allow(Cask::Config.global).to receive(:fontdir).and_call_original - ENV["HOMEBREW_CASK_OPTS"] = "--fontdir=/some/path/bar" described_class.new.process_options("help") @@ -108,16 +84,12 @@ describe Cask::Cmd, :cask do end it "supports setting the servicedir" do - allow(Cask::Config.global).to receive(:servicedir).and_call_original - described_class.new.process_options("help", "--servicedir=/some/path/foo") expect(Cask::Config.global.servicedir).to eq(Pathname.new("/some/path/foo")) end it "supports setting the servicedir from ENV" do - allow(Cask::Config.global).to receive(:servicedir).and_call_original - ENV["HOMEBREW_CASK_OPTS"] = "--servicedir=/some/path/bar" described_class.new.process_options("help") @@ -126,8 +98,6 @@ describe Cask::Cmd, :cask do end it "allows additional options to be passed through" do - allow(Cask::Config.global).to receive(:appdir).and_call_original - rest = described_class.new.process_options("edit", "foo", "--create", "--appdir=/some/path/qux") expect(Cask::Config.global.appdir).to eq(Pathname.new("/some/path/qux")) diff --git a/Library/Homebrew/test/cask/cmd_spec.rb b/Library/Homebrew/test/cask/cmd_spec.rb index 987fa2ecb9..ee2a68fd46 100644 --- a/Library/Homebrew/test/cask/cmd_spec.rb +++ b/Library/Homebrew/test/cask/cmd_spec.rb @@ -56,9 +56,7 @@ describe Cask::Cmd, :cask do end it "respects the env variable when choosing what appdir to create" do - allow(ENV).to receive(:[]).and_call_original - allow(ENV).to receive(:[]).with("HOMEBREW_CASK_OPTS").and_return("--appdir=/custom/appdir") - allow(Cask::Config.global).to receive(:appdir).and_call_original + ENV["HOMEBREW_CASK_OPTS"] = "--appdir=/custom/appdir" described_class.run("noop") diff --git a/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb b/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb index bb228b66b4..06285c5969 100644 --- a/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb +++ b/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb @@ -4,25 +4,34 @@ require "test/support/helper/cask/fake_system_command" require "test/support/helper/cask/install_helper" require "test/support/helper/cask/never_sudo_system_command" -HOMEBREW_CASK_DIRS = { - appdir: Pathname.new(TEST_TMPDIR).join("cask-appdir"), - prefpanedir: Pathname.new(TEST_TMPDIR).join("cask-prefpanedir"), - qlplugindir: Pathname.new(TEST_TMPDIR).join("cask-qlplugindir"), - servicedir: Pathname.new(TEST_TMPDIR).join("cask-servicedir"), -}.freeze +module Cask + class Config + remove_const :DEFAULT_DIRS + + DEFAULT_DIRS = { + appdir: Pathname.new(TEST_TMPDIR).join("cask-appdir"), + prefpanedir: Pathname.new(TEST_TMPDIR).join("cask-prefpanedir"), + qlplugindir: Pathname.new(TEST_TMPDIR).join("cask-qlplugindir"), + dictionarydir: Pathname.new(TEST_TMPDIR).join("cask-dictionarydir"), + fontdir: Pathname.new(TEST_TMPDIR).join("cask-fontdir"), + colorpickerdir: Pathname.new(TEST_TMPDIR).join("cask-colorpickerdir"), + servicedir: Pathname.new(TEST_TMPDIR).join("cask-servicedir"), + input_methoddir: Pathname.new(TEST_TMPDIR).join("cask-input_methoddir"), + internet_plugindir: Pathname.new(TEST_TMPDIR).join("cask-internet_plugindir"), + audio_unit_plugindir: Pathname.new(TEST_TMPDIR).join("cask-audio_unit_plugindir"), + vst_plugindir: Pathname.new(TEST_TMPDIR).join("cask-vst_plugindir"), + vst3_plugindir: Pathname.new(TEST_TMPDIR).join("cask-vst3_plugindir"), + screen_saverdir: Pathname.new(TEST_TMPDIR).join("cask-screen_saverdir"), + }.freeze + end +end RSpec.shared_context "Homebrew Cask", :needs_macos do - before do - HOMEBREW_CASK_DIRS.each do |method, path| - Cask::Config.global.send("#{method}=", path) - end - end - around do |example| third_party_tap = Tap.fetch("third-party", "tap") - begin - HOMEBREW_CASK_DIRS.values.each(&:mkpath) + begin + Cask::Config::DEFAULT_DIRS.values.each(&:mkpath) Cask::Config.global.binarydir.mkpath Tap.default_cask_tap.tap do |tap| @@ -37,11 +46,12 @@ RSpec.shared_context "Homebrew Cask", :needs_macos do example.run ensure - FileUtils.rm_rf HOMEBREW_CASK_DIRS.values + FileUtils.rm_rf Cask::Config::DEFAULT_DIRS.values FileUtils.rm_rf [Cask::Config.global.binarydir, Cask::Caskroom.path, Cask::Cache.path] Tap.default_cask_tap.path.unlink third_party_tap.path.unlink FileUtils.rm_rf third_party_tap.path.parent + Cask::Config.clear end end end From 190ff7558af37c4d2e76323482d38b3c1fc4f47c Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 3 Feb 2019 13:03:16 +0100 Subject: [PATCH 170/199] Use saved cask config for reinstall/upgrade/uninstall. --- .../cask/artifact/abstract_artifact.rb | 7 +++-- Library/Homebrew/cask/cask.rb | 26 ++++++++++++------- Library/Homebrew/cask/cmd/upgrade.rb | 8 +++++- Library/Homebrew/cask/config.rb | 2 +- Library/Homebrew/cask/dsl.rb | 3 +-- Library/Homebrew/cask/installer.rb | 6 +++++ .../test/cask/artifact/installer_spec.rb | 2 +- Library/Homebrew/test/cask/cmd/audit_spec.rb | 2 +- 8 files changed, 38 insertions(+), 18 deletions(-) diff --git a/Library/Homebrew/cask/artifact/abstract_artifact.rb b/Library/Homebrew/cask/artifact/abstract_artifact.rb index f8ceb22001..66dea2b617 100644 --- a/Library/Homebrew/cask/artifact/abstract_artifact.rb +++ b/Library/Homebrew/cask/artifact/abstract_artifact.rb @@ -94,11 +94,14 @@ module Cask [executable, arguments] end - attr_reader :cask, :config + attr_reader :cask def initialize(cask) @cask = cask - @config = cask.config + end + + def config + cask.config end def to_s diff --git a/Library/Homebrew/cask/cask.rb b/Library/Homebrew/cask/cask.rb index 4336cff60a..cfeef216b7 100644 --- a/Library/Homebrew/cask/cask.rb +++ b/Library/Homebrew/cask/cask.rb @@ -11,7 +11,7 @@ module Cask extend Searchable include Metadata - attr_reader :token, :sourcefile_path + attr_reader :token, :sourcefile_path, :config def self.each return to_enum unless block_given? @@ -31,15 +31,21 @@ module Cask @tap end - def initialize(token, sourcefile_path: nil, tap: nil, config: nil, &block) + def initialize(token, sourcefile_path: nil, tap: nil, &block) @token = token @sourcefile_path = sourcefile_path @tap = tap - @config = config - @dsl = DSL.new(self) - return unless block_given? + @block = block + self.config = Config.for_cask(self) + end - @dsl.instance_eval(&block) + def config=(config) + @config = config + + @dsl = DSL.new(self) + return unless @block + + @dsl.instance_eval(&@block) @dsl.language_eval end @@ -77,14 +83,14 @@ module Cask metadata_master_container_path.join(*installed_version, "Casks", "#{token}.rb") end - def config - @config ||= Config.for_cask(self) - end - def config_path metadata_master_container_path/"dirs.json" end + def caskroom_path + @caskroom_path ||= Caskroom.path.join(token) + end + def outdated?(greedy = false) !outdated_versions(greedy).empty? end diff --git a/Library/Homebrew/cask/cmd/upgrade.rb b/Library/Homebrew/cask/cmd/upgrade.rb index d12a03630e..06e880bd12 100644 --- a/Library/Homebrew/cask/cmd/upgrade.rb +++ b/Library/Homebrew/cask/cmd/upgrade.rb @@ -1,3 +1,5 @@ +require "cask/config" + module Cask class Cmd class Upgrade < AbstractCommand @@ -44,13 +46,17 @@ module Cask old_cask = CaskLoader.load(old_cask.installed_caskfile) + old_config = old_cask.config + old_cask_installer = Installer.new(old_cask, binaries: binaries?, verbose: verbose?, force: force?, upgrade: true) - new_cask = CaskLoader.load(old_cask.to_s) + new_cask = CaskLoader.load(old_cask.token) + + new_cask.config = Config.global.merge(old_config) new_cask_installer = Installer.new(new_cask, binaries: binaries?, diff --git a/Library/Homebrew/cask/config.rb b/Library/Homebrew/cask/config.rb index 5eea14c647..082afd3a71 100644 --- a/Library/Homebrew/cask/config.rb +++ b/Library/Homebrew/cask/config.rb @@ -88,7 +88,7 @@ module Cask end def merge(other) - self.class.new(**other.explicit.merge(explicit)) + self.class.new(explicit: other.explicit.merge(explicit)) end def to_json(*args) diff --git a/Library/Homebrew/cask/dsl.rb b/Library/Homebrew/cask/dsl.rb index 45ce56be56..5a9b540a6b 100644 --- a/Library/Homebrew/cask/dsl.rb +++ b/Library/Homebrew/cask/dsl.rb @@ -57,7 +57,6 @@ module Cask :appcast, :artifacts, :auto_updates, - :caskroom_path, :caveats, :conflicts_with, :container, @@ -226,7 +225,7 @@ module Cask end def caskroom_path - @caskroom_path ||= Caskroom.path.join(token) + @cask.caskroom_path end def staged_path diff --git a/Library/Homebrew/cask/installer.rb b/Library/Homebrew/cask/installer.rb index 74f1664972..78c7aa3f4a 100644 --- a/Library/Homebrew/cask/installer.rb +++ b/Library/Homebrew/cask/installer.rb @@ -4,6 +4,7 @@ require "formula_installer" require "unpack_strategy" require "cask/cask_dependencies" +require "cask/config" require "cask/download" require "cask/staged" require "cask/verify" @@ -79,6 +80,8 @@ module Cask def install odebug "Cask::Installer#install" + old_config = @cask.config + if @cask.installed? && !force? && !reinstall? && !upgrade? raise CaskAlreadyInstalledError, @cask end @@ -92,6 +95,9 @@ module Cask oh1 "Installing Cask #{Formatter.identifier(@cask)}" opoo "macOS's Gatekeeper has been disabled for this Cask" unless quarantine? stage + + @cask.config = Config.global.merge(old_config) + install_artifacts unless @cask.tap&.private? diff --git a/Library/Homebrew/test/cask/artifact/installer_spec.rb b/Library/Homebrew/test/cask/artifact/installer_spec.rb index d2aab5ba5d..8952fd6152 100644 --- a/Library/Homebrew/test/cask/artifact/installer_spec.rb +++ b/Library/Homebrew/test/cask/artifact/installer_spec.rb @@ -2,7 +2,7 @@ describe Cask::Artifact::Installer, :cask do subject(:installer) { described_class.new(cask, **args) } let(:staged_path) { mktmpdir } - let(:cask) { instance_double(Cask::Cask, staged_path: staged_path, config: nil) } + let(:cask) { instance_double(Cask::Cask, staged_path: staged_path) } let(:command) { SystemCommand } diff --git a/Library/Homebrew/test/cask/cmd/audit_spec.rb b/Library/Homebrew/test/cask/cmd/audit_spec.rb index b3b818a834..529019b0ca 100644 --- a/Library/Homebrew/test/cask/cmd/audit_spec.rb +++ b/Library/Homebrew/test/cask/cmd/audit_spec.rb @@ -1,7 +1,7 @@ require_relative "shared_examples/invalid_option" describe Cask::Cmd::Audit, :cask do - let(:cask) { Cask::Cask.new(nil) } + let(:cask) { Cask::Cask.new("cask") } it_behaves_like "a command that handles invalid options" From 707cb33346c0116c3607483a381422855582415a Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 3 Feb 2019 15:57:51 +0100 Subject: [PATCH 171/199] Add tests for `Cask::Config`. --- Library/Homebrew/test/cask/config_spec.rb | 51 +++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Library/Homebrew/test/cask/config_spec.rb diff --git a/Library/Homebrew/test/cask/config_spec.rb b/Library/Homebrew/test/cask/config_spec.rb new file mode 100644 index 0000000000..f160104bbe --- /dev/null +++ b/Library/Homebrew/test/cask/config_spec.rb @@ -0,0 +1,51 @@ +describe Cask::Config, :cask do + subject(:config) { described_class.new } + + describe "#default" do + it "returns the default directories" do + expect(config.default[:appdir]).to eq(Pathname(TEST_TMPDIR).join("cask-appdir")) + end + end + + describe "#appdir" do + it "returns the default value if no HOMEBREW_CASK_OPTS is unset" do + expect(config.appdir).to eq(Pathname(TEST_TMPDIR).join("cask-appdir")) + end + + specify "environment overwrites default" do + ENV["HOMEBREW_CASK_OPTS"] = "--appdir=/path/to/apps" + + expect(config.appdir).to eq(Pathname("/path/to/apps")) + end + + specify "specific overwrites default" do + config = described_class.new(explicit: { appdir: "/explicit/path/to/apps" }) + + expect(config.appdir).to eq(Pathname("/explicit/path/to/apps")) + end + + specify "explicit overwrites environment" do + ENV["HOMEBREW_CASK_OPTS"] = "--appdir=/path/to/apps" + + config = described_class.new(explicit: { appdir: "/explicit/path/to/apps" }) + + expect(config.appdir).to eq(Pathname("/explicit/path/to/apps")) + end + end + + describe "#env" do + it "returns directories specified with the HOMEBREW_CASK_OPTS variable" do + ENV["HOMEBREW_CASK_OPTS"] = "--appdir=/path/to/apps" + + expect(config.env).to eq(appdir: Pathname("/path/to/apps")) + end + end + + describe "#explicit" do + let(:config) { described_class.new(explicit: { appdir: "/explicit/path/to/apps" }) } + + it "returns directories explicitly given as arguments" do + expect(config.explicit[:appdir]).to eq(Pathname("/explicit/path/to/apps")) + end + end +end From defbf7d74c0c47ccecfef073dc80d89d5b185306 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 3 Feb 2019 17:41:51 +0100 Subject: [PATCH 172/199] =?UTF-8?q?Don=E2=80=99t=20ignore=20other=20argume?= =?UTF-8?q?nts=20in=20`HOMEBREW=5FCASK=5FOPTS`.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Library/Homebrew/cask/cmd.rb | 13 +++++++++---- Library/Homebrew/cask/config.rb | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/cask/cmd.rb b/Library/Homebrew/cask/cmd.rb index f40b55d599..5a1c65b2e0 100644 --- a/Library/Homebrew/cask/cmd.rb +++ b/Library/Homebrew/cask/cmd.rb @@ -186,14 +186,19 @@ module Cask end def process_options(*args) + exclude_regex = /^\-\-#{Regexp.union(*Config::DEFAULT_DIRS.keys.map(&Regexp.public_method(:escape)))}=/ + + all_args = Shellwords.shellsplit(ENV.fetch("HOMEBREW_CASK_OPTS", "")) + .reject { |arg| arg.match?(exclude_regex) } + args + non_options = [] - if idx = args.index("--") - non_options += args.drop(idx) - args = args.first(idx) + if idx = all_args.index("--") + non_options += all_args.drop(idx) + all_args = all_args.first(idx) end - remaining = args.select do |arg| + remaining = all_args.select do |arg| begin !process_arguments([arg]).empty? rescue OptionParser::InvalidOption, OptionParser::MissingArgument, OptionParser::AmbiguousOption diff --git a/Library/Homebrew/cask/config.rb b/Library/Homebrew/cask/config.rb index 082afd3a71..a575bf27da 100644 --- a/Library/Homebrew/cask/config.rb +++ b/Library/Homebrew/cask/config.rb @@ -68,6 +68,7 @@ module Cask def env @env ||= Shellwords.shellsplit(ENV.fetch("HOMEBREW_CASK_OPTS", "")) + .select { |arg| arg.include?("=") } .map { |arg| arg.split("=", 2) } .map { |(flag, value)| [flag.sub(/^\-\-/, "").to_sym, Pathname(value).expand_path] } .to_h From bcdb4a3f3273eb63076c6714500469767efdf688 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 5 Feb 2019 16:08:29 +0100 Subject: [PATCH 173/199] Add `Cask::Config::canonicalize`. --- Library/Homebrew/cask/config.rb | 59 ++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/Library/Homebrew/cask/config.rb b/Library/Homebrew/cask/config.rb index a575bf27da..eba5ecfe0b 100644 --- a/Library/Homebrew/cask/config.rb +++ b/Library/Homebrew/cask/config.rb @@ -6,19 +6,19 @@ using HashValidator module Cask class Config DEFAULT_DIRS = { - appdir: Pathname("/Applications").expand_path, - prefpanedir: Pathname("~/Library/PreferencePanes").expand_path, - qlplugindir: Pathname("~/Library/QuickLook").expand_path, - dictionarydir: Pathname("~/Library/Dictionaries").expand_path, - fontdir: Pathname("~/Library/Fonts").expand_path, - colorpickerdir: Pathname("~/Library/ColorPickers").expand_path, - servicedir: Pathname("~/Library/Services").expand_path, - input_methoddir: Pathname("~/Library/Input Methods").expand_path, - internet_plugindir: Pathname("~/Library/Internet Plug-Ins").expand_path, - audio_unit_plugindir: Pathname("~/Library/Audio/Plug-Ins/Components").expand_path, - vst_plugindir: Pathname("~/Library/Audio/Plug-Ins/VST").expand_path, - vst3_plugindir: Pathname("~/Library/Audio/Plug-Ins/VST3").expand_path, - screen_saverdir: Pathname("~/Library/Screen Savers").expand_path, + appdir: "/Applications", + prefpanedir: "~/Library/PreferencePanes", + qlplugindir: "~/Library/QuickLook", + dictionarydir: "~/Library/Dictionaries", + fontdir: "~/Library/Fonts", + colorpickerdir: "~/Library/ColorPickers", + servicedir: "~/Library/Services", + input_methoddir: "~/Library/Input Methods", + internet_plugindir: "~/Library/Internet Plug-Ins", + audio_unit_plugindir: "~/Library/Audio/Plug-Ins/Components", + vst_plugindir: "~/Library/Audio/Plug-Ins/VST", + vst3_plugindir: "~/Library/Audio/Plug-Ins/VST3", + screen_saverdir: "~/Library/Screen Savers", }.freeze def self.global @@ -45,33 +45,38 @@ module Cask end new( - default: config.fetch("default", {}).map { |k, v| [k.to_sym, Pathname(v).expand_path] }.to_h, - env: config.fetch("env", {}).map { |k, v| [k.to_sym, Pathname(v).expand_path] }.to_h, - explicit: config.fetch("explicit", {}).map { |k, v| [k.to_sym, Pathname(v).expand_path] }.to_h, + default: config.fetch("default", {}), + env: config.fetch("env", {}), + explicit: config.fetch("explicit", {}), ) end + def self.canonicalize(config) + config.map { |k, v| [k.to_sym, Pathname(v).expand_path] }.to_h + end + attr_accessor :explicit def initialize(default: nil, env: nil, explicit: {}) - env&.assert_valid_keys!(*DEFAULT_DIRS.keys) - explicit.assert_valid_keys!(*DEFAULT_DIRS.keys) + @default = self.class.canonicalize(default) if default + @env = self.class.canonicalize(env) if env + @explicit = self.class.canonicalize(explicit) - @default = default - @env = env - @explicit = explicit.map { |(k, v)| [k.to_sym, Pathname(v).expand_path] }.to_h + @env&.assert_valid_keys!(*DEFAULT_DIRS.keys) + @explicit.assert_valid_keys!(*DEFAULT_DIRS.keys) end def default - @default ||= DEFAULT_DIRS + @default ||= self.class.canonicalize(DEFAULT_DIRS) end def env - @env ||= Shellwords.shellsplit(ENV.fetch("HOMEBREW_CASK_OPTS", "")) - .select { |arg| arg.include?("=") } - .map { |arg| arg.split("=", 2) } - .map { |(flag, value)| [flag.sub(/^\-\-/, "").to_sym, Pathname(value).expand_path] } - .to_h + @env ||= self.class.canonicalize( + Shellwords.shellsplit(ENV.fetch("HOMEBREW_CASK_OPTS", "")) + .select { |arg| arg.include?("=") } + .map { |arg| arg.split("=", 2) } + .map { |(flag, value)| [flag.sub(/^\-\-/, ""), value] }, + ) end def binarydir From 4c6d0ba06994a5c67b283a02270acfd2b80f2722 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 8 Feb 2019 03:00:27 +0100 Subject: [PATCH 174/199] Rename `dirs.json` to `config.json`. --- Library/Homebrew/cask/cask.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/cask.rb b/Library/Homebrew/cask/cask.rb index cfeef216b7..68f2cd3709 100644 --- a/Library/Homebrew/cask/cask.rb +++ b/Library/Homebrew/cask/cask.rb @@ -84,7 +84,7 @@ module Cask end def config_path - metadata_master_container_path/"dirs.json" + metadata_master_container_path/"config.json" end def caskroom_path From 3bf7e5bce572e22734a727f27c952df2116933bb Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 9 Feb 2019 02:19:01 +0100 Subject: [PATCH 175/199] Remove `Cask::Config#write`. --- Library/Homebrew/cask/config.rb | 4 ---- Library/Homebrew/cask/installer.rb | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Library/Homebrew/cask/config.rb b/Library/Homebrew/cask/config.rb index eba5ecfe0b..404370e689 100644 --- a/Library/Homebrew/cask/config.rb +++ b/Library/Homebrew/cask/config.rb @@ -104,9 +104,5 @@ module Cask explicit: explicit, }.to_json(*args) end - - def write(path) - path.atomic_write(to_json) - end end end diff --git a/Library/Homebrew/cask/installer.rb b/Library/Homebrew/cask/installer.rb index 78c7aa3f4a..88b8e83193 100644 --- a/Library/Homebrew/cask/installer.rb +++ b/Library/Homebrew/cask/installer.rb @@ -391,7 +391,7 @@ module Cask end def save_config_file - @cask.config.write(@cask.config_path) + @cask.config_path.atomic_write(@cask.config.to_json) end def uninstall From 78d4373543235d6822314c895785de0b5e582e90 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 9 Feb 2019 02:39:04 +0100 Subject: [PATCH 176/199] Simplify `DEFAULT_DIRS`. --- .../spec/shared_context/homebrew_cask.rb | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb b/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb index 06285c5969..60596a8997 100644 --- a/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb +++ b/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb @@ -9,19 +9,19 @@ module Cask remove_const :DEFAULT_DIRS DEFAULT_DIRS = { - appdir: Pathname.new(TEST_TMPDIR).join("cask-appdir"), - prefpanedir: Pathname.new(TEST_TMPDIR).join("cask-prefpanedir"), - qlplugindir: Pathname.new(TEST_TMPDIR).join("cask-qlplugindir"), - dictionarydir: Pathname.new(TEST_TMPDIR).join("cask-dictionarydir"), - fontdir: Pathname.new(TEST_TMPDIR).join("cask-fontdir"), - colorpickerdir: Pathname.new(TEST_TMPDIR).join("cask-colorpickerdir"), - servicedir: Pathname.new(TEST_TMPDIR).join("cask-servicedir"), - input_methoddir: Pathname.new(TEST_TMPDIR).join("cask-input_methoddir"), - internet_plugindir: Pathname.new(TEST_TMPDIR).join("cask-internet_plugindir"), - audio_unit_plugindir: Pathname.new(TEST_TMPDIR).join("cask-audio_unit_plugindir"), - vst_plugindir: Pathname.new(TEST_TMPDIR).join("cask-vst_plugindir"), - vst3_plugindir: Pathname.new(TEST_TMPDIR).join("cask-vst3_plugindir"), - screen_saverdir: Pathname.new(TEST_TMPDIR).join("cask-screen_saverdir"), + appdir: Pathname(TEST_TMPDIR)/"cask-appdir", + prefpanedir: Pathname(TEST_TMPDIR)/"cask-prefpanedir", + qlplugindir: Pathname(TEST_TMPDIR)/"cask-qlplugindir", + dictionarydir: Pathname(TEST_TMPDIR)/"cask-dictionarydir", + fontdir: Pathname(TEST_TMPDIR)/"cask-fontdir", + colorpickerdir: Pathname(TEST_TMPDIR)/"cask-colorpickerdir", + servicedir: Pathname(TEST_TMPDIR)/"cask-servicedir", + input_methoddir: Pathname(TEST_TMPDIR)/"cask-input_methoddir", + internet_plugindir: Pathname(TEST_TMPDIR)/"cask-internet_plugindir", + audio_unit_plugindir: Pathname(TEST_TMPDIR)/"cask-audio_unit_plugindir", + vst_plugindir: Pathname(TEST_TMPDIR)/"cask-vst_plugindir", + vst3_plugindir: Pathname(TEST_TMPDIR)/"cask-vst3_plugindir", + screen_saverdir: Pathname(TEST_TMPDIR)/"cask-screen_saverdir", }.freeze end end From 31dd2ee85673420a7064cda6c1251f9ed8dd009c Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 14 Feb 2019 10:47:07 +0000 Subject: [PATCH 177/199] brew.sh: allow Docker to run as root. --- Library/Homebrew/brew.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index c24f47fcaf..c7c42a6c4d 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -350,6 +350,9 @@ fi check-run-command-as-root() { [[ "$(id -u)" = 0 ]] || return + # Allow Docker to do everything as root (as it's normal there) + [[ -f /proc/1/cgroup ]] && grep docker -q /proc/1/cgroup && return + # Homebrew Services may need `sudo` for system-wide daemons. [[ "$HOMEBREW_COMMAND" = "services" ]] && return From 019d97b4c8011d19e66197474bb4e68340b801dd Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 15 Feb 2019 10:05:10 +0000 Subject: [PATCH 178/199] Dockerfile: remove `USER linuxbrew`. This defaults to `root` but we still want to keep a Linuxbrew user on the system. --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9c7e1dfda5..bf7e85ee2a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,7 +32,6 @@ RUN cd /home/linuxbrew/.linuxbrew \ && cd /home/linuxbrew/.linuxbrew/Homebrew \ && git remote set-url origin https://github.com/Homebrew/brew -USER linuxbrew WORKDIR /home/linuxbrew ENV PATH=/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH \ SHELL=/bin/bash \ From 57fefff942e5b689de2665ca3a0b75f0c0893ce1 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 15 Feb 2019 12:33:43 +0100 Subject: [PATCH 179/199] Add `brew cask automerge` command. --- Library/Homebrew/cask/cmd.rb | 1 + Library/Homebrew/cask/cmd/automerge.rb | 115 +++++++++++++++++++++++++ Library/Homebrew/utils/github.rb | 24 +++++- 3 files changed, 136 insertions(+), 4 deletions(-) create mode 100755 Library/Homebrew/cask/cmd/automerge.rb diff --git a/Library/Homebrew/cask/cmd.rb b/Library/Homebrew/cask/cmd.rb index 5a1c65b2e0..79b0077e25 100644 --- a/Library/Homebrew/cask/cmd.rb +++ b/Library/Homebrew/cask/cmd.rb @@ -9,6 +9,7 @@ require "cask/cmd/options" require "cask/cmd/abstract_command" require "cask/cmd/audit" +require "cask/cmd/automerge" require "cask/cmd/cat" require "cask/cmd/create" require "cask/cmd/doctor" diff --git a/Library/Homebrew/cask/cmd/automerge.rb b/Library/Homebrew/cask/cmd/automerge.rb new file mode 100755 index 0000000000..66f43907fa --- /dev/null +++ b/Library/Homebrew/cask/cmd/automerge.rb @@ -0,0 +1,115 @@ +# frozen_string_literal: true + +require "cask/cmd/abstract_internal_command" +require "tap" +require "utils/formatter" +require "utils/github" + +module Cask + class Cmd + class Automerge < AbstractInternalCommand + OFFICIAL_CASK_TAPS = [ + "homebrew/cask", + "homebrew/cask-drivers", + "homebrew/cask-eid", + "homebrew/cask-fonts", + "homebrew/cask-versions", + ].freeze + + def run + raise "This command may only be run by Homebrew maintainers." unless ENV["HOMEBREW_DEVELOPER"] + + Homebrew.install_gem! "git_diff" + require "git_diff" + + failed = [] + + OFFICIAL_CASK_TAPS.each do |tap_name| + tap = Tap.fetch(tap_name) + + open_pull_requests = GitHub.pull_requests(tap.full_name, state: :open, base: "master") + + open_pull_requests.each do |pr| + next unless passed_ci(pr) + next unless check_diff(pr) + + number = pr["number"] + sha = pr.dig("head", "sha") + + print "#{Formatter.url(pr["html_url"])} " + + begin + GitHub.merge_pull_request( + tap.full_name, + number: number, sha: sha, + merge_method: :squash, + commit_message: "Squashed and auto-merged via `brew cask automerge`." + ) + puts "#{Tty.bold}#{Formatter.success("✔")}#{Tty.reset}" + rescue + puts "#{Tty.bold}#{Formatter.error("✘")}#{Tty.reset}" + failed << pr["html_url"] + end + end + end + + return if failed.empty? + $stderr.puts + raise CaskError, "Failed merging the following PRs:\n#{failed.join("\n")}" + end + + def passed_ci(pr) + statuses = GitHub.open_api(pr["statuses_url"]) + + latest_pr_status = statuses.select { |status| status["context"] == "continuous-integration/travis-ci/pr" } + .max_by { |status| Time.parse(status["updated_at"]) } + + latest_pr_status&.fetch("state") == "success" + end + + def check_diff(pr) + diff_url = pr["diff_url"] + + output, _, status = curl_output("--location", diff_url) + + return false unless status.success? + + diff = GitDiff.from_string(output) + + diff_is_single_cask(diff) && diff_only_version_or_checksum_changed(diff) + end + + def diff_is_single_cask(diff) + return false unless diff.files.count == 1 + file = diff.files.first + return false unless file.a_path == file.b_path + file.a_path.match?(%r{\ACasks/[^/]+\.rb\Z}) + end + + def diff_only_version_or_checksum_changed(diff) + lines = diff.files.flat_map(&:hunks).flat_map(&:lines) + + additions = lines.select(&:addition?) + deletions = lines.select(&:deletion?) + changed_lines = deletions + additions + + return false if additions.count != deletions.count + return false if additions.count > 2 + + changed_lines.all? { |line| diff_line_is_version(line.to_s) || diff_line_is_sha256(line.to_s) } + end + + def diff_line_is_sha256(line) + line.match?(/\A[+-]\s*sha256 '[0-9a-f]{64}'\Z/) + end + + def diff_line_is_version(line) + line.match?(/\A[+-]\s*version '[^']+'\Z/) + end + + def self.help + "automatically merge “simple” Cask pull requests" + end + end + end +end diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index 0446569797..345f5df343 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -124,9 +124,9 @@ module GitHub @api_credentials_error_message ||= begin unauthorized = (response_headers["http/1.1"] == "401 Unauthorized") scopes = response_headers["x-accepted-oauth-scopes"].to_s.split(", ") - needed_human_scopes = needed_scopes.join(", ") - needed_human_scopes = "none" if needed_human_scopes.empty? - if !unauthorized && scopes.empty? + if unauthorized && scopes.empty? + needed_human_scopes = needed_scopes.join(", ") + needed_human_scopes = "none" if needed_human_scopes.empty? credentials_scopes = response_headers["x-oauth-scopes"] case GitHub.api_credentials_type @@ -154,7 +154,7 @@ module GitHub end end - def open_api(url, data: nil, scopes: [].freeze) + def open_api(url, data: nil, request_method: nil, scopes: [].freeze) # This is a no-op if the user is opting out of using the GitHub API. return block_given? ? yield({}) : {} if ENV["HOMEBREW_NO_GITHUB_API"] @@ -184,6 +184,10 @@ module GitHub data_tmpfile.write data data_tmpfile.close args += ["--data", "@#{data_tmpfile.path}"] + + if request_method + args += ["--request", request_method.to_s] + end end args += ["--dump-header", headers_tmpfile.path] @@ -270,6 +274,18 @@ module GitHub search_issues(name, state: "open", repo: "#{tap.user}/homebrew-#{tap.repo}", in: "title") end + def pull_requests(repo, base:, state: :open, **_options) + url = "#{API_URL}/repos/#{repo}/pulls?#{URI.encode_www_form(base: base, state: state)}" + open_api(url) + end + + def merge_pull_request(repo, number:, sha:, merge_method:, commit_message: nil) + url = "#{API_URL}/repos/#{repo}/pulls/#{number}/merge" + data = { sha: sha, merge_method: merge_method } + data[:commit_message] = commit_message if commit_message + open_api(url, data: data, request_method: :PUT, scopes: CREATE_ISSUE_FORK_OR_PR_SCOPES) + end + def print_pull_requests_matching(query) open_or_closed_prs = search_issues(query, type: "pr", user: "Homebrew") From 68e0c5f904f8335d0c4e473172fecc5f09f17753 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 15 Feb 2019 16:27:19 +0100 Subject: [PATCH 180/199] Check for write access instead of `HOMEBREW_DEVELOPER`. --- Library/Homebrew/cask/cmd/automerge.rb | 9 +++++---- Library/Homebrew/utils/github.rb | 13 +++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/cask/cmd/automerge.rb b/Library/Homebrew/cask/cmd/automerge.rb index 66f43907fa..a849d2cef6 100755 --- a/Library/Homebrew/cask/cmd/automerge.rb +++ b/Library/Homebrew/cask/cmd/automerge.rb @@ -17,16 +17,17 @@ module Cask ].freeze def run - raise "This command may only be run by Homebrew maintainers." unless ENV["HOMEBREW_DEVELOPER"] + taps = OFFICIAL_CASK_TAPS.map(&Tap.public_method(:fetch)) + + access = taps.all? { |tap| GitHub.write_access?(tap.full_name) } + raise "This command may only be run by Homebrew maintainers." unless access Homebrew.install_gem! "git_diff" require "git_diff" failed = [] - OFFICIAL_CASK_TAPS.each do |tap_name| - tap = Tap.fetch(tap_name) - + taps.each do |tap| open_pull_requests = GitHub.pull_requests(tap.full_name, state: :open, base: "master") open_pull_requests.each do |pr| diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index 345f5df343..e143e9163e 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -274,6 +274,19 @@ module GitHub search_issues(name, state: "open", repo: "#{tap.user}/homebrew-#{tap.repo}", in: "title") end + def user + @user ||= open_api("#{API_URL}/user") + end + + def permission(repo, user) + open_api("#{API_URL}/repos/#{repo}/collaborators/#{user}/permission") + end + + def write_access?(repo, user = nil) + user ||= self.user["login"] + ["admin", "write"].include?(permission(repo, user)["permission"]) + end + def pull_requests(repo, base:, state: :open, **_options) url = "#{API_URL}/repos/#{repo}/pulls?#{URI.encode_www_form(base: base, state: state)}" open_api(url) From ac005fa4cecea51f519c5de9720b3150d629ae86 Mon Sep 17 00:00:00 2001 From: Ben Muschol Date: Fri, 15 Feb 2019 11:01:03 -0500 Subject: [PATCH 181/199] rename source to from, change values --- Library/Homebrew/cli_parser.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/cli_parser.rb b/Library/Homebrew/cli_parser.rb index c8616dbc4a..d4e4ebb7e1 100644 --- a/Library/Homebrew/cli_parser.rb +++ b/Library/Homebrew/cli_parser.rb @@ -59,7 +59,7 @@ module Homebrew set_constraints(name, required_for: required_for, depends_on: depends_on) end - enable_switch(*names, source: :env_var) if !env.nil? && !ENV["HOMEBREW_#{env.to_s.upcase}"].nil? + enable_switch(*names, from: :env) if !env.nil? && !ENV["HOMEBREW_#{env.to_s.upcase}"].nil? end alias switch_option switch @@ -173,9 +173,9 @@ module Homebrew private - def enable_switch(*names, source: :cli_arg) + def enable_switch(*names, from: :arg) names.each do |name| - @switch_sources[option_to_name(name)] = source + @switch_sources[option_to_name(name)] = from Homebrew.args["#{option_to_name(name)}?"] = true end end From 5d729dd310abc97b846e6e99bf7b9626864421fe Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 15 Feb 2019 17:39:20 +0000 Subject: [PATCH 182/199] formula: make JSON caveats output use consistent prefix. This will avoid this changing depending on the generation location. --- Library/Homebrew/formula.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 4cf7b26eae..01b6e6b837 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1631,7 +1631,7 @@ class Formula .uniq, "requirements" => [], "conflicts_with" => conflicts.map(&:name), - "caveats" => caveats, + "caveats" => caveats&.gsub(HOMEBREW_PREFIX, "$(brew --prefix)"), "installed" => [], "linked_keg" => linked_version&.to_s, "pinned" => pinned?, From cd03c0f86d2c0b41c06efd4b835c9feaf779e432 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 15 Feb 2019 18:48:37 +0100 Subject: [PATCH 183/199] Retry merging once after 5 seconds. --- Library/Homebrew/cask/cmd/automerge.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Library/Homebrew/cask/cmd/automerge.rb b/Library/Homebrew/cask/cmd/automerge.rb index a849d2cef6..b71083bac6 100755 --- a/Library/Homebrew/cask/cmd/automerge.rb +++ b/Library/Homebrew/cask/cmd/automerge.rb @@ -39,6 +39,8 @@ module Cask print "#{Formatter.url(pr["html_url"])} " + retried = false + begin GitHub.merge_pull_request( tap.full_name, @@ -48,6 +50,12 @@ module Cask ) puts "#{Tty.bold}#{Formatter.success("✔")}#{Tty.reset}" rescue + unless retried + retried = true + sleep 5 + retry + end + puts "#{Tty.bold}#{Formatter.error("✘")}#{Tty.reset}" failed << pr["html_url"] end From c745738c55e231c49c9e853449734db70ee9e300 Mon Sep 17 00:00:00 2001 From: Ben Muschol Date: Fri, 15 Feb 2019 14:15:34 -0500 Subject: [PATCH 184/199] Make from: required, fix flaky test --- Library/Homebrew/cli_parser.rb | 4 ++-- Library/Homebrew/test/cli_parser_spec.rb | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/cli_parser.rb b/Library/Homebrew/cli_parser.rb index d4e4ebb7e1..f35328a574 100644 --- a/Library/Homebrew/cli_parser.rb +++ b/Library/Homebrew/cli_parser.rb @@ -52,7 +52,7 @@ module Homebrew end process_option(*names, description) @parser.on(*names, *wrap_option_desc(description)) do - enable_switch(*names) + enable_switch(*names, from: :args) end names.each do |name| @@ -173,7 +173,7 @@ module Homebrew private - def enable_switch(*names, from: :arg) + def enable_switch(*names, from:) names.each do |name| @switch_sources[option_to_name(name)] = from Homebrew.args["#{option_to_name(name)}?"] = true diff --git a/Library/Homebrew/test/cli_parser_spec.rb b/Library/Homebrew/test/cli_parser_spec.rb index caaa71d78f..53504dd287 100644 --- a/Library/Homebrew/test/cli_parser_spec.rb +++ b/Library/Homebrew/test/cli_parser_spec.rb @@ -181,6 +181,7 @@ describe Homebrew::CLI::Parser do it "prioritizes cli arguments over env vars when they conflict" do allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_A").and_return("1") allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_B").and_return("0") + allow(ENV).to receive(:[]) parser.parse(["--switch-b"]) expect(Homebrew.args.switch_a?).to be_falsy expect(Homebrew.args.switch_b?).to be true From b39c5a4e84ce9efa08d19a711d20d72fb5e97acc Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Fri, 15 Feb 2019 11:18:55 -0800 Subject: [PATCH 185/199] Dockerfile: Remove environment variable USER --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index bf7e85ee2a..b7e9631220 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,8 +34,7 @@ RUN cd /home/linuxbrew/.linuxbrew \ WORKDIR /home/linuxbrew ENV PATH=/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH \ - SHELL=/bin/bash \ - USER=linuxbrew + SHELL=/bin/bash # Install portable-ruby and tap homebrew/core. RUN HOMEBREW_NO_ANALYTICS=1 HOMEBREW_NO_AUTO_UPDATE=1 brew tap homebrew/core \ From c25261a6657c8aff676f5089a095e90fc7b28b7d Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 15 Feb 2019 20:13:05 +0000 Subject: [PATCH 186/199] cmd/install: add --bottle-arch. This argument was missing when the command-line parser code was added. Fixes #5741. --- Library/Homebrew/cmd/install.rb | 3 +++ docs/Manpage.md | 2 ++ manpages/brew.1 | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 061d78ea23..0369d1d8ef 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -64,6 +64,9 @@ module Homebrew description: "Don't delete the temporary files created during installation." switch "--build-bottle", description: "Prepare the formula for eventual bottling during installation." + switch "--bottle-arch=", + description: "Optimise bottles for the given architecture rather than the oldest "\ + "architecture supported by the version of macOS the bottles are built on." switch :force, description: "Install without checking for previously installed keg-only or "\ "non-migrated versions." diff --git a/docs/Manpage.md b/docs/Manpage.md index 38adea590c..2810b35639 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -245,6 +245,8 @@ Unless `HOMEBREW_NO_INSTALL_CLEANUP` is set, `brew cleanup` will be run for the Don't delete the temporary files created during installation. * `--build-bottle`: Prepare the formula for eventual bottling during installation. +* `--bottle-arch`: + Optimise bottles for the given architecture rather than the oldest architecture supported by the version of macOS the bottles are built on. * `--display-times`: Print install times for each formula at the end of the run. * `-i`, `--interactive`: diff --git a/manpages/brew.1 b/manpages/brew.1 index da3320ded1..2c6cb8d9c7 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -315,6 +315,10 @@ Don\'t delete the temporary files created during installation\. Prepare the formula for eventual bottling during installation\. . .TP +\fB\-\-bottle\-arch\fR +Optimise bottles for the given architecture rather than the oldest architecture supported by the version of macOS the bottles are built on\. +. +.TP \fB\-\-display\-times\fR Print install times for each formula at the end of the run\. . From 07940a8c7d0592f5c369e07d0992eca348ca053e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Fri, 15 Feb 2019 20:45:36 +0000 Subject: [PATCH 187/199] Bump github-pages from 195 to 196 in /docs Bumps [github-pages](https://github.com/github/pages-gem) from 195 to 196. - [Release notes](https://github.com/github/pages-gem/releases) - [Commits](https://github.com/github/pages-gem/compare/v195...v196) Signed-off-by: dependabot[bot] --- docs/Gemfile.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index bb9e6cdf10..e25b344dbb 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -31,7 +31,7 @@ GEM ffi (1.10.0) forwardable-extended (2.6.0) gemoji (3.0.0) - github-pages (195) + github-pages (196) activesupport (= 4.2.10) github-pages-health-check (= 1.16.0) jekyll (= 3.7.4) @@ -47,7 +47,7 @@ GEM jekyll-paginate (= 1.1.0) jekyll-readme-index (= 0.2.0) jekyll-redirect-from (= 0.14.0) - jekyll-relative-links (= 0.5.3) + jekyll-relative-links (= 0.6.0) jekyll-remote-theme (= 0.3.1) jekyll-sass-converter (= 1.5.2) jekyll-seo-tag (= 2.5.0) @@ -67,7 +67,7 @@ GEM jekyll-theme-tactile (= 0.1.1) jekyll-theme-time-machine (= 0.1.1) jekyll-titles-from-headings (= 0.5.1) - jemoji (= 0.10.1) + jemoji (= 0.10.2) kramdown (= 1.17.0) liquid (= 4.0.0) listen (= 3.1.5) @@ -141,7 +141,7 @@ GEM jekyll (~> 3.0) jekyll-redirect-from (0.14.0) jekyll (~> 3.3) - jekyll-relative-links (0.5.3) + jekyll-relative-links (0.6.0) jekyll (~> 3.3) jekyll-remote-theme (0.3.1) jekyll (~> 3.5) @@ -197,7 +197,7 @@ GEM jekyll (~> 3.3) jekyll-watch (2.1.2) listen (~> 3.0) - jemoji (0.10.1) + jemoji (0.10.2) gemoji (~> 3.0) html-pipeline (~> 2.2) jekyll (~> 3.0) From 5536432c4f3ff8c943077106a1104110202d2123 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 15 Feb 2019 19:46:32 +0100 Subject: [PATCH 188/199] Allow editing broken casks. --- Library/Homebrew/cask/cmd/edit.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/cmd/edit.rb b/Library/Homebrew/cask/cmd/edit.rb index bccdc27547..549f889552 100644 --- a/Library/Homebrew/cask/cmd/edit.rb +++ b/Library/Homebrew/cask/cmd/edit.rb @@ -17,7 +17,7 @@ module Cask def cask_path casks.first.sourcefile_path - rescue CaskInvalidError + rescue CaskInvalidError, CaskUnreadableError path = CaskLoader.path(args.first) return path if path.file? From d5f6e4cd34ba2550499876ed4c8988e183b3465c Mon Sep 17 00:00:00 2001 From: David Beitey Date: Fri, 15 Feb 2019 03:04:10 +0000 Subject: [PATCH 189/199] Add info on env variables for Formula Cookbook This explains the levels of environment variable filtering present in Homebrew, explaining how and why variables without a `HOMEBREW_` prefix or those which contain `TOKEN` etc are made unavailable to a Formula. --- docs/Formula-Cookbook.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/Formula-Cookbook.md b/docs/Formula-Cookbook.md index 3923323613..52612c1408 100644 --- a/docs/Formula-Cookbook.md +++ b/docs/Formula-Cookbook.md @@ -696,6 +696,16 @@ Homebrew provides two formula DSL methods for launchd plist files: * [`plist_name`](https://www.rubydoc.info/github/Homebrew/brew/master/Formula#plist_name-instance_method) will return e.g. `homebrew.mxcl.` * [`plist_path`](https://www.rubydoc.info/github/Homebrew/brew/master/Formula#plist_path-instance_method) will return e.g. `/usr/local/Cellar/foo/0.1/homebrew.mxcl.foo.plist` +### Using environment variables + +Homebrew has multiple levels of environment variable filtering which affects variables available to formulae. + +Firstly, the overall environment in which Homebrew runs is filtered to avoid environment contamination breaking from-source builds ([ref](https://github.com/Homebrew/brew/issues/932)). In particular, this process filters all but the given whitelisted variables, but allows environment variables prefixed with `HOMEBREW_`. The specific implementation can be seen in the [`brew`](https://github.com/Homebrew/brew/blob/master/bin/brew) script. + +The second level of filtering removes sensitive environment variables (such as credentials like keys, passwords or tokens) to avoid malicious subprocesses obtaining them ([ref](https://github.com/Homebrew/brew/pull/2524)). This has the effect of preventing any such variables from reaching a formula's Ruby code as they are filtered before it is called. The specific implementation can be seen in the [`clear_sensitive_environment` method](https://github.com/Homebrew/brew/blob/master/Library/Homebrew/extend/ENV.rb). + +In summary, environment variables used by a formula need to conform to these filtering rules in order to be available. + ## Updating formulae Eventually a new version of the software will be released. In this case you should update the [`url`](https://www.rubydoc.info/github/Homebrew/brew/master/Formula#url-class_method) and [`sha256`](https://www.rubydoc.info/github/Homebrew/brew/master/Formula#sha256%3D-class_method). If a [`revision`](https://www.rubydoc.info/github/Homebrew/brew/master/Formula#revision%3D-class_method) line exists outside any `bottle do` block *and* the new release is stable rather than devel, it should be removed. From a4f615d74f49e1702657d0a795471ed788f89832 Mon Sep 17 00:00:00 2001 From: Michka Popoff Date: Sat, 16 Feb 2019 09:53:45 +0100 Subject: [PATCH 190/199] Dockerfile: do not chown linuxbrew folder The linuxbrew user has been removed from the Dockerfile --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b7e9631220..66189a428c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,7 +28,6 @@ ADD . /home/linuxbrew/.linuxbrew/Homebrew RUN cd /home/linuxbrew/.linuxbrew \ && mkdir -p bin etc include lib opt sbin share var/homebrew/linked Cellar \ && ln -s ../Homebrew/bin/brew /home/linuxbrew/.linuxbrew/bin/ \ - && chown -R linuxbrew: /home/linuxbrew/.linuxbrew \ && cd /home/linuxbrew/.linuxbrew/Homebrew \ && git remote set-url origin https://github.com/Homebrew/brew From a3a3e3b878e46e1f1c1e1225cc9588daa14e5c93 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 16 Feb 2019 09:46:57 +0000 Subject: [PATCH 191/199] Formula Cookbook: env var docs tweaks. --- docs/Formula-Cookbook.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/Formula-Cookbook.md b/docs/Formula-Cookbook.md index 52612c1408..8a6a2b22ea 100644 --- a/docs/Formula-Cookbook.md +++ b/docs/Formula-Cookbook.md @@ -1,6 +1,6 @@ # Formula Cookbook -A *formula* is a package definition written in Ruby. It can be created with `brew create ` where `` is a zip or tarball, installed with `brew install `, and debugged with `brew install --debug --verbose `. Formulae use the [Formula API](https://www.rubydoc.info/github/Homebrew/brew/master/Formula) which provides various Homebrew-specific helpers. +A *formula* is a package definition written in Ruby. It can be created with `brew create ` where `` is a zip or tarball, installed with `brew install `, and debugged with `brew install --drefebug --verbose `. Formulae use the [Formula API](https://www.rubydoc.info/github/Homebrew/brew/master/Formula) which provides various Homebrew-specific helpers. ## Homebrew terminology @@ -700,9 +700,9 @@ Homebrew provides two formula DSL methods for launchd plist files: Homebrew has multiple levels of environment variable filtering which affects variables available to formulae. -Firstly, the overall environment in which Homebrew runs is filtered to avoid environment contamination breaking from-source builds ([ref](https://github.com/Homebrew/brew/issues/932)). In particular, this process filters all but the given whitelisted variables, but allows environment variables prefixed with `HOMEBREW_`. The specific implementation can be seen in the [`brew`](https://github.com/Homebrew/brew/blob/master/bin/brew) script. +Firstly, the overall environment in which Homebrew runs is filtered to avoid environment contamination breaking from-source builds (https://github.com/Homebrew/brew/issues/932). In particular, this process filters all but the given whitelisted variables, but allows environment variables prefixed with `HOMEBREW_`. The specific implementation can be seen in [`bin/brew`](https://github.com/Homebrew/brew/blob/master/bin/brew). -The second level of filtering removes sensitive environment variables (such as credentials like keys, passwords or tokens) to avoid malicious subprocesses obtaining them ([ref](https://github.com/Homebrew/brew/pull/2524)). This has the effect of preventing any such variables from reaching a formula's Ruby code as they are filtered before it is called. The specific implementation can be seen in the [`clear_sensitive_environment` method](https://github.com/Homebrew/brew/blob/master/Library/Homebrew/extend/ENV.rb). +The second level of filtering removes sensitive environment variables (such as credentials like keys, passwords or tokens) to avoid malicious subprocesses obtaining them (https://github.com/Homebrew/brew/pull/2524). This has the effect of preventing any such variables from reaching a formula's Ruby code as they are filtered before it is called. The specific implementation can be seen in the [`ENV.clear_sensitive_environment!` method](https://github.com/Homebrew/brew/blob/master/Library/Homebrew/extend/ENV.rb). In summary, environment variables used by a formula need to conform to these filtering rules in order to be available. From d415600e208f86b85647871f0179298bb236acb8 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 16 Feb 2019 09:50:18 +0000 Subject: [PATCH 192/199] Formula Cookbook: fix typo. --- docs/Formula-Cookbook.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Formula-Cookbook.md b/docs/Formula-Cookbook.md index 8a6a2b22ea..d5842e746d 100644 --- a/docs/Formula-Cookbook.md +++ b/docs/Formula-Cookbook.md @@ -1,6 +1,6 @@ # Formula Cookbook -A *formula* is a package definition written in Ruby. It can be created with `brew create ` where `` is a zip or tarball, installed with `brew install `, and debugged with `brew install --drefebug --verbose `. Formulae use the [Formula API](https://www.rubydoc.info/github/Homebrew/brew/master/Formula) which provides various Homebrew-specific helpers. +A *formula* is a package definition written in Ruby. It can be created with `brew create ` where `` is a zip or tarball, installed with `brew install `, and debugged with `brew install --debug --verbose `. Formulae use the [Formula API](https://www.rubydoc.info/github/Homebrew/brew/master/Formula) which provides various Homebrew-specific helpers. ## Homebrew terminology From e9c45ff17b406bed50677b5b5eb04d9422343f27 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 16 Feb 2019 11:30:49 +0100 Subject: [PATCH 193/199] Pass additional options to `GitHub.pull_requests`. --- Library/Homebrew/utils/github.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index e143e9163e..778eb5bcae 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -287,8 +287,8 @@ module GitHub ["admin", "write"].include?(permission(repo, user)["permission"]) end - def pull_requests(repo, base:, state: :open, **_options) - url = "#{API_URL}/repos/#{repo}/pulls?#{URI.encode_www_form(base: base, state: state)}" + def pull_requests(repo, **options) + url = "#{API_URL}/repos/#{repo}/pulls?#{URI.encode_www_form(options)}" open_api(url) end From c7831a457d738d9723231cae77b30b1b22b39dbc Mon Sep 17 00:00:00 2001 From: Ben Muschol Date: Sat, 16 Feb 2019 07:39:48 -0500 Subject: [PATCH 194/199] Get brew style to pass --- Library/Homebrew/test/cli_parser_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/test/cli_parser_spec.rb b/Library/Homebrew/test/cli_parser_spec.rb index 53504dd287..c5c1f25764 100644 --- a/Library/Homebrew/test/cli_parser_spec.rb +++ b/Library/Homebrew/test/cli_parser_spec.rb @@ -183,8 +183,8 @@ describe Homebrew::CLI::Parser do allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_B").and_return("0") allow(ENV).to receive(:[]) parser.parse(["--switch-b"]) - expect(Homebrew.args.switch_a?).to be_falsy - expect(Homebrew.args.switch_b?).to be true + expect(Homebrew.args.switch_a).to be_falsy + expect(Homebrew.args).to be_switch_b end it "raises an exception on constraint violation when both are env vars" do From e7ce5dddb721869f169c69769d5f61601d271159 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 16 Feb 2019 19:57:56 +0000 Subject: [PATCH 195/199] update: recommend 'brew untap` if tap doesn't exist. We removed a few old, deprecated repos recently and people with them still tapped who get confused at the `brew update` error message. --- Library/Homebrew/cmd/update.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index 80384da032..b584e826c4 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -510,7 +510,13 @@ EOS if ! git fetch --tags --force "${QUIET_ARGS[@]}" origin \ "refs/heads/$UPSTREAM_BRANCH_DIR:refs/remotes/origin/$UPSTREAM_BRANCH_DIR" then - echo "Fetching $DIR failed!" >>"$update_failed_file" + if [[ "$UPSTREAM_SHA_HTTP_CODE" = "404" ]] + then + TAP="${DIR#$HOMEBREW_LIBRARY/Taps/}" + echo "$TAP does not exist! Run 'brew untap $TAP'" >>"$update_failed_file" + else + echo "Fetching $DIR failed!" >>"$update_failed_file" + fi fi fi ) & From 67cbb129ffa5b6519be668fe0e61508b1b2d721c Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 16 Feb 2019 20:07:10 +0000 Subject: [PATCH 196/199] diagnostic: warn people about tapped, deprecated taps. --- Library/Homebrew/diagnostic.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index b62a5b9842..7253e9bc2a 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -604,6 +604,18 @@ module Homebrew EOS end + def check_deprecated_official_taps + tapped_deprecated_taps = + Tap.select(&:official?).map(&:repo) & DEPRECATED_OFFICIAL_TAPS + return if tapped_deprecated_taps.empty? + + <<~EOS + You have the following deprecated, official taps tapped: + Homebrew/homebrew-#{tapped_deprecated_taps.join("\n ")} + Untap them with `brew untap`. + EOS + end + def __check_linked_brew(f) f.installed_prefixes.each do |prefix| prefix.find do |src| From ae7492f3b5fc1a3fcde1256f143e3cadb756c343 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 16 Feb 2019 20:07:28 +0000 Subject: [PATCH 197/199] Remove "undocumented options" that are documented options. --- Library/Homebrew/cmd/doctor.rb | 4 ---- Library/Homebrew/dev-cmd/audit.rb | 3 --- 2 files changed, 7 deletions(-) diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index 4b18a3c7b1..ceb838f7d0 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -21,10 +21,6 @@ module Homebrew description: "Enable debugging and profiling of audit methods." switch :verbose switch :debug - - # Undocumented options: - # `-D` activates debugging and profiling of the doctor methods (not the same as `--debug`) - # `--list-checks` lists all doctor methods end end diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index a3ef5a531f..b742fb80da 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -56,9 +56,6 @@ module Homebrew switch :debug conflicts "--only", "--except" conflicts "--only-cops", "--except-cops" - - # Undocumented options: - # `-D` activates debugging and profiling of the audit methods (not the same as `--debug`) end end From 3bcffeae1575222753f6b67bce364f883a4737c9 Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Sat, 16 Feb 2019 12:16:02 -0800 Subject: [PATCH 198/199] tests: Disable tests that require being non-root Set the environment variable USER=root which is required by brew tests --only=utils/user Fix these tests: rspec ./test/diagnostic_checks_spec.rb:26 # Homebrew::Diagnostic::Checks #check_access_directories rspec ./test/pathname_spec.rb:120 # Pathname#ensure_writable makes a file writable and restores permissions rspec ./test/utils/user_spec.rb:22 # User#gui? when the current user is in a console session gui? should equal true rspec ./test/utils/user_spec.rb:6 # User should eq nil --- Dockerfile.test.yml | 2 +- Library/Homebrew/test/diagnostic_checks_spec.rb | 1 + Library/Homebrew/test/pathname_spec.rb | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile.test.yml b/Dockerfile.test.yml index 79e6e7caa3..4b930db2c6 100644 --- a/Dockerfile.test.yml +++ b/Dockerfile.test.yml @@ -1,3 +1,3 @@ sut: build: . - command: brew test-bot + command: env USER=root brew test-bot diff --git a/Library/Homebrew/test/diagnostic_checks_spec.rb b/Library/Homebrew/test/diagnostic_checks_spec.rb index 3f1dbcd44a..76ce1222db 100644 --- a/Library/Homebrew/test/diagnostic_checks_spec.rb +++ b/Library/Homebrew/test/diagnostic_checks_spec.rb @@ -24,6 +24,7 @@ describe Homebrew::Diagnostic::Checks do end specify "#check_access_directories" do + skip "User is root so everything is writable." if Process.euid.zero? begin dirs = [ HOMEBREW_CACHE, diff --git a/Library/Homebrew/test/pathname_spec.rb b/Library/Homebrew/test/pathname_spec.rb index 5f846fde13..e1c6645bf9 100644 --- a/Library/Homebrew/test/pathname_spec.rb +++ b/Library/Homebrew/test/pathname_spec.rb @@ -118,6 +118,7 @@ describe Pathname do describe "#ensure_writable" do it "makes a file writable and restores permissions afterwards" do + skip "User is root so everything is writable." if Process.euid.zero? touch file chmod 0555, file expect(file).not_to be_writable From a30b69c318598cc29bd1c9b7ceac87593ae4c331 Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Sat, 16 Feb 2019 20:08:51 -0800 Subject: [PATCH 199/199] Dockerfile.test.yml: Run brew test-bot as linuxbrew Running brew test-bot as root fails. ==> Running brew update... Error: Running Homebrew as root is extremely dangerous and no longer supported. --- Dockerfile | 1 + Dockerfile.test.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 66189a428c..25c13b6a3d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,4 +37,5 @@ ENV PATH=/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH \ # Install portable-ruby and tap homebrew/core. RUN HOMEBREW_NO_ANALYTICS=1 HOMEBREW_NO_AUTO_UPDATE=1 brew tap homebrew/core \ + && chown -R linuxbrew: /home/linuxbrew/.linuxbrew \ && rm -rf ~/.cache diff --git a/Dockerfile.test.yml b/Dockerfile.test.yml index 4b930db2c6..c7aa56974c 100644 --- a/Dockerfile.test.yml +++ b/Dockerfile.test.yml @@ -1,3 +1,3 @@ sut: build: . - command: env USER=root brew test-bot + command: "sudo -i -u linuxbrew /home/linuxbrew/.linuxbrew/bin/brew test-bot"