Merge pull request #10108 from Rylan12/add-depreacte-disable-date
formula: add deprecation_date and disable_date methods
This commit is contained in:
commit
a8faeef64d
@ -1165,6 +1165,12 @@ class Formula
|
|||||||
# @return [Boolean]
|
# @return [Boolean]
|
||||||
delegate deprecated?: :"self.class"
|
delegate deprecated?: :"self.class"
|
||||||
|
|
||||||
|
# The date that this {Formula} was or becomes deprecated.
|
||||||
|
# Returns `nil` if no date is specified.
|
||||||
|
# @!method deprecation_date
|
||||||
|
# @return Date
|
||||||
|
delegate deprecation_date: :"self.class"
|
||||||
|
|
||||||
# The reason this {Formula} is deprecated.
|
# The reason this {Formula} is deprecated.
|
||||||
# Returns `nil` if no reason is specified or the formula is not deprecated.
|
# Returns `nil` if no reason is specified or the formula is not deprecated.
|
||||||
# @!method deprecation_reason
|
# @!method deprecation_reason
|
||||||
@ -1177,6 +1183,12 @@ class Formula
|
|||||||
# @return [Boolean]
|
# @return [Boolean]
|
||||||
delegate disabled?: :"self.class"
|
delegate disabled?: :"self.class"
|
||||||
|
|
||||||
|
# The date that this {Formula} was or becomes disabled.
|
||||||
|
# Returns `nil` if no date is specified.
|
||||||
|
# @!method disable_date
|
||||||
|
# @return Date
|
||||||
|
delegate disable_date: :"self.class"
|
||||||
|
|
||||||
# The reason this {Formula} is disabled.
|
# The reason this {Formula} is disabled.
|
||||||
# Returns `nil` if no reason is specified or the formula is not disabled.
|
# Returns `nil` if no reason is specified or the formula is not disabled.
|
||||||
# @!method disable_reason
|
# @!method disable_reason
|
||||||
@ -1777,7 +1789,11 @@ class Formula
|
|||||||
"pinned" => pinned?,
|
"pinned" => pinned?,
|
||||||
"outdated" => outdated?,
|
"outdated" => outdated?,
|
||||||
"deprecated" => deprecated?,
|
"deprecated" => deprecated?,
|
||||||
|
"deprecation_date" => deprecation_date,
|
||||||
|
"deprecation_reason" => deprecation_reason,
|
||||||
"disabled" => disabled?,
|
"disabled" => disabled?,
|
||||||
|
"disable_date" => disable_date,
|
||||||
|
"disable_reason" => disable_reason,
|
||||||
}
|
}
|
||||||
|
|
||||||
if stable
|
if stable
|
||||||
@ -2771,6 +2787,8 @@ class Formula
|
|||||||
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?
|
odeprecated "`deprecate!` without a date", "`deprecate! date: \"#{Date.today}\"`" if date.blank?
|
||||||
|
|
||||||
|
@deprecation_date = Date.parse(date) if date.present?
|
||||||
|
|
||||||
return if date.present? && Date.parse(date) > Date.today
|
return if date.present? && Date.parse(date) > Date.today
|
||||||
|
|
||||||
@deprecation_reason = because if because.present?
|
@deprecation_reason = because if because.present?
|
||||||
@ -2784,6 +2802,11 @@ class Formula
|
|||||||
@deprecated == true
|
@deprecated == true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# The date that this {Formula} was or becomes deprecated.
|
||||||
|
# Returns `nil` if no date is specified.
|
||||||
|
# @return Date
|
||||||
|
attr_reader :deprecation_date
|
||||||
|
|
||||||
# The reason for deprecation of a {Formula}.
|
# The reason for deprecation of a {Formula}.
|
||||||
# @return [nil] if no reason was provided or the formula is not deprecated.
|
# @return [nil] if no reason was provided or the formula is not deprecated.
|
||||||
# @return [String, Symbol]
|
# @return [String, Symbol]
|
||||||
@ -2798,7 +2821,9 @@ class Formula
|
|||||||
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?
|
odeprecated "`disable!` without a date", "`disable! date: \"#{Date.today}\"`" if date.blank?
|
||||||
|
|
||||||
if date.present? && Date.parse(date) > Date.today
|
@disable_date = Date.parse(date) if date.present?
|
||||||
|
|
||||||
|
if @disable_date && @disable_date > Date.today
|
||||||
@deprecation_reason = because if because.present?
|
@deprecation_reason = because if because.present?
|
||||||
@deprecated = true
|
@deprecated = true
|
||||||
return
|
return
|
||||||
@ -2815,6 +2840,11 @@ class Formula
|
|||||||
@disabled == true
|
@disabled == true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# The date that this {Formula} was or becomes disabled.
|
||||||
|
# Returns `nil` if no date is specified.
|
||||||
|
# @return Date
|
||||||
|
attr_reader :disable_date
|
||||||
|
|
||||||
# The reason this {Formula} is disabled.
|
# The reason this {Formula} is disabled.
|
||||||
# Returns `nil` if no reason was provided or the formula is not disabled.
|
# Returns `nil` if no reason was provided or the formula is not disabled.
|
||||||
# @return [String, Symbol]
|
# @return [String, Symbol]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user