aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/info.rb12
-rw-r--r--Library/Homebrew/cmd/install.rb74
-rw-r--r--Library/Homebrew/cmd/link.rb17
-rw-r--r--Library/Homebrew/cmd/log.rb28
-rw-r--r--Library/Homebrew/cmd/outdated.rb8
-rw-r--r--Library/Homebrew/cmd/search.rb9
-rw-r--r--Library/Homebrew/cmd/update-report.rb17
7 files changed, 106 insertions, 59 deletions
diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb
index b7de0005c..e7ad6821d 100644
--- a/Library/Homebrew/cmd/info.rb
+++ b/Library/Homebrew/cmd/info.rb
@@ -16,7 +16,7 @@
#: See the docs for examples of using the JSON output:
#: <http://docs.brew.sh/Querying-Brew.html>
-require "blacklist"
+require "missing_formula"
require "caveats"
require "options"
require "formula"
@@ -54,10 +54,12 @@ module Homebrew
else
info_formula Formulary.find_with_priority(f)
end
- rescue FormulaUnavailableError
- # No formula with this name, try a blacklist lookup
- raise unless (blacklist = blacklisted?(f))
- puts blacklist
+ rescue FormulaUnavailableError => e
+ ofail e.message
+ # No formula with this name, try a missing formula lookup
+ if (reason = Homebrew::MissingFormula.reason(f))
+ $stderr.puts reason
+ end
end
end
end
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index c825e2796..e54286f09 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -55,7 +55,7 @@
#: If `--git` is passed, Homebrew will create a Git repository, useful for
#: creating patches to the software.
-require "blacklist"
+require "missing_formula"
require "diagnostic"
require "cmd/search"
require "formula_installer"
@@ -206,43 +206,47 @@ module Homebrew
# formula was found, but there's a problem with its implementation).
ofail e.message
rescue FormulaUnavailableError => e
- if (blacklist = blacklisted?(e.name))
- ofail "#{e.message}\n#{blacklist}"
- elsif e.name == "updog"
+ if e.name == "updog"
ofail "What's updog?"
+ return
+ end
+
+ ofail e.message
+ if (reason = Homebrew::MissingFormula.reason(e.name))
+ $stderr.puts reason
+ return
+ end
+
+ query = query_regexp(e.name)
+
+ ohai "Searching for similarly named formulae..."
+ formulae_search_results = search_formulae(query)
+ case formulae_search_results.length
+ when 0
+ ofail "No similarly named formulae found."
+ when 1
+ puts "This similarly named formula was found:"
+ puts formulae_search_results
+ puts "To install it, run:\n brew install #{formulae_search_results.first}"
else
- ofail e.message
- query = query_regexp(e.name)
-
- ohai "Searching for similarly named formulae..."
- formulae_search_results = search_formulae(query)
- case formulae_search_results.length
- when 0
- ofail "No similarly named formulae found."
- when 1
- puts "This similarly named formula was found:"
- puts formulae_search_results
- puts "To install it, run:\n brew install #{formulae_search_results.first}"
- else
- puts "These similarly named formulae were found:"
- puts Formatter.columns(formulae_search_results)
- puts "To install one of them, run (for example):\n brew install #{formulae_search_results.first}"
- end
+ puts "These similarly named formulae were found:"
+ puts Formatter.columns(formulae_search_results)
+ puts "To install one of them, run (for example):\n brew install #{formulae_search_results.first}"
+ end
- ohai "Searching taps..."
- taps_search_results = search_taps(query)
- case taps_search_results.length
- when 0
- ofail "No formulae found in taps."
- when 1
- puts "This formula was found in a tap:"
- puts taps_search_results
- puts "To install it, run:\n brew install #{taps_search_results.first}"
- else
- puts "These formulae were found in taps:"
- puts Formatter.columns(taps_search_results)
- puts "To install one of them, run (for example):\n brew install #{taps_search_results.first}"
- end
+ ohai "Searching taps..."
+ taps_search_results = search_taps(query)
+ case taps_search_results.length
+ when 0
+ ofail "No formulae found in taps."
+ when 1
+ puts "This formula was found in a tap:"
+ puts taps_search_results
+ puts "To install it, run:\n brew install #{taps_search_results.first}"
+ else
+ puts "These formulae were found in taps:"
+ puts Formatter.columns(taps_search_results)
+ puts "To install one of them, run (for example):\n brew install #{taps_search_results.first}"
end
end
end
diff --git a/Library/Homebrew/cmd/link.rb b/Library/Homebrew/cmd/link.rb
index 98cf98bf7..293f09eef 100644
--- a/Library/Homebrew/cmd/link.rb
+++ b/Library/Homebrew/cmd/link.rb
@@ -44,6 +44,7 @@ module Homebrew
elsif keg_only && !ARGV.force?
opoo "#{keg.name} is keg-only and must be linked with --force"
puts "Note that doing so can interfere with building software."
+ puts_keg_only_path_message(keg)
next
elsif mode.dry_run && mode.overwrite
puts "Would remove:"
@@ -53,6 +54,7 @@ module Homebrew
elsif mode.dry_run
puts "Would link:"
keg.link(mode)
+ puts_keg_only_path_message(keg) if keg_only
next
end
@@ -69,10 +71,25 @@ module Homebrew
else
puts "#{n} symlinks created"
end
+
+ if keg_only && !ARGV.homebrew_developer?
+ puts_keg_only_path_message(keg)
+ end
end
end
end
+ def puts_keg_only_path_message(keg)
+ bin = keg/"bin"
+ sbin = keg/"sbin"
+ return if !bin.directory? && !sbin.directory?
+
+ opt = HOMEBREW_PREFIX/"opt/#{keg.name}"
+ puts "\nIf you need to have this software first in your PATH instead consider running:"
+ puts " #{Utils::Shell.prepend_path_in_shell_profile(opt)}/bin" if bin.directory?
+ puts " #{Utils::Shell.prepend_path_in_shell_profile(opt)}/sbin" if sbin.directory?
+ end
+
def keg_only?(rack)
Formulary.from_rack(rack).keg_only?
rescue FormulaUnavailableError, TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError
diff --git a/Library/Homebrew/cmd/log.rb b/Library/Homebrew/cmd/log.rb
index 22a3ee11d..9323c762d 100644
--- a/Library/Homebrew/cmd/log.rb
+++ b/Library/Homebrew/cmd/log.rb
@@ -9,20 +9,32 @@ module Homebrew
def log
if ARGV.named.empty?
- cd HOMEBREW_REPOSITORY
- git_log
+ git_log HOMEBREW_REPOSITORY
else
path = Formulary.path(ARGV.named.first)
- cd path.dirname # supports taps
- git_log path
+ tap = Tap.from_path(path)
+ git_log path.dirname, path, tap
end
end
- def git_log(path = nil)
- if File.exist? "#{`git rev-parse --show-toplevel`.chomp}/.git/shallow"
+ def git_log(cd_dir, path = nil, tap = nil)
+ cd cd_dir
+ repo = Utils.popen_read("git rev-parse --show-toplevel").chomp
+ if tap
+ name = tap.to_s
+ git_cd = "$(brew --repo #{tap})"
+ elsif cd_dir == HOMEBREW_REPOSITORY
+ name = "Homebrew/brew"
+ git_cd = "$(brew --repo)"
+ else
+ name, git_cd = cd_dir
+ end
+
+ if File.exist? "#{repo}/.git/shallow"
opoo <<-EOS.undent
- The git repository is a shallow clone therefore the filtering may be incorrect.
- Use `git fetch --unshallow` to get the full repository.
+ #{name} is a shallow clone so only partial output will be shown.
+ To get a full clone run:
+ git -C "#{git_cd}" fetch --unshallow
EOS
end
args = ARGV.options_only
diff --git a/Library/Homebrew/cmd/outdated.rb b/Library/Homebrew/cmd/outdated.rb
index a18f4e399..e94002989 100644
--- a/Library/Homebrew/cmd/outdated.rb
+++ b/Library/Homebrew/cmd/outdated.rb
@@ -64,7 +64,9 @@ module Homebrew
"#{full_name} (#{kegs.map(&:version).join(", ")})"
end.join(", ")
- puts "#{outdated_versions} < #{current_version}"
+ pinned_version = " [pinned at #{f.pinned_version}]" if f.pinned?
+
+ puts "#{outdated_versions} < #{current_version}#{pinned_version}"
else
puts f.full_installed_specified_name
end
@@ -86,7 +88,9 @@ module Homebrew
json << { name: f.full_name,
installed_versions: outdated_versions.collect(&:to_s),
- current_version: current_version }
+ current_version: current_version,
+ pinned: f.pinned?,
+ pinned_version: f.pinned_version }
end
puts JSON.generate(json)
diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb
index e834a00b5..443739f8c 100644
--- a/Library/Homebrew/cmd/search.rb
+++ b/Library/Homebrew/cmd/search.rb
@@ -14,7 +14,7 @@
#: Search for <text> in the given package manager's list.
require "formula"
-require "blacklist"
+require "missing_formula"
require "utils"
require "thread"
require "official_taps"
@@ -67,13 +67,12 @@ module Homebrew
if $stdout.tty?
count = local_results.length + tap_results.length
- if msg = blacklisted?(query)
+ if reason = Homebrew::MissingFormula.reason(query, silent: true)
if count > 0
puts
- puts "If you meant #{query.inspect} precisely:"
- puts
+ puts "If you meant #{query.inspect} specifically:"
end
- puts msg
+ puts reason
elsif count.zero?
puts "No formula found for #{query.inspect}."
begin
diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb
index c13d82090..4002df75c 100644
--- a/Library/Homebrew/cmd/update-report.rb
+++ b/Library/Homebrew/cmd/update-report.rb
@@ -361,7 +361,10 @@ class Reporter
case status
when "A", "D"
- @report[status.to_sym] << tap.formula_file_to_name(src)
+ full_name = tap.formula_file_to_name(src)
+ name = full_name.split("/").last
+ new_tap = tap.tap_migrations[name]
+ @report[status.to_sym] << full_name unless new_tap
when "M"
begin
formula = Formulary.factory(tap.path/src)
@@ -499,9 +502,15 @@ class Reporter
end
def migrate_formula_rename
- report[:R].each do |old_full_name, new_full_name|
- old_name = old_full_name.split("/").last
- next unless (dir = HOMEBREW_CELLAR/old_name).directory? && !dir.subdirs.empty?
+ Formula.installed.map(&:oldname).compact.each do |old_name|
+ old_name_dir = HOMEBREW_CELLAR/old_name
+ next if old_name_dir.symlink?
+ next unless old_name_dir.directory? && !old_name_dir.subdirs.empty?
+
+ new_name = tap.formula_renames[old_name]
+ next unless new_name
+
+ new_full_name = "#{tap}/#{new_name}"
begin
f = Formulary.factory(new_full_name)