diff --git a/Library/Contributions/cmd/brew-leaves.rb b/Library/Contributions/cmd/brew-leaves.rb index b1296598b2..e69de29bb2 100755 --- a/Library/Contributions/cmd/brew-leaves.rb +++ b/Library/Contributions/cmd/brew-leaves.rb @@ -1,29 +0,0 @@ -# Outputs formulae that are installed but are not a dependency for -# any other installed formula. -# See: http://github.com/mxcl/homebrew/issues/issue/1438 - -require 'formula' -require 'set' -require 'tab' - -installed = Formula.installed -deps_of_installed = Set.new - -installed.each do |f| - deps = [] - - f.deps.each do |dep| - if dep.optional? || dep.recommended? - tab = Tab.for_formula(f) - deps << dep.name if tab.with?(dep.name) - else - deps << dep.name - end - end - - deps_of_installed.merge(deps) -end - -installed.each do |f| - puts f.name unless deps_of_installed.include? f.name -end diff --git a/Library/Contributions/manpages/brew.1.md b/Library/Contributions/manpages/brew.1.md index 6ba333e064..2806647045 100644 --- a/Library/Contributions/manpages/brew.1.md +++ b/Library/Contributions/manpages/brew.1.md @@ -197,6 +197,9 @@ Note that these flags should only appear after a command. If `--git` is passed, Homebrew will create a Git repository, useful for creating patches to the software. + * `leaves`: + Show installed formulae that are not dependencies of another installed formula. + * `ln`, `link [--overwrite] [--dry-run] [--force]` : Symlink all of 's installed files into the Homebrew prefix. This is done automatically when you install formula, but can be useful for DIY diff --git a/Library/Homebrew/cmd/leaves.rb b/Library/Homebrew/cmd/leaves.rb new file mode 100644 index 0000000000..bffa332d62 --- /dev/null +++ b/Library/Homebrew/cmd/leaves.rb @@ -0,0 +1,29 @@ +require 'formula' +require 'tab' +require 'set' + +module Homebrew extend self + def leaves + installed = Formula.installed + deps_of_installed = Set.new + + installed.each do |f| + deps = [] + + f.deps.each do |dep| + if dep.optional? || dep.recommended? + tab = Tab.for_formula(f) + deps << dep.name if tab.with?(dep.name) + else + deps << dep.name + end + end + + deps_of_installed.merge(deps) + end + + installed.each do |f| + puts f.name unless deps_of_installed.include? f.name + end + end +end diff --git a/share/man/man1/brew.1 b/share/man/man1/brew.1 index 8878a7f79d..980cbb07b9 100644 --- a/share/man/man1/brew.1 +++ b/share/man/man1/brew.1 @@ -218,6 +218,10 @@ Download and patch \fIformula\fR, then open a shell\. This allows the user to ru If \fB\-\-git\fR is passed, Homebrew will create a Git repository, useful for creating patches to the software\. . .TP +\fBleaves\fR +Show installed formulae that are not dependencies of another installed formula\. +. +.TP \fBln\fR, \fBlink [\-\-overwrite] [\-\-dry\-run] [\-\-force]\fR \fIformula\fR Symlink all of \fIformula\fR\'s installed files into the Homebrew prefix\. This is done automatically when you install formula, but can be useful for DIY installations\. . @@ -560,7 +564,7 @@ If set, Homebrew will not use the GitHub API for e\.g searches or fetching relev . .TP HOMEBREW_INSTALL_BADGE -Text printed before the installation summary of each successful build. Defaults to the beer emoji\. +Text printed before the installation summary of each successful build\. Defaults to the beer emoji\. . .TP HOMEBREW_SOURCEFORGE_MIRROR