diff --git a/.gitignore b/.gitignore index 2723b40b9a..3a4d0f5a61 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 @@ -24,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/*/* @@ -92,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/Dockerfile b/Dockerfile index 9c7e1dfda5..25c13b6a3d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,16 +28,14 @@ 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 -USER 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 \ + && chown -R linuxbrew: /home/linuxbrew/.linuxbrew \ && rm -rf ~/.cache diff --git a/Dockerfile.test.yml b/Dockerfile.test.yml index 79e6e7caa3..c7aa56974c 100644 --- a/Dockerfile.test.yml +++ b/Dockerfile.test.yml @@ -1,3 +1,3 @@ sut: build: . - command: brew test-bot + command: "sudo -i -u linuxbrew /home/linuxbrew/.linuxbrew/bin/brew test-bot" 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..317c6ffd63 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: @@ -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..ad8734b629 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 @@ -89,13 +92,8 @@ 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"] - 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/brew.sh b/Library/Homebrew/brew.sh index 788a610b23..c7c42a6c4d 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)" @@ -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" ]] @@ -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 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/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/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/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/moved.rb b/Library/Homebrew/cask/artifact/moved.rb index eb97424f9a..67b0ca2e5a 100644 --- a/Library/Homebrew/cask/artifact/moved.rb +++ b/Library/Homebrew/cask/artifact/moved.rb @@ -40,9 +40,13 @@ module Cask end ohai "Moving #{self.class.english_name} '#{source.basename}' to '#{target}'." - target.dirname.mkpath + 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) 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/cask.rb b/Library/Homebrew/cask/cask.rb index 12d578df81..68f2cd3709 100644 --- a/Library/Homebrew/cask/cask.rb +++ b/Library/Homebrew/cask/cask.rb @@ -31,15 +31,21 @@ module Cask @tap end - def initialize(token, sourcefile_path: nil, tap: nil, config: Config.global, &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,6 +83,14 @@ module Cask metadata_master_container_path.join(*installed_version, "Casks", "#{token}.rb") end + def config_path + metadata_master_container_path/"config.json" + end + + def caskroom_path + @caskroom_path ||= Caskroom.path.join(token) + end + def outdated?(greedy = false) !outdated_versions(greedy).empty? end @@ -133,7 +147,7 @@ module Cask end, "caveats" => caveats, "depends_on" => depends_on, - "conflicts_with" => conflicts_with.to_a, + "conflicts_with" => conflicts_with, "container" => container, "auto_updates" => auto_updates, } diff --git a/Library/Homebrew/cask/cmd.rb b/Library/Homebrew/cask/cmd.rb index a064a30333..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" @@ -186,7 +187,10 @@ module Cask end def process_options(*args) - all_args = Shellwords.shellsplit(ENV["HOMEBREW_CASK_OPTS"] || "") + 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 = [] diff --git a/Library/Homebrew/cask/cmd/automerge.rb b/Library/Homebrew/cask/cmd/automerge.rb new file mode 100755 index 0000000000..b71083bac6 --- /dev/null +++ b/Library/Homebrew/cask/cmd/automerge.rb @@ -0,0 +1,124 @@ +# 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 + 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 = [] + + taps.each do |tap| + 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"])} " + + retried = false + + 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 + unless retried + retried = true + sleep 5 + retry + end + + 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/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? 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 07ffee2ead..404370e689 100644 --- a/Library/Homebrew/cask/config.rb +++ b/Library/Homebrew/cask/config.rb @@ -1,12 +1,11 @@ +require "json" + +require "extend/hash_validator" +using HashValidator + module Cask class Config - def self.global - @global ||= new - end - - attr_reader :binarydir - - def initialize( + DEFAULT_DIRS = { appdir: "/Applications", prefpanedir: "~/Library/PreferencePanes", qlplugindir: "~/Library/QuickLook", @@ -19,47 +18,91 @@ 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.clear + @global = nil + end + + 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( + 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: {}) + @default = self.class.canonicalize(default) if default + @env = self.class.canonicalize(env) if env + @explicit = self.class.canonicalize(explicit) + + @env&.assert_valid_keys!(*DEFAULT_DIRS.keys) + @explicit.assert_valid_keys!(*DEFAULT_DIRS.keys) + end + + def default + @default ||= self.class.canonicalize(DEFAULT_DIRS) + end + + def env + @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 + @binarydir ||= HOMEBREW_PREFIX/"bin" + end + + DEFAULT_DIRS.keys.each do |dir| + define_method(dir) do + explicit.fetch(dir, env.fetch(dir, default.fetch(dir))) + end define_method(:"#{dir}=") do |path| - instance_variable_set(:"@#{dir}", Pathname(path).expand_path) + explicit[dir] = Pathname(path).expand_path end end + + def merge(other) + self.class.new(explicit: other.explicit.merge(explicit)) + end + + def to_json(*args) + { + default: default, + env: env, + explicit: explicit, + }.to_json(*args) + end end end 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/dsl/conflicts_with.rb b/Library/Homebrew/cask/dsl/conflicts_with.rb index fa05f584c1..2505743a60 100644 --- a/Library/Homebrew/cask/dsl/conflicts_with.rb +++ b/Library/Homebrew/cask/dsl/conflicts_with.rb @@ -1,29 +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 + self.default = 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 + def to_json(generator) + Hash[map { |k, v| [k, v.to_a] }].to_json(generator) end end end 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 diff --git a/Library/Homebrew/cask/installer.rb b/Library/Homebrew/cask/installer.rb index 0e43cca4fb..88b8e83193 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" @@ -39,7 +40,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 +80,9 @@ module Cask def install odebug "Cask::Installer#install" - if @cask.installed? && !force? && !@reinstall && !upgrade? + old_config = @cask.config + + if @cask.installed? && !force? && !reinstall? && !upgrade? raise CaskAlreadyInstalledError, @cask end @@ -87,11 +90,14 @@ 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? stage + + @cask.config = Config.global.merge(old_config) + install_artifacts unless @cask.tap&.private? @@ -104,7 +110,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? @@ -209,6 +215,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| @@ -217,6 +225,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 @@ -375,13 +390,23 @@ module Cask old_savedir&.rmtree end + def save_config_file + @cask.config_path.atomic_write(@cask.config.to_json) + 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)}" @@ -425,9 +450,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/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 diff --git a/Library/Homebrew/cleanup.rb b/Library/Homebrew/cleanup.rb index 8851b30855..4b102b39d5 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) @@ -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 @@ -124,7 +126,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 @@ -155,7 +160,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? @@ -167,7 +171,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 @@ -177,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! + clean!(quiet: true, periodic: true) end - def clean! + def clean!(quiet: false, periodic: 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 - 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 @@ -220,8 +230,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) @@ -274,6 +285,8 @@ module Homebrew # Skip incomplete downloads which are still in progress. next end + elsif download.directory? + FileUtils.rm_rf download else download.unlink end @@ -310,12 +323,12 @@ 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 end def cleanup_lockfiles(*lockfiles) diff --git a/Library/Homebrew/cli_parser.rb b/Library/Homebrew/cli_parser.rb index 01310d42e3..f35328a574 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) @@ -27,8 +27,10 @@ module Homebrew Homebrew.args.instance_eval { undef tap } @constraints = [] @conflicts = [] + @switch_sources = {} @processed_options = [] @desc_line_length = 43 + @hide_from_man_page = false instance_eval(&block) post_initialize end @@ -50,15 +52,16 @@ 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| 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, from: :env) if !env.nil? && !ENV["HOMEBREW_#{env.to_s.upcase}"].nil? end + alias switch_option switch def usage_banner(text) @parser.banner = "#{text}\n" @@ -147,14 +150,42 @@ 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 + rescue FormulaUnavailableError + [] + end + + def hide_from_man_page! + @hide_from_man_page = true + end + private - def enable_switch(*names) + def enable_switch(*names, from:) names.each do |name| + @switch_sources[option_to_name(name)] = from 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) @@ -202,7 +233,13 @@ 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 + + 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 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 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 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) 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 diff --git a/Library/Homebrew/cmd/--repository.rb b/Library/Homebrew/cmd/--repository.rb index 6f6f8d31ec..39eb60fe94 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 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}" diff --git a/Library/Homebrew/cmd/analytics.rb b/Library/Homebrew/cmd/analytics.rb index 60ebb03da9..a6824e96cd 100644 --- a/Library/Homebrew/cmd/analytics.rb +++ b/Library/Homebrew/cmd/analytics.rb @@ -1,22 +1,32 @@ -#: * `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 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 diff --git a/Library/Homebrew/cmd/cat.rb b/Library/Homebrew/cmd/cat.rb index 7439869d30..b7d3976555 100644 --- a/Library/Homebrew/cmd/cat.rb +++ b/Library/Homebrew/cmd/cat.rb @@ -1,16 +1,26 @@ -#: * `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 of . + 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/cmd/cleanup.rb b/Library/Homebrew/cmd/cleanup.rb index 751eef4fea..19bbef2e8a 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, @@ -37,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 @@ -46,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/command.rb b/Library/Homebrew/cmd/command.rb index d964fa1a9b..08d5b51c80 100644 --- a/Library/Homebrew/cmd/command.rb +++ b/Library/Homebrew/cmd/command.rb @@ -1,15 +1,26 @@ -#: * `command` : -#: 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) diff --git a/Library/Homebrew/cmd/commands.rb b/Library/Homebrew/cmd/commands.rb index 9644a1dee2..66b4466331 100644 --- a/Library/Homebrew/cmd/commands.rb +++ b/Library/Homebrew/cmd/commands.rb @@ -1,18 +1,33 @@ -#: * `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 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 diff --git a/Library/Homebrew/cmd/config.rb b/Library/Homebrew/cmd/config.rb index daaa51f32b..492a6d47a8 100644 --- a/Library/Homebrew/cmd/config.rb +++ b/Library/Homebrew/cmd/config.rb @@ -1,14 +1,26 @@ -#: * `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" 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 diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index 13c2e85904..239e300d47 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -1,104 +1,96 @@ -#: * `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 . -#: -#: 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. - -# 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" 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 formulae." + switch "--include-build", + description: "Show `:build` type dependencies for ." + switch "--include-optional", + description: "Show `:optional` dependencies 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 + conflicts "--installed", "--all" + formula_options + 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 +100,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 +172,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 "└──" diff --git a/Library/Homebrew/cmd/desc.rb b/Library/Homebrew/cmd/desc.rb index 2ce5514fc4..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" @@ -37,6 +27,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/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..ceb838f7d0 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" diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb index 892c6426d3..07dc67e576 100644 --- a/Library/Homebrew/cmd/fetch.rb +++ b/Library/Homebrew/cmd/fetch.rb @@ -1,37 +1,52 @@ -#: * `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`) 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" 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 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." + 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 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." + switch :verbose + switch :debug + conflicts "--devel", "--HEAD" + conflicts "--build-from-source", "--build-bottle", "--force-bottle" + 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 +115,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 +126,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? diff --git a/Library/Homebrew/cmd/gist-logs.rb b/Library/Homebrew/cmd/gist-logs.rb index 975acbd65d..66cb1dffe6 100644 --- a/Library/Homebrew/cmd/gist-logs.rb +++ b/Library/Homebrew/cmd/gist-logs.rb @@ -1,28 +1,41 @@ -#: * `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. See [SPECIFYING FORMULAE](#specifying-formulae). -#: -#: 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" 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. + + 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 +73,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 +85,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 +127,7 @@ module Homebrew end def create_private? - ARGV.include?("--private") || ARGV.switch?("p") + args.private? end def create_gist(files, description) @@ -134,6 +147,8 @@ module Homebrew def gist_logs 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/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 ce72549531..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", @@ -79,6 +43,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 2bb5779376..0369d1d8ef 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -1,98 +1,97 @@ -#: * `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. See [SPECIFYING FORMULAE](#specifying-formulae). -#: -#: 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 `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. -#: -#: 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" 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 + usage_banner <<~EOS + `install` [] - 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. + + 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, + 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", + 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 development version has been released." + switch "--keep-tmp", + 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." + 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." + conflicts "--ignore-dependencies", "--only-dependencies" + conflicts "--devel", "--HEAD" + conflicts "--build-from-source", "--build-bottle", "--force-bottle" + formula_options 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 @@ -104,210 +103,210 @@ module Homebrew end end - begin - formulae = [] + formulae = [] - unless ARGV.casks.empty? - args = [] - args << "--force" if ARGV.force? - args << "--debug" if ARGV.debug? - args << "--verbose" if ARGV.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} #{args.join " "}" - system("#{HOMEBREW_PREFIX}/bin/brew", "cask", "install", c, *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 !ARGV.build_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 + 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? + # 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 !ARGV.build_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? - 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? - raise "No head is defined for #{f.full_name}" - end - - # --devel, fail with no devel defined - if ARGV.build_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?) - prefix_installed = f.prefix.exist? && !f.prefix.children.empty? - - if f.keg_only? && f.any_version_installed? && f.optlinked? && !ARGV.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 ARGV.only_deps? - 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 (ARGV.build_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? - 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 ARGV.only_deps? - 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? && !ARGV.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) @@ -316,12 +315,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 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/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 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 d113e6ef38..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." @@ -29,6 +19,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..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,8 +25,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 :debug + conflicts "--quiet", "--verbose", "--json=" end 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 3c8ffdb3f0..cc9661849d 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,13 +16,13 @@ module Homebrew description: "Show what would be removed, but do not actually remove anything." switch :verbose switch :debug + hide_from_man_page! end end 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 --prune-prefix'") 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 658247b77b..19527ec3cd 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -1,12 +1,3 @@ -#: * `reinstall` [`--display-times`] : -#: Uninstall and then install (with existing install options). -#: -#: 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" require "messages" @@ -20,19 +11,31 @@ 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). - If `HOMEBREW_INSTALL_CLEANUP` is set then remove previously installed versions - of upgraded as well as the HOMEBREW_CACHE for that formula. + 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 "\ + "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: "Don't 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 + conflicts "--build-from-source", "--force-bottle" + formula_options end end diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb index 5f51d1c758..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" @@ -41,20 +22,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` [] [|`/``/`] + + 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 diff --git a/Library/Homebrew/cmd/sh.rb b/Library/Homebrew/cmd/sh.rb index 73bf72044a..90d1f6895b 100644 --- a/Library/Homebrew/cmd/sh.rb +++ b/Library/Homebrew/cmd/sh.rb @@ -1,19 +1,30 @@ -#: * `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" 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? 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\"" 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 bf22f484a5..1122f68c01 100644 --- a/Library/Homebrew/cmd/switch.rb +++ b/Library/Homebrew/cmd/switch.rb @@ -1,14 +1,25 @@ -#: * `switch` : -#: Symlink all of the specific of 's install to Homebrew prefix. - 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 +39,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 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 a13351f50a..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,21 +8,22 @@ 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 switch :debug + conflicts "--git", "--patch" end end 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/update-report.rb b/Library/Homebrew/cmd/update-report.rb index 7bacd47ca2..fc27295bd6 100644 --- a/Library/Homebrew/cmd/update-report.rb +++ b/Library/Homebrew/cmd/update-report.rb @@ -1,13 +1,10 @@ -#: @hide_from_man_page -#: * `update_report` [`--preinstall`]: -#: The Ruby implementation of `brew update`. Never called manually. - require "formula_versions" require "migrator" require "formulary" require "descriptions" require "cleanup" require "description_cache_store" +require "cli_parser" module Homebrew module_function @@ -19,7 +16,26 @@ 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 :quiet + 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" diff --git a/Library/Homebrew/cmd/update-reset.sh b/Library/Homebrew/cmd/update-reset.sh index 60aa47bed6..70e2867a62 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 @@ -36,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..." diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index eefe5df2a5..b584e826c4 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 @@ -513,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 ) & diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index fd84995b72..34ef98199f 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -1,41 +1,62 @@ -#: * `upgrade` [] [`--fetch-HEAD`] [`--ignore-pinned`] [`--display-times`] []: -#: Upgrade outdated, unpinned brews (with existing install options). -#: -#: Options for the `install` command are also valid here. -#: -#: 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 `--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`). - require "install" require "reinstall" require "formula_installer" require "development_tools" require "messages" require "cleanup" +require "cli_parser" 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'") - elsif ENV["HOMEBREW_UPGRADE_CLEANUP"] - ENV["HOMEBREW_INSTALL_CLEANUP"] = "1" - odeprecated("'HOMEBREW_UPGRADE_CLEANUP'", "'HOMEBREW_INSTALL_CLEANUP'") + def upgrade_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `upgrade` [] + + 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`). + + 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 "\ + "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 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: "Don't 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." + conflicts "--build-from-source", "--force-bottle" + formula_options end + end + + def upgrade + if ARGV.include?("--cleanup") + odisabled("'brew upgrade --cleanup'") + elsif ENV["HOMEBREW_UPGRADE_CLEANUP"] + odisabled("'HOMEBREW_UPGRADE_CLEANUP'") + end + + upgrade_args.parse FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed? @@ -43,13 +64,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| @@ -68,7 +89,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 @@ -147,7 +168,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 @@ -206,7 +227,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 @@ -250,7 +271,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 @@ -298,7 +319,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) } @@ -313,7 +334,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| @@ -331,7 +352,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) } @@ -346,7 +367,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(", ") diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb index f5d4a73ef1..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,34 +11,35 @@ 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 end diff --git a/Library/Homebrew/cmd/vendor-install.sh b/Library/Homebrew/cmd/vendor-install.sh index 5bc2e7bf0d..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 @@ -16,9 +17,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 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/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/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 02968fd412..b742fb80da 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." @@ -202,7 +165,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 +368,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 +396,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 +405,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 +426,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 +490,8 @@ module Homebrew def audit_postgresql return unless formula.name == "postgresql" + return unless @core_tap + major_version = formula.version .to_s .split(".") @@ -602,20 +565,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 +594,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 +605,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 +651,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 +875,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 +893,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 @@ -1131,20 +1085,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) @@ -1154,7 +1097,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/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 3c7cdf3368..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`. @@ -365,6 +333,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 diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 95d64c0202..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" @@ -104,6 +61,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..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" @@ -59,6 +38,7 @@ module Homebrew switch :force switch :verbose switch :debug + conflicts "--autotools", "--cmake", "--meson" end end 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 135081e227..c08461e7d2 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -1,34 +1,9 @@ -#: * `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" 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,45 +58,34 @@ 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] + 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') - variables[:homebrew_bundle] = help_output(:bundle) - variables[:homebrew_services] = help_output(:services) - ERB.new(template, nil, ">").result(variables.instance_eval { binding }) end @@ -162,6 +126,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 +136,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 +149,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 +220,6 @@ module Homebrew end def format_usage_banner(usage_banner) - usage_banner.sub(/^/, "### ") + usage_banner&.sub(/^(#: *\* )?/, "### ") end end 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 7c5b0ad4e2..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" @@ -55,10 +52,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/Library/Homebrew/dev-cmd/test.rb b/Library/Homebrew/dev-cmd/test.rb index 1198bd73d3..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 @@ -41,6 +26,7 @@ module Homebrew description: "Keep the temporary files created for the test." switch :verbose switch :debug + conflicts "--devel", "--HEAD" end end diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index 58e6843236..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 @@ -61,7 +44,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/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! 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 5555a3ca71..7253e9bc2a 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -73,35 +73,36 @@ module Homebrew end ############# END HELPERS - def fatal_install_checks + def fatal_preinstall_checks %w[ check_access_directories ].freeze end - def development_tools_checks + def fatal_build_from_source_checks %w[ check_for_installed_developer_tools ].freeze end - def fatal_development_tools_checks - %w[ - ].freeze + def supported_configuration_checks + [].freeze + end + + 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") <<~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 @@ -114,17 +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. 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. - 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 @@ -200,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 @@ -582,11 +570,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|/)?$}i <<~EOS Suspicious #{CoreTap.instance} git origin remote found. @@ -596,23 +582,40 @@ 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 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| @@ -802,13 +805,13 @@ 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}. - 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/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 71a4b58ad8..8481378f93 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,24 @@ 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) + + filename = nil + + if filename_with_encoding = content_disposition.parameters["filename*"] + encoding, encoded_filename = filename_with_encoding.split("''", 2) + 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 time = lines.map { |line| line[/^Last\-Modified:\s*(.+)/i, 1] } 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/exceptions.rb b/Library/Homebrew/exceptions.rb index 5358065c59..183551578c 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -463,14 +463,14 @@ 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 + message << <<~EOS if bottled Alternatively, remove the #{flag_text} to attempt bottle installation. EOS 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/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/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/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/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/diagnostic.rb b/Library/Homebrew/extend/os/mac/diagnostic.rb index 0ab30c6563..601db6e05f 100644 --- a/Library/Homebrew/extend/os/mac/diagnostic.rb +++ b/Library/Homebrew/extend/os/mac/diagnostic.rb @@ -1,32 +1,30 @@ module Homebrew module Diagnostic class Checks - undef development_tools_checks, fatal_development_tools_checks, - build_error_checks + undef fatal_build_from_source_checks, supported_configuration_checks, + build_from_source_checks - def development_tools_checks + def fatal_build_from_source_checks %w[ - check_for_unsupported_macos - check_for_installed_developer_tools check_xcode_license_approved - check_xcode_up_to_date - check_clt_up_to_date - check_for_other_package_managers - ].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_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 @@ -136,21 +134,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 +183,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. @@ -220,7 +190,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 @@ -236,18 +206,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, @@ -338,6 +296,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? 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.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/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 eec6635b29..01b6e6b837 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 @@ -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?, @@ -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 @@ -2350,12 +2352,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 +2365,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 @@ -2510,11 +2507,15 @@ 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 + 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/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 6db812a434..45f2f08499 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 @@ -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") @@ -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 @@ -209,7 +208,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 @@ -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 @@ -793,6 +788,17 @@ class FormulaInstaller return end + cask_installed_with_formula_name = begin + Cask::CaskLoader.load(formula.name).installed? + rescue Cask::CaskUnavailableError, Cask::CaskInvalidError + 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 diff --git a/Library/Homebrew/hardware.rb b/Library/Homebrew/hardware.rb index 2611bad014..9f48c4b971 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 @@ -146,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/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/install.rb b/Library/Homebrew/install.rb index 7b7fb88042..1f14f2c4cf 100644 --- a/Library/Homebrew/install.rb +++ b/Library/Homebrew/install.rb @@ -27,29 +27,46 @@ module Homebrew end end - def perform_development_tools_checks - fatal_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 + 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_preinstall_checks) end alias generic_perform_preinstall_checks perform_preinstall_checks module_function :generic_perform_preinstall_checks - def fatal_checks(type) + 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 @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 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) 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/language/python_virtualenv_constants.rb b/Library/Homebrew/language/python_virtualenv_constants.rb index f9feb811aa..3b7eec5aa3 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/51/aa" \ + "/c395a6e6eaaedfa5a04723b6446a1df783b16cca6fec66e671cede514688" \ + "/virtualenv-16.4.0.tar.gz".freeze PYTHON_VIRTUALENV_SHA256 = - "448def1220df9960e6d18fb5424107ffb1249eb566a5a311257860ab6b52b3fd".freeze + "cceab52aa7d4df1e1871a70236eb2b89fcfe29b6b43510d9738689787c513261".freeze 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/Library/Homebrew/manpages/brew.1.md.erb b/Library/Homebrew/manpages/brew.1.md.erb index 3fbdb885bf..7d45775eef 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 @@ -159,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. @@ -192,16 +201,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. @@ -219,11 +218,11 @@ 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`: - 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 @@ -245,8 +244,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. @@ -315,17 +314,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/Library/Homebrew/missing_formula.rb b/Library/Homebrew/missing_formula.rb index f1008d0de6..36fea37062 100644 --- a/Library/Homebrew/missing_formula.rb +++ b/Library/Homebrew/missing_formula.rb @@ -29,9 +29,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 @@ -42,8 +43,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. @@ -60,7 +63,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 @@ -85,6 +88,10 @@ 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 + cargo is part of the rust formula, and can be installed with: + brew install rust + EOS end end alias generic_blacklisted_reason blacklisted_reason diff --git a/Library/Homebrew/os.rb b/Library/Homebrew/os.rb index 24796f0a1e..24803816af 100644 --- a/Library/Homebrew/os.rb +++ b/Library/Homebrew/os.rb @@ -15,8 +15,11 @@ 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? && + 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 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/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..4527bdafe9 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) @@ -43,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/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb index df6bc6158b..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" @@ -43,7 +39,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? @@ -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/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/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 diff --git a/Library/Homebrew/requirements/java_requirement.rb b/Library/Homebrew/requirements/java_requirement.rb index bc59ea1f68..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) 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/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/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/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" diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index 8de0964817..329d2b8fc6 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -208,11 +208,15 @@ 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 + 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/style.rb b/Library/Homebrew/style.rb index 8e6e7378c5..c4886c6211 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 && File.exist?("#{files.first}/spec") + HOMEBREW_LIBRARY/".rubocop_rspec.yml" + else + HOMEBREW_LIBRARY/".rubocop_audit.yml" + end + args << "--config" << config end if files.nil? 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" 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/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/Gemfile.lock b/Library/Homebrew/test/Gemfile.lock index 7c1bcbe00e..79b210d897 100644 --- a/Library/Homebrew/test/Gemfile.lock +++ b/Library/Homebrew/test/Gemfile.lock @@ -14,10 +14,10 @@ GEM jaro_winkler (1.5.2) json (2.1.0) mustache (1.1.0) - parallel (1.12.1) - parallel_tests (2.27.1) + parallel (1.13.0) + parallel_tests (2.28.0) parallel - parser (2.5.3.0) + parser (2.6.0.0) ast (~> 2.4.0) powerpack (0.1.2) rainbow (3.0.0) @@ -46,7 +46,7 @@ GEM rspec-support (3.8.0) rspec-wait (0.0.9) rspec (>= 3, < 4) - rubocop (0.61.1) + rubocop (0.64.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.5, != 2.5.1.1) @@ -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) 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 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/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/artifact/shared_examples/uninstall_zap.rb b/Library/Homebrew/test/cask/artifact/shared_examples/uninstall_zap.rb index 6a6a54a9eb..4b6f1bca27 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| @@ -219,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 } @@ -282,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/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/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 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" 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/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/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/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/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/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 diff --git a/Library/Homebrew/test/cask/dsl_spec.rb b/Library/Homebrew/test/cask/dsl_spec.rb index 60a33f951c..d26f237e27 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 @@ -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 a03290e124..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 @@ -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/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/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 diff --git a/Library/Homebrew/test/cli_parser_spec.rb b/Library/Homebrew/test/cli_parser_spec.rb index 975f5ed86b..c5c1f25764 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,22 @@ 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") + allow(ENV).to receive(:[]) + parser.parse(["--switch-b"]) + 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 + 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 diff --git a/Library/Homebrew/test/cmd/help_spec.rb b/Library/Homebrew/test/cmd/help_spec.rb index e3460dec0f..df4b7dd3c3 100644 --- a/Library/Homebrew/test/cmd/help_spec.rb +++ b/Library/Homebrew/test/cmd/help_spec.rb @@ -14,13 +14,13 @@ 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 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 @@ -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 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 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/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/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/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/diagnostic_checks_spec.rb b/Library/Homebrew/test/diagnostic_checks_spec.rb index 74f0b57ab0..76ce1222db 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" @@ -30,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, @@ -164,7 +159,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/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/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 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/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) 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..a74f541461 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,38 @@ 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 + + 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/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 diff --git a/Library/Homebrew/test/rubocops/lines_spec.rb b/Library/Homebrew/test/rubocops/lines_spec.rb index 5e7aa067f4..193d2b8cda 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 @@ -661,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" 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 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/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/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 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..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 @@ -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(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 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) - 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 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/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/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index b0ddf7e972..d6ea652c8a 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 @@ -288,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 @@ -385,6 +388,8 @@ def exec_browser(*args) browser ||= OS::PATH_OPEN if defined?(OS::PATH_OPEN) return unless browser + ENV["DISPLAY"] = ENV["HOMEBREW_DISPLAY"] + safe_exec(browser, *args) end diff --git a/Library/Homebrew/utils/analytics.rb b/Library/Homebrew/utils/analytics.rb index 30b7c606b8..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_PREFIX.to_s != Homebrew::DEFAULT_PREFIX + prefix = ", #{custom_prefix_label}" unless Homebrew.default_prefix? ci = ", CI" if ENV["CI"] "#{os}#{prefix}#{ci}" end diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index 8c68a4ac38..d66fec1dcb 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 @@ -69,12 +79,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 diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index fe10623b40..778eb5bcae 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,31 @@ 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, **options) + url = "#{API_URL}/repos/#{repo}/pulls?#{URI.encode_www_form(options)}" + 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") @@ -279,7 +308,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"]})" } 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 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 1271504eef..c6ab320754 100644 --- a/Library/Homebrew/vendor/Gemfile.lock +++ b/Library/Homebrew/vendor/Gemfile.lock @@ -9,17 +9,41 @@ GEM ast (2.4.0) backports (3.11.4) concurrent-ruby (1.1.4) - i18n (1.5.2) + 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) - parallel (1.12.1) - parser (2.5.3.0) + 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) plist (3.5.0) powerpack (0.1.2) rainbow (3.0.0) - rubocop (0.61.1) + rubocop (0.64.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.5, != 2.5.1.1) @@ -27,14 +51,18 @@ 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) 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 eec9752405..29ffecb742 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" @@ -12,15 +12,31 @@ $:.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/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/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" $:.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-rspec-1.31.0/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" 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 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 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 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 diff --git a/README.md b/README.md index d52c81ebae..a301a3a3ac 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), [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/azure-pipelines.yml b/azure-pipelines.yml index 627f5d7f14..c21e217b42 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,10 +1,11 @@ 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 HOMEBREW_REPOSITORY="$(brew --repo)" mv "$HOMEBREW_REPOSITORY/Library/Taps" "$PWD/Library" sudo rm -rf "$HOMEBREW_REPOSITORY" @@ -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" diff --git a/bin/brew b/bin/brew index 0c0b2f61c0..edf2dded7f 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%/*}" @@ -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 @@ -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 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' 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/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/FAQ.md b/docs/FAQ.md index f767f63b95..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 @@ -141,7 +139,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). diff --git a/docs/Formula-Cookbook.md b/docs/Formula-Cookbook.md index 3a618b6dcb..d5842e746d 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 @@ -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 (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 (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. + ## 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. diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 36ecd1d04b..e25b344dbb 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 (196) 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,13 +41,13 @@ 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.12.1) jekyll-mentions (= 1.4.1) jekyll-optional-front-matter (= 0.3.0) 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,25 +67,25 @@ 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) 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) nokogiri (>= 1.4) - html-proofer (3.10.0) + html-proofer (3.10.2) activesupport (>= 4.2, < 6.0) addressable (~> 2.3) colorize (~> 0.8) @@ -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.12.1) + jekyll (~> 3.4) octokit (~> 4.0, != 4.4.0) jekyll-mentions (1.4.1) html-pipeline (~> 2.3) @@ -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) @@ -219,10 +219,10 @@ 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) + public_suffix (3.0.3) rake (12.3.2) rb-fsevent (0.10.3) rb-inotify (0.10.0) 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/How-to-Create-and-Maintain-a-Tap.md b/docs/How-to-Create-and-Maintain-a-Tap.md index b668f4db11..82d06ad821 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). diff --git a/docs/Installation.md b/docs/Installation.md index 5e4b64c94c..85a5ec5e9d 100644 --- a/docs/Installation.md +++ b/docs/Installation.md @@ -1,28 +1,31 @@ # 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. + +## macOS Requirements -## 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: * Directories with names that contain spaces. Homebrew itself can handle spaces, but many build scripts cannot. @@ -39,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/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. 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 diff --git a/docs/Maintainer-Guidelines.md b/docs/Maintainer-Guidelines.md index ea8bf96313..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 @@ -156,30 +165,8 @@ 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 -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. +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. -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 6f7ed538e1..2810b35639 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -18,668 +18,635 @@ 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 of *`formula`*. + +### `cleanup` [*`options`*] [*`formula`*|*`cask`*] - If `--dry-run` or `-n` is passed, show what would be removed, but do not - actually remove anything. +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 `-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)"` +* `--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)"` +* `--prune-prefix`: + Only prune the symlinks and directories from the prefix and remove no other files. + +### `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` + +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. + +### `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. - * `command` *`cmd`*: - Display the path to the file which is used when invoking `brew` *`cmd`*. +* `-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. + +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`: + 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. +* `--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`: + 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`*] - * `commands` [`--quiet` [`--include-aliases`]]: - Show a list of built-in and external commands. +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. - If `--quiet` is passed, list only the names of commands without the header. - With `--include-aliases`, the aliases of internal commands will be included. +### `pin` *`formula`* - * `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 the specified *`formula`*, preventing them from being upgraded when +issuing the `brew upgrade` *`formula`* command. See also `unpin`. - * `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`*. +### `postinstall` *`formula`* - If `--1` is passed, only show dependencies one level down, instead of - recursing. +Rerun the post-install steps for *`formula`*. - If `-n` is passed, show dependencies in topological order. +### `readall` [*`options`*] [*`tap`*] - If `--union` is passed, show the union of dependencies for *`formulae`*, - instead of the intersection. +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 `--full-name` is passed, list dependencies by their full name. +* `--aliases`: + Verify any alias symlinks in each tap. +* `--syntax`: + Syntax-check all of Homebrew's Ruby files. - If `--installed` is passed, only list those dependencies that are - currently installed. +### `reinstall` [*`options`*] *`formula`* - By default, `deps` shows required and recommended dependencies for - *`formulae`*. 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`. +Uninstall and then install *`formula`* (with existing and any appended install options). - * `deps` `--tree` [`--1`] [*`filters`*] [`--annotate`] (*`formulae`*|`--installed`): - Show dependencies as a tree. When given multiple formula arguments, output - individual trees for every formula. +Unless `HOMEBREW_NO_INSTALL_CLEANUP` is set, `brew cleanup` will be run for the reinstalled formulae or, every 30 days, for all formulae. - 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`*] - * `desc` *`formula`*: - Display *`formula`*'s name and one-line description. +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` [`--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. +* `--env`: + Use the standard `PATH` instead of superenv's, when *`std`* is passed - * `diy` [`--name=`*`name`*] [`--version=`*`version`*]: - Automatically determine the installation prefix for non-Homebrew software. +### `shellenv` +Prints export statements - run them in a shell and this installation of Homebrew will be included into your `PATH`, `MANPATH` and `INFOPATH`. - 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`. +`HOMEBREW_PREFIX`, `HOMEBREW_CELLAR` and `HOMEBREW_REPOSITORY` are also exported to save multiple queries of those variables. - 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. +Consider adding evaluating the output in your dotfiles (e.g. `~/.profile`) with `eval $(brew shellenv)` - * `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. +### `style` [*`options`*] [*`file`*|*`tap`*|*`formula`*] - * `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. +Check formulae or files for conformance to Homebrew style guidelines. - If `--HEAD` or `--devel` is passed, fetch that version instead of the - stable version. +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 `-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. +* `--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 `--force` (or `-f`) is passed, remove a previously cached version and re-fetch. +### `switch` *`formula`* *`version`* - If `--retry` is passed, retry if a download fails or re-download if the - checksum of a previously cached version no longer matches. +Symlink all of the specific *`version`* of *`formula`*'s install to Homebrew prefix. - If `--deps` is passed, also download dependencies for any listed *`formulae`*. +### `tap` [*`options`*] *`user`*`/`*`repo`* [*`URL`*] - If `--build-from-source` (or `-s`) is passed, download the source rather than a - bottle. +Tap a formula repository. - 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. +List all installed taps when no arguments are passed. - * `gist-logs` [`--new-issue`|`-n`] [`--private`|`-p`] *`formula`*: - Upload logs for a failed build of *`formula`* to a new Gist. +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`*. - *`formula`* is usually the name of the formula to install, but it can be specified - in several different ways. See [SPECIFYING FORMULAE](#specifying-formulae). +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. - If `--with-hostname` is passed, include the hostname in the Gist. +* `--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 `--new-issue` is passed, automatically create a new issue in the appropriate - GitHub repository as well as creating the Gist. +### `tap-info` [*`options`*] [*`tap`*] - If `--private` is passed, the Gist will be marked private and will not - appear in listings but will be accessible with the link. +Display detailed information about one or more provided *`tap`*. +Display a brief summary of all installed taps if no *`tap`* are passed. - If no logs are found, an error message is presented. +* `--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: - * `home`: - Open Homebrew's own homepage in a browser. +### `tap-pin` *`tap`* - * `home` *`formula`*: - Open *`formula`*'s homepage in a browser. +Pin *`tap`*, prioritising its formulae over core when formula names are supplied +by the user. See also `tap-unpin`. - * `info`: - Display brief statistics for your Homebrew installation. +### `tap-unpin` *`tap`* - * `info` `--analytics` [`--days=`*`days`*] [`--category=`*`category`*]: - Display Homebrew analytics data (provided neither `HOMEBREW_NO_ANALYTICS` - or `HOMEBREW_NO_GITHUB_API` are set) +Unpin *`tap`* so its formulae are no longer prioritised. See also `tap-pin`. - The value for `days` must be `30`, `90` or `365`. The default is `30`. +### `uninstall`, `rm`, `remove` [*`options`*] *`formula`* - The value for `category` must be `install`, `install-on-request`, - `build-error` or `os-version`. The default is `install`. +Uninstall *`formula`*. - * `info` *`formula`* [`--analytics`]: - Display information about *`formula`* and analytics data (provided neither - `HOMEBREW_NO_ANALYTICS` or `HOMEBREW_NO_GITHUB_API` are set) +* `--ignore-dependencies`: + Don't fail uninstall, even if *`formula`* is a dependency of any installed formulae. - Pass `--verbose` to see more verbose analytics data. +### `unlink` [*`options`*] *`formula`* - Pass `--analytics` to see only more verbose analytics data instead of - formula information. +Remove symlinks for *`formula`* from the Homebrew prefix. This can be useful +for temporarily disabling a formula: +`brew unlink` *`formula`* `&&` *`commands`* `&& brew link` *`formula`* - * `info` `--github` *`formula`*: - Open a browser to the GitHub History page for *`formula`*. +* `-n`, `--dry-run`: + List all files which would be unlinked, but will not actually unlink or delete any files. - To view formula history locally: `brew log -p` *`formula`* +### `unpack` [*`options`*] *`formula`* - * `info` `--json[=`*`version`*] (`--all`|`--installed`|*`formulae`*): - Print a JSON representation of *`formulae`*. Currently the default and - only accepted value for *`version`* is `v1`. +Unpack the source files for *`formula`* into subdirectories of the current +working directory. - Pass `--all` to get information on all formulae, or `--installed` to get - information on all installed formulae. +* `--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. - See the docs for examples of using the JSON output: - +### `unpin` *`formula`* - * `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`*. +Unpin *`formula`*, allowing them to be upgraded by `brew upgrade` *`formula`*. +See also `pin`. - *`formula`* is usually the name of the formula to install, but it can be specified - in several different ways. See [SPECIFYING FORMULAE](#specifying-formulae). +### `untap` *`tap`* - 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. +Remove a tapped repository. - If `--env=std` is passed, use the standard build environment instead of superenv. +### `update` [*`options`*] +Fetch the newest version of Homebrew and all formulae from GitHub using `git`(1) and perform any necessary migrations. - If `--env=super` is passed, use superenv even if the formula specifies the - standard build environment. +* `--merge`: + `git merge` is used to include updates (rather than `git rebase`). - 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. +* `--force`: + Always do a slower, full update check (even if unnecessary). - If `--only-dependencies` is passed, install the dependencies with specified - options but do not install the specified formula. +### `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 `--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` [*`options`*] *`formula`* - 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. +Upgrade outdated, unpinned brews (with existing and any appended install options). - 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 *`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. +Unless `HOMEBREW_NO_INSTALL_CLEANUP` is set, `brew cleanup` will be run for the upgraded formulae or, every 30 days, for all formulae. - If `--include-test` is passed, install testing dependencies. These are only - needed by formulae maintainers to run `brew test`. +* `-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 `--devel` is passed, and *`formula`* defines it, install the development version. +### `uses` [*`options`*] *`formula`* - If `--HEAD` is passed, and *`formula`* defines it, install the HEAD version, - aka master, trunk, unstable. +Show the formulae that specify *`formula`* as a dependency. When given +multiple formula arguments, show the intersection of formulae that use +*`formula`*. - If `--keep-tmp` is passed, the temporary files created during installation - are not deleted. +By default, `uses` shows all formulae that specify *`formula`* as a required +or recommended dependency. - If `--build-bottle` is passed, prepare the formula for eventual bottling - during installation. +By default, `uses` shows usage of *`formula`* by stable builds. - If `--force` (or `-f`) is passed, install without checking for previously - installed keg-only or non-migrated versions +* `--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 `--verbose` (or `-v`) is passed, print the verification and postinstall steps. +### `--cache` [*`options`*] [*`formula`*] - If `--display-times` is passed, install times for each formula are printed - at the end of the run. +Display Homebrew's download cache. See also `HOMEBREW_CACHE`. - Installation options specific to *`formula`* may be appended to the command, - and can be listed with `brew options` *`formula`*. +If *`formula`* is provided, display the file or directory used to cache *`formula`*. - * `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. +* `-s`, `--build-from-source`: + Show the cache file used when building from source. +* `--force-bottle`: + Show the cache file used when pouring a bottle. - If `--git` (or `-g`) is passed, Homebrew will create a Git repository, useful for - creating patches to the software. +### `--cache` [*`formula`*] - * `leaves`: - Show installed formulae that are not dependencies of another installed formula. +Display Homebrew's Cellar path. *Default:* `$(brew --prefix)/Cellar`, or if +that directory doesn't exist, `$(brew --repository)/Cellar`. - * `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. +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. - If `--overwrite` is passed, Homebrew will delete files which already exist in - the prefix while linking. +### `--env` [*`options`*] - 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. +Show a summary of the Homebrew build environment as a plain list. - If `--force` (or `-f`) is passed, Homebrew will allow keg-only formulae to be linked. +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. - * `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. +* `--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` `--unbrewed`: - List all files in the Homebrew prefix not installed by Homebrew. +### `--prefix` [*`formula`*] - * `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. +Display Homebrew's install path. *Default:* `/usr/local` on macOS and +`/home/linuxbrew/.linuxbrew` on Linux. - 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. +If *`formula`* is provided, display the location in the cellar where *`formula`* +is or would be installed. - If `--pinned` is passed, show the versions of pinned formulae, or only the - specified (pinned) formulae if *`formulae`* are given. - See also `pin`, `unpin`. +### `--repository` [*`user`*`/`*`repo`*] - * `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. +Display where Homebrew's `.git` directory is located. - * `migrate` [`--force`] *`formulae`*: - Migrate renamed packages to new name, where *`formulae`* are old names of - packages. +If *`user`*`/`*`repo`* are provided, display where tap *`user`*`/`*`repo`*'s directory is located. - If `--force` (or `-f`) is passed, then treat installed *`formulae`* and passed *`formulae`* - like if they are from same taps and migrate them anyway. +### `--version` - * `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` [`--display-times`] *`formula`*: - Uninstall and then install *`formula`* (with existing install options). - - 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. - - * `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` [*`install-options`*] [`--fetch-HEAD`] [`--ignore-pinned`] [`--display-times`] [*`formulae`*]: - Upgrade outdated, unpinned brews (with existing install options). - - Options for the `install` command are also valid here. - - 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 `--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`). - - * `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. @@ -704,7 +671,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`. @@ -801,12 +768,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 @@ -816,11 +782,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. @@ -830,7 +795,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. @@ -851,35 +816,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. @@ -913,11 +860,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. @@ -926,8 +872,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 @@ -957,7 +902,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`*] @@ -973,8 +918,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 @@ -994,80 +940,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 @@ -1152,6 +1041,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. @@ -1185,16 +1080,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. @@ -1212,11 +1097,11 @@ 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`: - 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 @@ -1238,8 +1123,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. @@ -1308,15 +1193,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, 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. @@ -1330,7 +1215,6 @@ See our issues on GitHub: * **Homebrew/homebrew-core**: - [SYNOPSIS]: #SYNOPSIS "SYNOPSIS" [DESCRIPTION]: #DESCRIPTION "DESCRIPTION" [ESSENTIAL COMMANDS]: #ESSENTIAL-COMMANDS "ESSENTIAL COMMANDS" @@ -1346,5 +1230,4 @@ See our issues on GitHub: [AUTHORS]: #AUTHORS "AUTHORS" [BUGS]: #BUGS "BUGS" - [-]: -.html diff --git a/docs/New-Maintainer-Checklist.md b/docs/New-Maintainer-Checklist.md index 3d83da9859..ebdd68d402 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 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 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/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 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. 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..9f779b7a25 --- /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/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: + +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) 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! diff --git a/manpages/brew-cask.1 b/manpages/brew-cask.1 index 7f546ba296..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 @@ -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\. . diff --git a/manpages/brew.1 b/manpages/brew.1 index 150a0e80b2..2c6cb8d9c7 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 @@ -21,676 +21,772 @@ 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 -Display the source to \fIformula\fR\. +.SS "\fBcat\fR \fIformula\fR" +Display the source of \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 +. +.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\. . -.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] \fIformulae\fR -Show dependencies for \fIformulae\fR\. When given multiple formula arguments, show the intersection of dependencies for \fIformulae\fR\. -. -.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 \fIformulae\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 \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\. -. -.TP -\fBdeps\fR \fB\-\-tree\fR [\fB\-\-1\fR] [\fIfilters\fR] [\fB\-\-annotate\fR] (\fIformulae\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\. -. -.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) 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\. See \fISPECIFYING FORMULAE\fR\. -. -.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\. +.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 \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\. -. -.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 -. -.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 -. -.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\. See \fISPECIFYING FORMULAE\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\-\-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 \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 -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\-\-1\fR +Only show dependencies one level down, instead of recursing\. . .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\-n\fR +Show dependencies in topological order\. . .TP -\fBleaves\fR -Show installed formulae that are not dependencies of another installed formula\. +\fB\-\-union\fR +Show the union of dependencies for \fIformula\fR, instead of the intersection\. . .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\-\-full\-name\fR +List dependencies by their full name\. . .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\-\-installed\fR +Only list those dependencies that are currently installed\. . .TP -\fBlist\fR, \fBls\fR \fB\-\-unbrewed\fR -List all files in the Homebrew prefix not installed by Homebrew\. +\fB\-\-all\fR +List all the dependencies for all available formulae\. . .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\-build\fR +Show \fB:build\fR type dependencies for \fIformula\fR\. . .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\-\-include\-optional\fR +Show \fB:optional\fR 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\-test\fR +Show \fB:test\fR dependencies for \fIformula\fR (non\-recursive)\. . .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\. +\fB\-\-skip\-recommended\fR +Skip \fB:recommended\fR type dependencies for \fIformula\fR\. . .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\-\-include\-requirements\fR +Include requirements in addition to dependencies for \fIformula\fR\. . .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)\. -. -.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\. +\fB\-\-tree\fR +Show dependencies as a tree\. When given multiple formula arguments output individual trees for every formula\. . .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\-\-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\. . -.TP -\fBpostinstall\fR \fIformula\fR -Rerun the post\-install steps for \fIformula\fR\. +.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 -\fBprune\fR [\fB\-\-dry\-run\fR] -Deprecated\. Use \fBbrew cleanup\fR instead\. +\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 -\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\. +\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 -\fBreinstall\fR [\fB\-\-display\-times\fR] \fIformula\fR -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\. +\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 -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\. -. -.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 [\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)\. -. -.IP -Options for the \fBinstall\fR command are also valid here\. -. -.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\-\-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)\. -. -.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\. +. +.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\. +. +.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\-\-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\. +. +.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)\. +. +.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\. +. +.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)\. +. +.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\. +. +.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 [\fIuser\fR\fB/\fR\fIrepo\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 @@ -736,7 +832,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 @@ -878,7 +974,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" @@ -888,7 +984,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]" @@ -902,7 +998,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 @@ -928,32 +1024,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 @@ -1006,11 +1084,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 @@ -1019,7 +1094,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 @@ -1062,7 +1137,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\. @@ -1083,10 +1158,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\. @@ -1109,102 +1182,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 . @@ -1279,6 +1274,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\. . @@ -1312,16 +1314,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\. . @@ -1342,11 +1334,11 @@ 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 -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 @@ -1368,7 +1360,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 @@ -1454,19 +1446,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, 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\.