aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/update.rb20
-rw-r--r--Library/Homebrew/cask/lib/hbc/locations.rb2
-rw-r--r--Library/Homebrew/cmd/uninstall.rb2
-rw-r--r--Library/Homebrew/cmd/update-report.rb23
-rw-r--r--Library/Homebrew/compat/hbc.rb1
-rw-r--r--Library/Homebrew/compat/hbc/cli/update.rb23
-rw-r--r--Library/Homebrew/dev-cmd/audit.rb31
-rw-r--r--Library/Homebrew/development_tools.rb4
-rw-r--r--Library/Homebrew/extend/os/linux/hardware/cpu.rb2
-rw-r--r--Library/Homebrew/extend/os/mac/development_tools.rb5
-rw-r--r--Library/Homebrew/formula.rb5
-rw-r--r--Library/Homebrew/formula_installer.rb24
-rw-r--r--Library/Homebrew/formulary.rb2
-rw-r--r--Library/Homebrew/global.rb8
-rw-r--r--Library/Homebrew/keg.rb17
-rw-r--r--Library/Homebrew/manpages/brew-cask.1.md3
-rwxr-xr-xLibrary/Homebrew/shims/super/cc9
-rw-r--r--Library/Homebrew/test/formula_test.rb38
-rw-r--r--Library/Homebrew/test/hardware_test.rb2
-rw-r--r--Library/Homebrew/test/keg_test.rb22
-rw-r--r--Library/Homebrew/test/utils_test.rb2
-rw-r--r--Library/Homebrew/utils.rb29
-rw-r--r--Library/Homebrew/utils/curl.rb29
-rw-r--r--completions/zsh/_brew_cask1
-rw-r--r--manpages/brew-cask.13
26 files changed, 214 insertions, 95 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli.rb b/Library/Homebrew/cask/lib/hbc/cli.rb
index c9625c7e2..42c3982ba 100644
--- a/Library/Homebrew/cask/lib/hbc/cli.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli.rb
@@ -19,7 +19,6 @@ require "hbc/cli/reinstall"
require "hbc/cli/search"
require "hbc/cli/style"
require "hbc/cli/uninstall"
-require "hbc/cli/update"
require "hbc/cli/zap"
require "hbc/cli/internal_use_base"
@@ -77,6 +76,7 @@ module Hbc
def self.command_classes
@command_classes ||= constants.map(&method(:const_get))
.select { |sym| sym.respond_to?(:run) }
+ .sort_by(&:command_name)
end
def self.commands
diff --git a/Library/Homebrew/cask/lib/hbc/cli/update.rb b/Library/Homebrew/cask/lib/hbc/cli/update.rb
deleted file mode 100644
index 86d02bb55..000000000
--- a/Library/Homebrew/cask/lib/hbc/cli/update.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-module Hbc
- class CLI
- class Update < Base
- def self.run(*_ignored)
- result = SystemCommand.run(HOMEBREW_BREW_FILE,
- args: ["update"])
- # TODO: separating stderr/stdout is undesirable here.
- # Hbc::SystemCommand should have an option for plain
- # unbuffered output.
- print result.stdout
- $stderr.print result.stderr
- exit result.exit_status
- end
-
- def self.help
- "a synonym for 'brew update'"
- end
- end
- end
-end
diff --git a/Library/Homebrew/cask/lib/hbc/locations.rb b/Library/Homebrew/cask/lib/hbc/locations.rb
index f28e84b2e..292b45d0c 100644
--- a/Library/Homebrew/cask/lib/hbc/locations.rb
+++ b/Library/Homebrew/cask/lib/hbc/locations.rb
@@ -1,3 +1,5 @@
+require "tap"
+
module Hbc
module Locations
def self.included(base)
diff --git a/Library/Homebrew/cmd/uninstall.rb b/Library/Homebrew/cmd/uninstall.rb
index 505d4e4b2..c08b13dad 100644
--- a/Library/Homebrew/cmd/uninstall.rb
+++ b/Library/Homebrew/cmd/uninstall.rb
@@ -121,7 +121,7 @@ module Homebrew
end
def sample_command
- "brew uninstall --ignore-dependencies #{list reqs.map(&:name)}"
+ "brew uninstall --ignore-dependencies #{ARGV.named.join(" ")}"
end
def are_required_by_deps
diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb
index 10b433dd2..caa1e01ad 100644
--- a/Library/Homebrew/cmd/update-report.rb
+++ b/Library/Homebrew/cmd/update-report.rb
@@ -421,18 +421,27 @@ class Reporter
new_tap_name = tap.tap_migrations[name]
next if new_tap_name.nil? # skip if not in tap_migrations list.
+ new_tap_user, new_tap_repo, new_tap_new_name = new_tap_name.split("/")
+ new_name = if new_tap_new_name
+ new_full_name = new_tap_new_name
+ new_tap_name = "#{new_tap_user}/#{new_tap_repo}"
+ new_tap_new_name
+ else
+ new_full_name = "#{new_tap_name}/#{name}"
+ name
+ end
+
# This means it is a Cask
if report[:DC].include? full_name
- next unless (HOMEBREW_PREFIX/"Caskroom"/name).exist?
+ next unless (HOMEBREW_PREFIX/"Caskroom"/new_name).exist?
new_tap = Tap.fetch(new_tap_name)
new_tap.install unless new_tap.installed?
ohai "#{name} has been moved to Homebrew.", <<-EOS.undent
To uninstall the cask run:
brew cask uninstall --force #{name}
EOS
- new_full_name = "#{new_tap_name}/#{name}"
- next if (HOMEBREW_CELLAR/name.split("/").last).directory?
- ohai "Installing #{name}..."
+ next if (HOMEBREW_CELLAR/new_name.split("/").last).directory?
+ ohai "Installing #{new_name}..."
system HOMEBREW_BREW_FILE, "install", new_full_name
begin
unless Formulary.factory(new_full_name).keg_only?
@@ -456,13 +465,13 @@ class Reporter
system HOMEBREW_BREW_FILE, "uninstall", "--force", name
ohai "brew prune"
system HOMEBREW_BREW_FILE, "prune"
- ohai "brew cask install #{name}"
- system HOMEBREW_BREW_FILE, "cask", "install", name
+ ohai "brew cask install #{new_name}"
+ system HOMEBREW_BREW_FILE, "cask", "install", new_name
else
ohai "#{name} has been moved to Homebrew-Cask.", <<-EOS.undent
To uninstall the formula and install the cask run:
brew uninstall --force #{name}
- brew cask install #{name}
+ brew cask install #{new_name}
EOS
end
else
diff --git a/Library/Homebrew/compat/hbc.rb b/Library/Homebrew/compat/hbc.rb
index a1d1414a5..179639953 100644
--- a/Library/Homebrew/compat/hbc.rb
+++ b/Library/Homebrew/compat/hbc.rb
@@ -1 +1,2 @@
require "compat/hbc/cask_loader"
+require "compat/hbc/cli/update"
diff --git a/Library/Homebrew/compat/hbc/cli/update.rb b/Library/Homebrew/compat/hbc/cli/update.rb
new file mode 100644
index 000000000..7820997cb
--- /dev/null
+++ b/Library/Homebrew/compat/hbc/cli/update.rb
@@ -0,0 +1,23 @@
+require "cask/lib/hbc/cli/base"
+
+module Hbc
+ class CLI
+ class Update < Base
+ def self.run(*_ignored)
+ odeprecated "`brew cask update`", "`brew update`", disable_on: Time.utc(2017, 7, 1)
+ result = SystemCommand.run(HOMEBREW_BREW_FILE, args: ["update"],
+ print_stderr: true,
+ print_stdout: true)
+ exit result.exit_status
+ end
+
+ def self.visible
+ false
+ end
+
+ def self.help
+ "a synonym for 'brew update'"
+ end
+ end
+ end
+end
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb
index ef22cbb7a..74ba987f6 100644
--- a/Library/Homebrew/dev-cmd/audit.rb
+++ b/Library/Homebrew/dev-cmd/audit.rb
@@ -169,6 +169,33 @@ class FormulaAuditor
@specs = %w[stable devel head].map { |s| formula.send(s) }.compact
end
+ def url_status_code(url, range: false)
+ # The system Curl is too old and unreliable with HTTPS homepages on
+ # Yosemite and below.
+ return "200" unless DevelopmentTools.curl_handles_most_https_homepages?
+
+ extra_args = [
+ "--connect-timeout", "15",
+ "--output", "/dev/null",
+ "--write-out", "%{http_code}"
+ ]
+ extra_args << "--range" << "0-0" if range
+ extra_args << url
+
+ args = curl_args(
+ extra_args: extra_args,
+ show_output: true,
+ default_user_agent: true
+ )
+ retries = 3
+ status_code = nil
+ retries.times do
+ status_code = Open3.popen3(*args) { |_, stdout, _, _| stdout.read }
+ break if status_code.start_with? "20"
+ end
+ status_code
+ end
+
def audit_style
return unless @style_offenses
display_cop_names = ARGV.include?("--display-cop-names")
@@ -569,8 +596,8 @@ class FormulaAuditor
end
return unless @online
- status_code, = curl_output "--connect-timeout", "15", "--output", "/dev/null", "--range", "0-0",
- "--write-out", "%{http_code}", homepage
+
+ status_code = url_status_code(homepage)
return if status_code.start_with? "20"
problem "The homepage #{homepage} is not reachable (HTTP status code #{status_code})"
end
diff --git a/Library/Homebrew/development_tools.rb b/Library/Homebrew/development_tools.rb
index 10020a236..625d5ea86 100644
--- a/Library/Homebrew/development_tools.rb
+++ b/Library/Homebrew/development_tools.rb
@@ -114,8 +114,8 @@ class DevelopmentTools
@non_apple_gcc_version = {}
end
- def tar_supports_xz?
- false
+ def curl_handles_most_https_homepages?
+ true
end
end
end
diff --git a/Library/Homebrew/extend/os/linux/hardware/cpu.rb b/Library/Homebrew/extend/os/linux/hardware/cpu.rb
index 2472c60ed..9d779f789 100644
--- a/Library/Homebrew/extend/os/linux/hardware/cpu.rb
+++ b/Library/Homebrew/extend/os/linux/hardware/cpu.rb
@@ -47,6 +47,8 @@ module Hardware
:haswell
when 0x3d, 0x47, 0x4f, 0x56
:broadwell
+ when 0x8e
+ :kabylake
else
cpu_family_model
end
diff --git a/Library/Homebrew/extend/os/mac/development_tools.rb b/Library/Homebrew/extend/os/mac/development_tools.rb
index b80d70d5b..1bb12a3d1 100644
--- a/Library/Homebrew/extend/os/mac/development_tools.rb
+++ b/Library/Homebrew/extend/os/mac/development_tools.rb
@@ -77,8 +77,9 @@ class DevelopmentTools
end
end
- def tar_supports_xz?
- false
+ def curl_handles_most_https_homepages?
+ # The system Curl is too old for some modern HTTPS homepages on Yosemite.
+ MacOS.version >= :el_capitan
end
end
end
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index b3927d260..bc1dbd970 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -1505,7 +1505,10 @@ class Formula
# Returns a list of Dependency objects that are required at runtime.
# @private
def runtime_dependencies
- recursive_dependencies.reject(&:build?)
+ recursive_dependencies do |_dependent, dependency|
+ Dependency.prune if dependency.build?
+ Dependency.prune if !dependency.required? && build.without?(dependency)
+ end
end
# Returns a list of formulae depended on by this formula that aren't
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index bd1cc9379..90e283c9b 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -146,7 +146,29 @@ class FormulaInstaller
return if ignore_deps?
recursive_deps = formula.recursive_dependencies
- unlinked_deps = recursive_deps.map(&:to_formula).select do |dep|
+ recursive_formulae = recursive_deps.map(&:to_formula)
+
+ if ENV["HOMEBREW_CHECK_RECURSIVE_VERSION_DEPENDENCIES"]
+ version_hash = {}
+ version_conflicts = Set.new
+ recursive_formulae.each do |f|
+ name = f.name
+ unversioned_name, = name.split("@")
+ version_hash[unversioned_name] ||= Set.new
+ version_hash[unversioned_name] << name
+ next if version_hash[unversioned_name].length < 2
+ version_conflicts += version_hash[unversioned_name]
+ end
+ unless version_conflicts.empty?
+ raise CannotInstallFormulaError, <<-EOS.undent
+ #{formula.full_name} contains conflicting version recursive dependencies:
+ #{version_conflicts.to_a.join ", "}
+ View these with `brew deps --tree #{formula.full_name}`.
+ EOS
+ end
+ end
+
+ unlinked_deps = recursive_formulae.select do |dep|
dep.installed? && !dep.keg_only? && !dep.linked_keg.directory?
end
diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb
index 40370cec3..fadd89457 100644
--- a/Library/Homebrew/formulary.rb
+++ b/Library/Homebrew/formulary.rb
@@ -186,6 +186,8 @@ class Formulary
name = new_name
new_name = @tap.core_tap? ? name : "#{@tap}/#{name}"
elsif (new_tap_name = @tap.tap_migrations[name])
+ new_tap_user, new_tap_repo, = new_tap_name.split("/")
+ new_tap_name = "#{new_tap_user}/#{new_tap_repo}"
new_tap = Tap.fetch new_tap_name
new_tap.install unless new_tap.installed?
new_tapped_name = "#{new_tap_name}/#{name}"
diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb
index eabc4c164..9a2f0c794 100644
--- a/Library/Homebrew/global.rb
+++ b/Library/Homebrew/global.rb
@@ -27,14 +27,6 @@ RUBY_BIN = RUBY_PATH.dirname
HOMEBREW_USER_AGENT_CURL = ENV["HOMEBREW_USER_AGENT_CURL"]
HOMEBREW_USER_AGENT_RUBY = "#{ENV["HOMEBREW_USER_AGENT"]} ruby/#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}".freeze
-HOMEBREW_CURL_ARGS = [
- "--fail",
- "--progress-bar",
- "--remote-time",
- "--location",
- "--user-agent", HOMEBREW_USER_AGENT_CURL
-].freeze
-
require "tap_constants"
module Homebrew
diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb
index 1de4ce1f0..756b27288 100644
--- a/Library/Homebrew/keg.rb
+++ b/Library/Homebrew/keg.rb
@@ -139,6 +139,10 @@ class Keg
raise NotAKegError, "#{path} is not inside a keg"
end
+ def self.all
+ Formula.racks.flat_map(&:subdirs).map { |d| new(d) }
+ end
+
attr_reader :path, :name, :linked_keg_record, :opt_record
protected :path
@@ -353,14 +357,21 @@ class Keg
end
def installed_dependents
- Formula.installed.flat_map(&:installed_kegs).select do |keg|
+ tap = Tab.for_keg(self).source["tap"]
+ Keg.all.select do |keg|
tab = Tab.for_keg(keg)
next if tab.runtime_dependencies.nil? # no dependency information saved.
tab.runtime_dependencies.any? do |dep|
# Resolve formula rather than directly comparing names
# in case of conflicts between formulae from different taps.
- dep_formula = Formulary.factory(dep["full_name"])
- dep_formula == to_formula && dep["version"] == version.to_s
+ begin
+ dep_formula = Formulary.factory(dep["full_name"])
+ next false unless dep_formula == to_formula
+ rescue FormulaUnavailableError
+ next false unless "#{tap}/#{name}" == dep["full_name"]
+ end
+
+ dep["version"] == version.to_s
end
end
end
diff --git a/Library/Homebrew/manpages/brew-cask.1.md b/Library/Homebrew/manpages/brew-cask.1.md
index feab9f76e..f0a70d4a7 100644
--- a/Library/Homebrew/manpages/brew-cask.1.md
+++ b/Library/Homebrew/manpages/brew-cask.1.md
@@ -104,9 +104,6 @@ names, and other aspects of this manual are still subject to change.
Uninstall the given Cask. With `--force`, uninstall even if the Cask
does not appear to be present.
- * `update`:
- For convenience. `brew cask update` is a synonym for `brew update`.
-
* `zap` <token> [ <token> ... ]:
Unconditionally remove _all_ files associated with the given Cask.
diff --git a/Library/Homebrew/shims/super/cc b/Library/Homebrew/shims/super/cc
index b0ea705e8..1400788ba 100755
--- a/Library/Homebrew/shims/super/cc
+++ b/Library/Homebrew/shims/super/cc
@@ -206,10 +206,6 @@ class Cmd
end
def keep?(path)
- # The logic in this method will eventually become the default,
- # but is currently opt-in.
- return keep_orig?(path) unless ENV["HOMEBREW_EXPERIMENTAL_FILTER_FLAGS_ON_DEPS"]
-
# Allow references to self
if formula_prefix && path.start_with?("#{formula_prefix}/")
true
@@ -226,11 +222,6 @@ class Cmd
end
end
- # The original less-smart version of keep_orig; will eventually be removed
- def keep_orig?(path)
- path.start_with?(prefix, cellar, tmpdir) || !path.start_with?("/opt/local", "/opt/boxen/homebrew", "/opt/X11", "/sw", "/usr/X11")
- end
-
def cflags
args = []
diff --git a/Library/Homebrew/test/formula_test.rb b/Library/Homebrew/test/formula_test.rb
index a6db1b57f..81022d220 100644
--- a/Library/Homebrew/test/formula_test.rb
+++ b/Library/Homebrew/test/formula_test.rb
@@ -651,12 +651,42 @@ class FormulaTests < Homebrew::TestCase
f4 = formula("f4") do
url "f4-1.0"
- depends_on "f3"
+ depends_on "f1"
end
+ stub_formula_loader f4
- assert_equal %w[f3], f4.deps.map(&:name)
- assert_equal %w[f1 f2 f3], f4.recursive_dependencies.map(&:name)
- assert_equal %w[f2 f3], f4.runtime_dependencies.map(&:name)
+ f5 = formula("f5") do
+ url "f5-1.0"
+ depends_on "f3" => :build
+ depends_on "f4"
+ end
+
+ assert_equal %w[f3 f4], f5.deps.map(&:name)
+ assert_equal %w[f1 f2 f3 f4], f5.recursive_dependencies.map(&:name)
+ assert_equal %w[f1 f4], f5.runtime_dependencies.map(&:name)
+ end
+
+ def test_runtime_dependencies_with_optional_deps_from_tap
+ tap_loader = mock
+ tap_loader.stubs(:get_formula).raises(RuntimeError, "tried resolving tap formula")
+ Formulary.stubs(:loader_for).with("foo/bar/f1", from: nil).returns(tap_loader)
+
+ stub_formula_loader formula("f2") { url "f2-1.0" }, "baz/qux/f2"
+
+ f3 = formula("f3") do
+ url "f3-1.0"
+ depends_on "foo/bar/f1" => :optional
+ depends_on "baz/qux/f2"
+ end
+
+ # f1 shouldn't be loaded by default.
+ # If it is, an exception will be raised.
+ assert_equal %w[baz/qux/f2], f3.runtime_dependencies.map(&:name)
+
+ # If --with-f1, f1 should be loaded.
+ stub_formula_loader formula("f1") { url "f1-1.0" }, "foo/bar/f1"
+ f3.build = BuildOptions.new(Options.create(%w[--with-f1]), f3.options)
+ assert_equal %w[foo/bar/f1 baz/qux/f2], f3.runtime_dependencies.map(&:name)
end
def test_to_hash
diff --git a/Library/Homebrew/test/hardware_test.rb b/Library/Homebrew/test/hardware_test.rb
index 2bea5387d..69f881a60 100644
--- a/Library/Homebrew/test/hardware_test.rb
+++ b/Library/Homebrew/test/hardware_test.rb
@@ -8,7 +8,7 @@ class HardwareTests < Homebrew::TestCase
if Hardware::CPU.intel?
def test_hardware_intel_family
- families = [:core, :core2, :penryn, :nehalem, :arrandale, :sandybridge, :ivybridge, :haswell, :broadwell, :skylake, :dunno]
+ families = [:core, :core2, :penryn, :nehalem, :arrandale, :sandybridge, :ivybridge, :haswell, :broadwell, :skylake, :kabylake, :dunno]
assert_includes families, Hardware::CPU.family
end
end
diff --git a/Library/Homebrew/test/keg_test.rb b/Library/Homebrew/test/keg_test.rb
index 2c91027e5..4fe7c6a3c 100644
--- a/Library/Homebrew/test/keg_test.rb
+++ b/Library/Homebrew/test/keg_test.rb
@@ -2,7 +2,7 @@ require "testing_env"
require "keg"
require "stringio"
-class LinkTests < Homebrew::TestCase
+class LinkTestCase < Homebrew::TestCase
include FileUtils
def setup_test_keg(name, version)
@@ -44,6 +44,13 @@ class LinkTests < Homebrew::TestCase
rmtree HOMEBREW_PREFIX/"bin"
rmtree HOMEBREW_PREFIX/"lib"
end
+end
+
+class LinkTests < LinkTestCase
+ def test_all
+ Formula.clear_racks_cache
+ assert_equal [@keg], Keg.all
+ end
def test_empty_installation
%w[.DS_Store INSTALL_RECEIPT.json LICENSE.txt].each do |file|
@@ -315,7 +322,7 @@ class LinkTests < Homebrew::TestCase
end
end
-class InstalledDependantsTests < LinkTests
+class InstalledDependantsTests < LinkTestCase
def stub_formula_name(name)
f = formula(name) { url "foo-1.0" }
stub_formula_loader f
@@ -353,10 +360,13 @@ class InstalledDependantsTests < LinkTests
# from a file path or URL.
def test_unknown_formula
Formulary.unstub(:loader_for)
- dependencies []
- alter_tab { |t| t.source["path"] = nil }
- assert_empty @keg.installed_dependents
- assert_nil Keg.find_some_installed_dependents([@keg])
+ alter_tab(@keg) do |t|
+ t.source["tap"] = "some/tap"
+ t.source["path"] = nil
+ end
+ dependencies [{ "full_name" => "some/tap/foo", "version" => "1.0" }]
+ assert_equal [@dependent], @keg.installed_dependents
+ assert_equal [[@keg], ["bar 1.0"]], Keg.find_some_installed_dependents([@keg])
end
def test_no_dependencies_anywhere
diff --git a/Library/Homebrew/test/utils_test.rb b/Library/Homebrew/test/utils_test.rb
index 146f57b49..d7c25683d 100644
--- a/Library/Homebrew/test/utils_test.rb
+++ b/Library/Homebrew/test/utils_test.rb
@@ -216,7 +216,7 @@ class UtilTests < Homebrew::TestCase
e = assert_raises(MethodDeprecatedError) do
odeprecated("method", "replacement",
caller: ["#{HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core/"],
- die: true)
+ disable: true)
end
assert_match "method", e.message
assert_match "replacement", e.message
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 4ad97c7d4..614d50eea 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -11,6 +11,7 @@ require "utils/hash"
require "utils/inreplace"
require "utils/popen"
require "utils/tty"
+require "time"
def ohai(title, *sput)
title = Tty.truncate(title) if $stdout.tty? && !ARGV.verbose?
@@ -44,24 +45,32 @@ def odie(error)
exit 1
end
-def odeprecated(method, replacement = nil, options = {})
- verb = if options[:die]
- "disabled"
- else
- "deprecated"
- end
-
+def odeprecated(method, replacement = nil, disable: false, disable_on: nil, caller: send(:caller))
replacement_message = if replacement
"Use #{replacement} instead."
else
"There is no replacement."
end
+ unless disable_on.nil?
+ if disable_on > Time.now
+ will_be_disabled_message = " and will be disabled on #{disable_on.strftime("%Y-%m-%d")}"
+ else
+ disable = true
+ end
+ end
+
+ verb = if disable
+ "disabled"
+ else
+ "deprecated#{will_be_disabled_message}"
+ end
+
# Try to show the most relevant location in message, i.e. (if applicable):
# - Location in a formula.
# - Location outside of 'compat/'.
# - Location of caller of deprecated method (if all else fails).
- backtrace = options.fetch(:caller, caller)
+ backtrace = caller
tap_message = nil
caller_message = backtrace.detect do |line|
next unless line =~ %r{^#{Regexp.escape HOMEBREW_LIBRARY}/Taps/([^/]+/[^/]+)/}
@@ -80,7 +89,7 @@ def odeprecated(method, replacement = nil, options = {})
#{caller_message}#{tap_message}
EOS
- if ARGV.homebrew_developer? || options[:die] ||
+ if ARGV.homebrew_developer? || disable ||
Homebrew.raise_deprecation_exceptions?
raise MethodDeprecatedError, message
else
@@ -89,7 +98,7 @@ def odeprecated(method, replacement = nil, options = {})
end
def odisabled(method, replacement = nil, options = {})
- options = { die: true, caller: caller }.merge(options)
+ options = { disable: true, caller: caller }.merge(options)
odeprecated(method, replacement, options)
end
diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb
index 00c3a591c..eab623c40 100644
--- a/Library/Homebrew/utils/curl.rb
+++ b/Library/Homebrew/utils/curl.rb
@@ -1,27 +1,38 @@
require "pathname"
require "open3"
-def curl_args(extra_args = [])
+def curl_args(options = {})
curl = Pathname.new ENV["HOMEBREW_CURL"]
curl = Pathname.new "/usr/bin/curl" unless curl.exist?
raise "#{curl} is not executable" unless curl.exist? && curl.executable?
- flags = HOMEBREW_CURL_ARGS
- flags -= ["--progress-bar"] if ARGV.verbose?
+ args = [
+ curl.to_s,
+ "--remote-time",
+ "--location",
+ ]
- args = [curl.to_s] + flags + extra_args
- args << "--verbose" if ENV["HOMEBREW_CURL_VERBOSE"]
- args << "--silent" if !$stdout.tty? || ENV["TRAVIS"]
+ unless options[:default_user_agent]
+ args << "--user-agent" << HOMEBREW_USER_AGENT_CURL
+ end
+
+ unless options[:show_output]
+ args << "--progress-bar" unless ARGV.verbose?
+ args << "--verbose" if ENV["HOMEBREW_CURL_VERBOSE"]
+ args << "--fail"
+ args << "--silent" if !$stdout.tty? || ENV["TRAVIS"]
+ end
+
+ args += options[:extra_args] if options[:extra_args]
args
end
def curl(*args)
- safe_system(*curl_args(args))
+ safe_system(*curl_args(extra_args: args))
end
def curl_output(*args)
- curl_args = curl_args(args)
- curl_args -= ["--fail", "--silent"]
+ curl_args = curl_args(extra_args: args, show_output: true)
Open3.popen3(*curl_args) do |_, stdout, stderr, wait_thread|
[stdout.read, stderr.read, wait_thread.value]
end
diff --git a/completions/zsh/_brew_cask b/completions/zsh/_brew_cask
index bb64a2e32..1e493fc2a 100644
--- a/completions/zsh/_brew_cask
+++ b/completions/zsh/_brew_cask
@@ -43,7 +43,6 @@ __brew_cask_commands() {
'search:searches all known Casks'
'style:checks Cask style using RuboCop'
'uninstall:uninstalls the given Cask'
- "update:a synonym for 'brew update'"
'zap:zaps all files associated with the given Cask'
)
_describe -t commands "brew cask command" commands
diff --git a/manpages/brew-cask.1 b/manpages/brew-cask.1
index af5335f79..9eaaf027a 100644
--- a/manpages/brew-cask.1
+++ b/manpages/brew-cask.1
@@ -89,9 +89,6 @@ If \fItoken\fR is given, summarize the staged files associated with the given Ca
\fBuninstall\fR or \fBrm\fR or \fBremove\fR [\-\-force] \fItoken\fR [ \fItoken\fR \.\.\. ]: Uninstall the given Cask\. With \fB\-\-force\fR, uninstall even if the Cask does not appear to be present\.
.
.IP "\(bu" 4
-\fBupdate\fR: For convenience\. \fBbrew cask update\fR is a synonym for \fBbrew update\fR\.
-.
-.IP "\(bu" 4
\fBzap\fR \fItoken\fR [ \fItoken\fR \.\.\. ]: Unconditionally remove \fIall\fR files associated with the given Cask\.
.
.IP