Skip to content
Snippets Groups Projects
Commit 49dce3e7 authored by Mike McQuaid's avatar Mike McQuaid
Browse files

outdated: check if formula needs to be migrated.

Closes Homebrew/homebrew#42938.
parent 3d7c38c7
No related branches found
No related tags found
No related merge requests found
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."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment