aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-11-16 14:10:23 -0600
committerJack Nagel2013-11-16 14:10:25 -0600
commit6c252b59bdefd5702eea66223469a162cd0c9ffd (patch)
tree26514d259af83cdd169b1cb89b324ac70a2fd9a0 /Library
parent018e03b967987628879d9b9d5bcc661a880c18a3 (diff)
downloadhomebrew-6c252b59bdefd5702eea66223469a162cd0c9ffd.tar.bz2
Move brew-leaves into core
Closes #24371.
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Contributions/cmd/brew-leaves.rb29
-rw-r--r--Library/Contributions/manpages/brew.1.md3
-rw-r--r--Library/Homebrew/cmd/leaves.rb29
3 files changed, 32 insertions, 29 deletions
diff --git a/Library/Contributions/cmd/brew-leaves.rb b/Library/Contributions/cmd/brew-leaves.rb
index b1296598b..e69de29bb 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 6ba333e06..280664704 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]` <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
diff --git a/Library/Homebrew/cmd/leaves.rb b/Library/Homebrew/cmd/leaves.rb
new file mode 100644
index 000000000..bffa332d6
--- /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