From 931e1f4ee6a48e96b1ef1112ef1fb30db9ded780 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Mon, 17 Aug 2020 19:45:33 +0200 Subject: [PATCH] Document `Migrator`. --- Library/Homebrew/migrator.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Library/Homebrew/migrator.rb b/Library/Homebrew/migrator.rb index e0903aa48f..bdf05f93bb 100644 --- a/Library/Homebrew/migrator.rb +++ b/Library/Homebrew/migrator.rb @@ -4,9 +4,13 @@ require "lock_file" require "keg" require "tab" +# Helper class for migrating a formula from an old to a new name. +# +# @api private class Migrator include Context + # Error for when a migration is necessary. class MigrationNeededError < RuntimeError def initialize(formula) super <<~EOS @@ -16,18 +20,21 @@ class Migrator end end + # Error for when a formula does not replace another formula. class MigratorNoOldnameError < RuntimeError def initialize(formula) super "#{formula.name} doesn't replace any formula." end end + # Error for when the old name's path does not exist. class MigratorNoOldpathError < RuntimeError def initialize(formula) super "#{HOMEBREW_CELLAR/formula.oldname} doesn't exist." end end + # Error for when a formula is migrated to a different tap without explicitly using its fully-qualified name. class MigratorDifferentTapsError < RuntimeError def initialize(formula, tap) msg = if tap.core_tap?