From f87ce3fffb919bcfe66c2db592aa07057b54bde9 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 11 Dec 2020 14:03:20 +0000 Subject: [PATCH] formula: deprecate!/disable!: deprecate missing or non-ISO 8601 dates. As requested in https://github.com/Homebrew/homebrew-core/issues/66360 --- Library/Homebrew/formula.rb | 2 ++ Library/Homebrew/test/livecheck/livecheck_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 08ec8a21b4..46b0db8bbb 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -2767,6 +2767,7 @@ class Formula #
deprecate! date: "2020-08-27", because: "has been replaced by foo"
def deprecate!(date: nil, because: nil) odeprecated "`deprecate!` without a reason", "`deprecate! because: \"reason\"`" if because.blank? + odeprecated "`deprecate!` without a date", "`deprecate! date: \"#{Date.today}\"`" if date.blank? return if date.present? && Date.parse(date) > Date.today @@ -2793,6 +2794,7 @@ class Formula #
disable! date: "2020-08-27", because: "has been replaced by foo"
def disable!(date: nil, because: nil) odeprecated "`disable!` without a reason", "`disable! because: \"reason\"`" if because.blank? + odeprecated "`disable!` without a date", "`disable! date: \"#{Date.today}\"`" if date.blank? if date.present? && Date.parse(date) > Date.today @deprecation_reason = because if because.present? diff --git a/Library/Homebrew/test/livecheck/livecheck_spec.rb b/Library/Homebrew/test/livecheck/livecheck_spec.rb index 261896abd9..65d5359e57 100644 --- a/Library/Homebrew/test/livecheck/livecheck_spec.rb +++ b/Library/Homebrew/test/livecheck/livecheck_spec.rb @@ -25,7 +25,7 @@ describe Homebrew::Livecheck do desc "Deprecated test formula" homepage "https://brew.sh" url "https://brew.sh/test-0.0.1.tgz" - deprecate! because: :unmaintained + deprecate! date: "2020-06-25", because: :unmaintained end end @@ -34,7 +34,7 @@ describe Homebrew::Livecheck do desc "Disabled test formula" homepage "https://brew.sh" url "https://brew.sh/test-0.0.1.tgz" - disable! because: :unmaintained + disable! date: "2020-06-25", because: :unmaintained end end