formula: deprecate!/disable!: deprecate missing or non-ISO 8601 dates.
As requested in https://github.com/Homebrew/homebrew-core/issues/66360
This commit is contained in:
parent
2be340c6d6
commit
f87ce3fffb
@ -2767,6 +2767,7 @@ class Formula
|
|||||||
# <pre>deprecate! date: "2020-08-27", because: "has been replaced by foo"</pre>
|
# <pre>deprecate! date: "2020-08-27", because: "has been replaced by foo"</pre>
|
||||||
def deprecate!(date: nil, because: nil)
|
def deprecate!(date: nil, because: nil)
|
||||||
odeprecated "`deprecate!` without a reason", "`deprecate! because: \"reason\"`" if because.blank?
|
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
|
return if date.present? && Date.parse(date) > Date.today
|
||||||
|
|
||||||
@ -2793,6 +2794,7 @@ class Formula
|
|||||||
# <pre>disable! date: "2020-08-27", because: "has been replaced by foo"</pre>
|
# <pre>disable! date: "2020-08-27", because: "has been replaced by foo"</pre>
|
||||||
def disable!(date: nil, because: nil)
|
def disable!(date: nil, because: nil)
|
||||||
odeprecated "`disable!` without a reason", "`disable! because: \"reason\"`" if because.blank?
|
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
|
if date.present? && Date.parse(date) > Date.today
|
||||||
@deprecation_reason = because if because.present?
|
@deprecation_reason = because if because.present?
|
||||||
|
|||||||
@ -25,7 +25,7 @@ describe Homebrew::Livecheck do
|
|||||||
desc "Deprecated test formula"
|
desc "Deprecated test formula"
|
||||||
homepage "https://brew.sh"
|
homepage "https://brew.sh"
|
||||||
url "https://brew.sh/test-0.0.1.tgz"
|
url "https://brew.sh/test-0.0.1.tgz"
|
||||||
deprecate! because: :unmaintained
|
deprecate! date: "2020-06-25", because: :unmaintained
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ describe Homebrew::Livecheck do
|
|||||||
desc "Disabled test formula"
|
desc "Disabled test formula"
|
||||||
homepage "https://brew.sh"
|
homepage "https://brew.sh"
|
||||||
url "https://brew.sh/test-0.0.1.tgz"
|
url "https://brew.sh/test-0.0.1.tgz"
|
||||||
disable! because: :unmaintained
|
disable! date: "2020-06-25", because: :unmaintained
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user