formula: detect outdated HEAD in outdated_versions

This commit is contained in:
Vlad Shablinsky 2016-08-06 16:21:25 +03:00 committed by Xu Cheng
parent a59bdc4a2a
commit 001bef0604
No known key found for this signature in database
GPG Key ID: C2A3860FA0B459CE

View File

@ -1000,7 +1000,7 @@ class Formula
end end
# @private # @private
def outdated_versions def outdated_versions(options = {})
@outdated_versions ||= begin @outdated_versions ||= begin
all_versions = [] all_versions = []
@ -1009,16 +1009,22 @@ class Formula
installed_kegs.each do |keg| installed_kegs.each do |keg|
version = keg.version version = keg.version
all_versions << version all_versions << version
return [] if pkg_version <= version
return [] if pkg_version <= version && !version.head?
end end
head_version = latest_head_version
if head_version
head_version_outdated?(head_version, options) ? all_versions.sort! : []
else
all_versions.sort! all_versions.sort!
end end
end end
end
# @private # @private
def outdated? def outdated?(options = {})
!outdated_versions.empty? !outdated_versions(options).empty?
rescue Migrator::MigrationNeededError rescue Migrator::MigrationNeededError
true true
end end