Document Migrator.
This commit is contained in:
parent
ceeb6e6492
commit
931e1f4ee6
@ -4,9 +4,13 @@ require "lock_file"
|
|||||||
require "keg"
|
require "keg"
|
||||||
require "tab"
|
require "tab"
|
||||||
|
|
||||||
|
# Helper class for migrating a formula from an old to a new name.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Migrator
|
class Migrator
|
||||||
include Context
|
include Context
|
||||||
|
|
||||||
|
# Error for when a migration is necessary.
|
||||||
class MigrationNeededError < RuntimeError
|
class MigrationNeededError < RuntimeError
|
||||||
def initialize(formula)
|
def initialize(formula)
|
||||||
super <<~EOS
|
super <<~EOS
|
||||||
@ -16,18 +20,21 @@ class Migrator
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Error for when a formula does not replace another formula.
|
||||||
class MigratorNoOldnameError < RuntimeError
|
class MigratorNoOldnameError < RuntimeError
|
||||||
def initialize(formula)
|
def initialize(formula)
|
||||||
super "#{formula.name} doesn't replace any formula."
|
super "#{formula.name} doesn't replace any formula."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Error for when the old name's path does not exist.
|
||||||
class MigratorNoOldpathError < RuntimeError
|
class MigratorNoOldpathError < RuntimeError
|
||||||
def initialize(formula)
|
def initialize(formula)
|
||||||
super "#{HOMEBREW_CELLAR/formula.oldname} doesn't exist."
|
super "#{HOMEBREW_CELLAR/formula.oldname} doesn't exist."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Error for when a formula is migrated to a different tap without explicitly using its fully-qualified name.
|
||||||
class MigratorDifferentTapsError < RuntimeError
|
class MigratorDifferentTapsError < RuntimeError
|
||||||
def initialize(formula, tap)
|
def initialize(formula, tap)
|
||||||
msg = if tap.core_tap?
|
msg = if tap.core_tap?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user