aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorMike McQuaid2017-03-20 20:37:12 +0100
committerMike McQuaid2017-03-20 20:37:12 +0100
commitf59eb358c29c5f40601a99e3f1bf7e8e891f10ba (patch)
tree86c8ad1406611325251b111c83e212a007ced7d1 /Library/Homebrew/cmd
parent80e95b684e7485b5c5b7f7209dd95b0bdc9e3406 (diff)
downloadbrew-f59eb358c29c5f40601a99e3f1bf7e8e891f10ba.tar.bz2
missing_formula: subsume historic logic.
These methods belong together so combine them in a single class to provide a simpler API.
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/info.rb17
-rw-r--r--Library/Homebrew/cmd/install.rb16
-rw-r--r--Library/Homebrew/cmd/search.rb4
3 files changed, 6 insertions, 31 deletions
diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb
index 5c96e5c50..7e1815556 100644
--- a/Library/Homebrew/cmd/info.rb
+++ b/Library/Homebrew/cmd/info.rb
@@ -23,7 +23,6 @@ require "formula"
require "keg"
require "tab"
require "json"
-require "historic"
module Homebrew
module_function
@@ -57,22 +56,10 @@ module Homebrew
end
rescue FormulaUnavailableError => e
# No formula with this name, try a missing formula lookup
- if (missing_formula = Homebrew::MissingFormula.missing_formula(f))
- ofail "#{e.message}\n#{missing_formula}"
+ if (reason = Homebrew::MissingFormula.reason(f))
+ ofail "#{e.message}\n#{reason}"
else
ofail e.message
-
- # No point in searching if the specified tap isn't tapped yet
- next if e.instance_of?(TapFormulaUnavailableError) && !e.tap.installed?
-
- migrations = search_for_migrated_formula(f)
- next unless migrations.empty?
- ohai "Searching among deleted formulae..."
- begin
- search_for_deleted_formula(f)
- rescue
- nil
- end
end
end
end
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index a0f95887b..bd7897171 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -62,7 +62,6 @@ require "formula_installer"
require "tap"
require "hardware"
require "development_tools"
-require "historic"
module Homebrew
module_function
@@ -207,24 +206,13 @@ module Homebrew
# formula was found, but there's a problem with its implementation).
ofail e.message
rescue FormulaUnavailableError => e
- if (missing_formula = Homebrew::MissingFormula.missing_formula(e.name))
- ofail "#{e.message}\n#{missing_formula}"
+ if (reason = Homebrew::MissingFormula.reason(e.name))
+ ofail "#{e.message}\n#{reason}"
elsif e.name == "updog"
ofail "What's updog?"
else
ofail e.message
- migrations = search_for_migrated_formula(e.name)
- return unless migrations.empty?
-
- ohai "Searching among deleted formulae..."
- begin
- search_for_deleted_formula(e.name)
- return
- rescue
- nil
- end
-
query = query_regexp(e.name)
ohai "Searching for similarly named formulae..."
diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb
index 6887805d6..db5898872 100644
--- a/Library/Homebrew/cmd/search.rb
+++ b/Library/Homebrew/cmd/search.rb
@@ -67,12 +67,12 @@ module Homebrew
if $stdout.tty?
count = local_results.length + tap_results.length
- if msg = Homebrew::MissingFormula.missing_formula(query)
+ if reason = Homebrew::MissingFormula.reason(query)
if count > 0
puts
puts "If you meant #{query.inspect} specifically:"
end
- puts msg
+ puts reason
elsif count.zero?
puts "No formula found for #{query.inspect}."
begin