aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorIain Beeston2013-03-03 15:47:27 +1100
committerAdam Vandenberg2013-03-14 11:32:13 -0700
commit65ccc3954be93e802195cbdf375ee621cbe80de5 (patch)
tree7283926df086a64d86f1d4b149172c69f0854376 /Library
parent2d1825747fde2080b614c78199e8c781508c932e (diff)
downloadhomebrew-65ccc3954be93e802195cbdf375ee621cbe80de5.tar.bz2
add brew linkapps --system
Added an option to linkapps to allow linking to /Applications rather than ~/Applications Closes #18196. Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Contributions/cmd/brew-linkapps.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/Library/Contributions/cmd/brew-linkapps.rb b/Library/Contributions/cmd/brew-linkapps.rb
index 92e1f6890..daa19583d 100755
--- a/Library/Contributions/cmd/brew-linkapps.rb
+++ b/Library/Contributions/cmd/brew-linkapps.rb
@@ -1,11 +1,11 @@
# Links any Applications (.app) found in installed prefixes to ~/Applications
require "formula"
-HOME_APPS = File.expand_path("~/Applications")
+TARGET_DIR = ARGV.include?("--system") ? "/Applications" : File.expand_path("~/Applications")
-unless File.exist? HOME_APPS
- opoo "#{HOME_APPS} does not exist, stopping."
- puts "Run `mkdir ~/Applications` first."
+unless File.exist? TARGET_DIR
+ opoo "#{TARGET_DIR} does not exist, stopping."
+ puts "Run `mkdir #{TARGET_DIR}` first."
exit 1
end
@@ -17,7 +17,7 @@ HOMEBREW_CELLAR.subdirs.each do |keg|
Dir["#{f.installed_prefix}/*.app", "#{f.installed_prefix}/bin/*.app", "#{f.installed_prefix}/libexec/*.app"].each do |p|
puts "Linking #{p}"
appname = File.basename(p)
- target = HOME_APPS+"/"+appname
+ target = TARGET_DIR+"/"+appname
if File.exist? target
if File.symlink? target
system "rm", target
@@ -25,9 +25,9 @@ HOMEBREW_CELLAR.subdirs.each do |keg|
onoe "#{target} already exists, skipping."
end
end
- system "ln", "-s", p, HOME_APPS
+ system "ln", "-s", p, TARGET_DIR
end
end
end
-puts "Finished linking. Find the links under ~/Applications."
+puts "Finished linking. Find the links under #{TARGET_DIR}."