aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2011-04-13 13:48:09 -0700
committerAdam Vandenberg2011-04-13 13:48:31 -0700
commit94a524cce3d19183641421b1b9d680c0a1b4d45c (patch)
treefd3dbf69ad3a636e08ef13d599b8fb3b91a89cb3 /Library
parentbfd75db8036a0d56c07204fa5fa9fe93cf2d5370 (diff)
downloadbrew-94a524cce3d19183641421b1b9d680c0a1b4d45c.tar.bz2
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.
Diffstat (limited to 'Library')
-rw-r--r--Library/Contributions/brew_bash_completion.sh2
-rwxr-xr-xLibrary/Contributions/examples/brew-missing.rb25
-rw-r--r--Library/Contributions/manpages/brew.1.md6
3 files changed, 23 insertions, 10 deletions
diff --git a/Library/Contributions/brew_bash_completion.sh b/Library/Contributions/brew_bash_completion.sh
index 7513e3c4f..c4aeeaf84 100644
--- a/Library/Contributions/brew_bash_completion.sh
+++ b/Library/Contributions/brew_bash_completion.sh
@@ -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=$(
diff --git a/Library/Contributions/examples/brew-missing.rb b/Library/Contributions/examples/brew-missing.rb
index 701bb1ca2..5beca3c92 100755
--- a/Library/Contributions/examples/brew-missing.rb
+++ b/Library/Contributions/examples/brew-missing.rb
@@ -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
+
+ 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
- puts "#{f.name}: #{missing_deps * ', '}" unless missing_deps.empty?
+ unless missing_deps.empty?
+ print "#{f.name}: " if formuale_to_check.size > 1
+ puts "#{missing_deps * ', '}"
end
end
end
diff --git a/Library/Contributions/manpages/brew.1.md b/Library/Contributions/manpages/brew.1.md
index f65168bef..409eab697 100644
--- a/Library/Contributions/manpages/brew.1.md
+++ b/Library/Contributions/manpages/brew.1.md
@@ -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