aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/caveats.rb2
-rw-r--r--Library/Homebrew/cmd/linkapps.rb17
-rw-r--r--Library/Homebrew/cmd/unlinkapps.rb22
-rw-r--r--Library/Homebrew/manpages/brew.1.md10
-rw-r--r--share/man/man1/brew.114
5 files changed, 44 insertions, 21 deletions
diff --git a/Library/Homebrew/caveats.rb b/Library/Homebrew/caveats.rb
index e3ff6332c..0eb5b2af2 100644
--- a/Library/Homebrew/caveats.rb
+++ b/Library/Homebrew/caveats.rb
@@ -97,7 +97,7 @@ class Caveats
if keg and keg.app_installed?
<<-EOS.undent
.app bundles were installed.
- Run `brew linkapps` to symlink these to /Applications.
+ Run `brew linkapps #{keg.name}` to symlink these to /Applications.
EOS
end
end
diff --git a/Library/Homebrew/cmd/linkapps.rb b/Library/Homebrew/cmd/linkapps.rb
index 50df5daa2..7e8430c75 100644
--- a/Library/Homebrew/cmd/linkapps.rb
+++ b/Library/Homebrew/cmd/linkapps.rb
@@ -11,12 +11,19 @@ module Homebrew
exit 1
end
- HOMEBREW_CELLAR.subdirs.each do |rack|
- kegs = rack.subdirs.map { |d| Keg.new(d) }
- next if kegs.empty?
-
- keg = kegs.detect(&:linked?) || kegs.max {|a,b| a.version <=> b.version}
+ if ARGV.named.empty?
+ racks = HOMEBREW_CELLAR.subdirs
+ kegs = racks.map do |rack|
+ keg = rack.subdirs.map { |d| Keg.new(d) }
+ next if keg.empty?
+ keg.detect(&:linked?) || keg.max {|a,b| a.version <=> b.version}
+ end
+ else
+ kegs = ARGV.kegs
+ end
+ kegs.each do |keg|
+ keg = keg.opt_record if keg.optlinked?
Dir["#{keg}/*.app", "#{keg}/bin/*.app", "#{keg}/libexec/*.app"].each do |app|
puts "Linking #{app}"
app_name = File.basename(app)
diff --git a/Library/Homebrew/cmd/unlinkapps.rb b/Library/Homebrew/cmd/unlinkapps.rb
index 864e33b27..ef11db602 100644
--- a/Library/Homebrew/cmd/unlinkapps.rb
+++ b/Library/Homebrew/cmd/unlinkapps.rb
@@ -5,15 +5,11 @@ module Homebrew
def unlinkapps
target_dir = ARGV.include?("--local") ? File.expand_path("~/Applications") : "/Applications"
- unless File.exist? target_dir
- opoo "#{target_dir} does not exist, stopping."
- puts "Run `mkdir #{target_dir}` first."
- exit 1
- end
+ return unless File.exist? target_dir
- cellar_apps = Dir[target_dir + '/*.app'].select do |app|
- if File.symlink?(app) && File.readlink(app).match(HOMEBREW_CELLAR)
- File.readlink app
+ cellar_apps = Dir[target_dir + "/*.app"].select do |app|
+ if File.symlink?(app)
+ should_unlink? File.readlink(app)
end
end
@@ -24,4 +20,14 @@ module Homebrew
puts "Finished unlinking from #{target_dir}" if cellar_apps
end
+
+ private
+
+ def should_unlink? file
+ if ARGV.named.empty?
+ file.match(HOMEBREW_CELLAR) || file.match("#{HOMEBREW_PREFIX}/opt")
+ else
+ ARGV.kegs.any? { |keg| file.match(keg.to_s) || file.match(keg.opt_record.to_s) }
+ end
+ end
end
diff --git a/Library/Homebrew/manpages/brew.1.md b/Library/Homebrew/manpages/brew.1.md
index 4edb54022..35a6755d6 100644
--- a/Library/Homebrew/manpages/brew.1.md
+++ b/Library/Homebrew/manpages/brew.1.md
@@ -234,11 +234,13 @@ Note that these flags should only appear after a command.
If `--force` is passed, Homebrew will allow keg-only formulae to be linked.
- * `linkapps [--local]`:
- Find all installed formulae that have compiled `.app`-style "application"
+ * `linkapps [--local] [<formulae>]`:
+ Find installed formulae that have compiled `.app`-style "application"
packages for OS X, and symlink those apps into `/Applications`, allowing
for easier access.
+ If no <formulae> are provided, all of them will have their .apps symlinked.
+
If provided, `--local` will move them into the user's `~/Applications`
folder instead of the system folder. It may need to be created, first.
@@ -355,9 +357,11 @@ Note that these flags should only appear after a command.
for temporarily disabling a formula:
`brew unlink foo && commands && brew link foo`.
- * `unlinkapps [--local]`:
+ * `unlinkapps [--local] [<formulae>]`:
Removes links created by `brew linkapps`.
+ If no <formulae> are provided, all linked app will be removed.
+
* `unpack [--git|--patch] [--destdir=<path>]` <formulae>:
Unpack the source files for <formulae> into subdirectories of the current
diff --git a/share/man/man1/brew.1 b/share/man/man1/brew.1
index dc81473e6..5a305a365 100644
--- a/share/man/man1/brew.1
+++ b/share/man/man1/brew.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BREW" "1" "November 2014" "Homebrew" "brew"
+.TH "BREW" "1" "December 2014" "Homebrew" "brew"
.
.SH "NAME"
\fBbrew\fR \- The missing package manager for OS X
@@ -251,8 +251,11 @@ If \fB\-\-dry\-run\fR or \fB\-n\fR is passed, Homebrew will list all files which
If \fB\-\-force\fR is passed, Homebrew will allow keg\-only formulae to be linked\.
.
.TP
-\fBlinkapps [\-\-local]\fR
-Find all installed formulae that have compiled \fB\.app\fR\-style "application" packages for OS X, and symlink those apps into \fB/Applications\fR, allowing for easier access\.
+\fBlinkapps [\-\-local] [<formulae>]\fR
+Find installed formulae that have compiled \fB\.app\fR\-style "application" packages for OS X, and symlink those apps into \fB/Applications\fR, allowing for easier access\.
+.
+.IP
+If no \fIformulae\fR are provided, all of them will have their \.apps symlinked\.
.
.IP
If provided, \fB\-\-local\fR will move them into the user\'s \fB~/Applications\fR folder instead of the system folder\. It may need to be created, first\.
@@ -376,9 +379,12 @@ Example: \fBbrew install jruby && brew test jruby\fR
Remove symlinks for \fIformula\fR from the Homebrew prefix\. This can be useful for temporarily disabling a formula: \fBbrew unlink foo && commands && brew link foo\fR\.
.
.TP
-\fBunlinkapps [\-\-local]\fR
+\fBunlinkapps [\-\-local] [<formulae>]\fR
Removes links created by \fBbrew linkapps\fR\.
.
+.IP
+If no \fIformulae\fR are provided, all linked app will be removed\.
+.
.TP
\fBunpack [\-\-git|\-\-patch] [\-\-destdir=<path>]\fR \fIformulae\fR:
.