aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMike McQuaid2016-11-06 08:22:08 -0500
committerGitHub2016-11-06 08:22:08 -0500
commitce2b11fd656e85a2cd73f45b4ac25fd34b1599cf (patch)
tree55da831dfa19834e4c422f39c07a69a839faa726 /Library/Homebrew
parentcfaa05f841f000f79331556c8d9cbb2b08bc8426 (diff)
parent133bad9a9740ab55b4158c72185c677fc1062ab2 (diff)
downloadbrew-ce2b11fd656e85a2cd73f45b4ac25fd34b1599cf.tar.bz2
Merge pull request #1371 from MikeMcQuaid/tap-migrate-fully-scoped
formulary: migrate fully-scoped formulae names.
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/formulary.rb20
1 files changed, 19 insertions, 1 deletions
diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb
index 5ce09f6ba..4d6832e44 100644
--- a/Library/Homebrew/formulary.rb
+++ b/Library/Homebrew/formulary.rb
@@ -159,6 +159,11 @@ class Formulary
attr_reader :tap
def initialize(tapped_name)
+ name, path = formula_name_path(tapped_name)
+ super name, path
+ end
+
+ def formula_name_path(tapped_name, warn: true)
user, repo, name = tapped_name.split("/", 3).map(&:downcase)
@tap = Tap.fetch user, repo
formula_dir = @tap.formula_dir || @tap.path
@@ -170,12 +175,25 @@ class Formulary
name = path.basename(".rb").to_s
elsif (new_name = @tap.formula_renames[name]) &&
(new_path = formula_dir/"#{new_name}.rb").file?
+ old_name = name
path = new_path
name = new_name
+ new_name = @tap.core_tap? ? name : "#{@tap}/#{name}"
+ elsif (new_tap_name = @tap.tap_migrations[name])
+ new_tap = Tap.fetch new_tap_name
+ new_tap.install unless new_tap.installed?
+ new_tapped_name = "#{new_tap_name}/#{name}"
+ name, path = formula_name_path(new_tapped_name, warn: false)
+ old_name = tapped_name
+ new_name = new_tap.core_tap? ? name : new_tapped_name
+ end
+
+ if warn && old_name && new_name
+ opoo "Use #{new_name} instead of deprecated #{old_name}"
end
end
- super name, path
+ [name, path]
end
def get_formula(spec, alias_path: nil)