brew missing: allow a formula argument
If a formula is given, it will be checked for missing deps. The formula does not have to be installed first. Without a formula list, still checks all installed brews.
This commit is contained in:
parent
bfd75db803
commit
94a524cce3
@ -28,7 +28,7 @@ _brew_to_completion()
|
||||
|
||||
case "$prev" in
|
||||
# Commands that take a formula
|
||||
cat|deps|edit|fetch|home|homepage|info|install|log|options|uses)
|
||||
cat|deps|edit|fetch|home|homepage|info|install|log|missing|options|uses)
|
||||
# handle standard --options
|
||||
if [[ "$prev" == "install" && "$cur" == --* ]]; then
|
||||
local opts=$(
|
||||
|
@ -1,18 +1,29 @@
|
||||
require "formula"
|
||||
require "cmd/outdated"
|
||||
|
||||
def installed_brews
|
||||
formulae = []
|
||||
HOMEBREW_CELLAR.subdirs.each do |rack|
|
||||
f = Formula.factory rack.basename.to_s rescue nil
|
||||
formulae << f if f and f.installed?
|
||||
end
|
||||
formulae
|
||||
end
|
||||
|
||||
def main
|
||||
# Names of outdated brews; they count as installed.
|
||||
outdated = Homebrew.outdated_brews.collect{ |b| b[1] }
|
||||
|
||||
HOMEBREW_CELLAR.subdirs.each do |rack|
|
||||
f = Formula.factory rack.basename.to_s rescue nil
|
||||
if f and f.installed?
|
||||
missing_deps = f.recursive_deps.map{ |g| g.name }.uniq.reject do |dep_name|
|
||||
Formula.factory(dep_name).installed? or outdated.include?(dep_name)
|
||||
end
|
||||
formuale_to_check = ARGV.formulae rescue installed_brews
|
||||
|
||||
puts "#{f.name}: #{missing_deps * ', '}" unless missing_deps.empty?
|
||||
formuale_to_check.each do |f|
|
||||
missing_deps = f.recursive_deps.map{ |g| g.name }.uniq.reject do |dep_name|
|
||||
Formula.factory(dep_name).installed? or outdated.include?(dep_name)
|
||||
end
|
||||
|
||||
unless missing_deps.empty?
|
||||
print "#{f.name}: " if formuale_to_check.size > 1
|
||||
puts "#{missing_deps * ', '}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -179,8 +179,10 @@ didn't include with OS X.
|
||||
|
||||
If `--all` is passed, show options for all formulae.
|
||||
|
||||
* `missing`:
|
||||
Check all installed formuale for missing dependencies.
|
||||
* `missing` [<formulae>]:
|
||||
Check the given <formulae> for missing dependencies.
|
||||
|
||||
If no <formulae> are given, check all installed brews.
|
||||
|
||||
* `server`:
|
||||
Start a local web app that lets you browse available formulae, similar
|
||||
|
@ -1,7 +1,7 @@
|
||||
.\" generated with Ronn/v0.7.3
|
||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
.
|
||||
.TH "BREW" "1" "March 2011" "Homebrew" "brew"
|
||||
.TH "BREW" "1" "April 2011" "Homebrew" "brew"
|
||||
.
|
||||
.SH "NAME"
|
||||
\fBbrew\fR \- The missing package manager for OS X
|
||||
@ -198,8 +198,11 @@ If \fB\-\-compact\fR is passed, show all options on a single line separated by s
|
||||
If \fB\-\-all\fR is passed, show options for all formulae\.
|
||||
.
|
||||
.TP
|
||||
\fBmissing\fR
|
||||
Check all installed formuale for missing dependencies\.
|
||||
\fBmissing\fR [\fIformulae\fR]
|
||||
Check the given \fIformulae\fR for missing dependencies\.
|
||||
.
|
||||
.IP
|
||||
If no \fIformulae\fR are given, check all installed brews\.
|
||||
.
|
||||
.TP
|
||||
\fBserver\fR
|
||||
|
Loading…
x
Reference in New Issue
Block a user