aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2015-08-14 14:50:26 +0100
committerMike McQuaid2015-08-14 15:18:45 +0100
commit49dce3e7ae6923f00f603852287a435e7b21ddcb (patch)
tree7d12d7781db8127ee3c7580ac78be11e231d2a0c
parent3d7c38c7361ce98eb137af589bb6cfec4e2950e9 (diff)
downloadbrew-49dce3e7ae6923f00f603852287a435e7b21ddcb.tar.bz2
outdated: check if formula needs to be migrated.
Closes Homebrew/homebrew#42938.
-rw-r--r--Library/Homebrew/cmd/outdated.rb8
-rw-r--r--Library/Homebrew/migrator.rb9
2 files changed, 17 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/outdated.rb b/Library/Homebrew/cmd/outdated.rb
index 673ea966c..45e195939 100644
--- a/Library/Homebrew/cmd/outdated.rb
+++ b/Library/Homebrew/cmd/outdated.rb
@@ -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
diff --git a/Library/Homebrew/migrator.rb b/Library/Homebrew/migrator.rb
index 0ad02ab01..fb01cf7f3 100644
--- a/Library/Homebrew/migrator.rb
+++ b/Library/Homebrew/migrator.rb
@@ -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."