outdated: check if formula needs to be migrated.
Closes Homebrew/homebrew#42938.
This commit is contained in:
parent
3d7c38c736
commit
49dce3e7ae
@ -1,5 +1,6 @@
|
||||
require "formula"
|
||||
require "keg"
|
||||
require "migrator"
|
||||
|
||||
module Homebrew
|
||||
def outdated
|
||||
@ -16,6 +17,13 @@ module Homebrew
|
||||
formulae.map do |f|
|
||||
all_versions = []
|
||||
older_or_same_tap_versions = []
|
||||
|
||||
if f.oldname && !f.rack.exist?
|
||||
if Pathname.new("#{HOMEBREW_CELLAR}/#{f.oldname}").exist?
|
||||
raise Migrator::MigrationNeededError.new(f)
|
||||
end
|
||||
end
|
||||
|
||||
f.rack.subdirs.each do |dir|
|
||||
keg = Keg.new dir
|
||||
version = keg.version
|
||||
|
||||
@ -4,6 +4,15 @@ require "tab"
|
||||
require "tap_migrations"
|
||||
|
||||
class Migrator
|
||||
class MigrationNeededError < RuntimeError
|
||||
def initialize(formula)
|
||||
super <<-EOS.undent
|
||||
#{formula.oldname} was renamed to #{formula.name} and needs to be migrated.
|
||||
Please run `brew migrate #{formula.oldname}`
|
||||
EOS
|
||||
end
|
||||
end
|
||||
|
||||
class MigratorNoOldnameError < RuntimeError
|
||||
def initialize(formula)
|
||||
super "#{formula.name} doesn't replace any formula."
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user