Move brew-leaves into core

Closes Homebrew/homebrew#24371.
This commit is contained in:
Jack Nagel 2013-11-16 14:10:23 -06:00
parent 4366b7956f
commit 674d041d80
4 changed files with 37 additions and 30 deletions

View File

@ -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

View File

@ -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]` <formula>:
Symlink all of <formula>'s installed files into the Homebrew prefix. This
is done automatically when you install formula, but can be useful for DIY

View File

@ -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

View File

@ -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