Merge pull request #7462 from MikeMcQuaid/deprecate-before-disabled

formula: disable! deprecates before disable date.
This commit is contained in:
Mike McQuaid 2020-04-29 09:57:05 +01:00 committed by GitHub
commit 855d639b81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2637,7 +2637,9 @@ class Formula
@pour_bottle_check.instance_eval(&block)
end
# Deprecates a {Formula} so a warning is shown on each installation.
# Deprecates a {Formula} (on a given date, if provided) so a warning is
# shown on each installation. If the date has not yet passed the formula
# will not be deprecated.
def deprecate!(date: nil)
return if date.present? && Date.parse(date) > Date.today
@ -2651,9 +2653,14 @@ class Formula
@deprecated == true
end
# Disables a {Formula} so it cannot be installed.
# Disables a {Formula} (on a given date, if provided) so it cannot be
# installed. If the date has not yet passed the formula
# will be deprecated instead of disabled.
def disable!(date: nil)
return if date.present? && Date.parse(date) > Date.today
if date.present? && Date.parse(date) > Date.today
@deprecated = true
return
end
@disabled = true
end