aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/perforce-proxy.rb
diff options
context:
space:
mode:
authorMatthew Lewinski2012-02-03 21:06:41 -0600
committerJack Nagel2012-02-03 22:39:30 -0600
commitac7eb09d0f43ce932f316f8b0ede7f265fa32592 (patch)
tree51ab326250f045fd9b296b101ae93ecb3fdb144f /Library/Formula/perforce-proxy.rb
parent005616fab0971a77626297caa99d6c01b21483c6 (diff)
downloadhomebrew-ac7eb09d0f43ce932f316f8b0ede7f265fa32592.tar.bz2
New formula: perforce-proxy
Closes #9578. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library/Formula/perforce-proxy.rb')
-rw-r--r--Library/Formula/perforce-proxy.rb68
1 files changed, 68 insertions, 0 deletions
diff --git a/Library/Formula/perforce-proxy.rb b/Library/Formula/perforce-proxy.rb
new file mode 100644
index 000000000..6f8b4604c
--- /dev/null
+++ b/Library/Formula/perforce-proxy.rb
@@ -0,0 +1,68 @@
+require 'formula'
+
+class PerforceProxy < Formula
+ url 'http://filehost.perforce.com/perforce/r11.1/bin.darwin90u/p4p'
+ homepage 'http://www.perforce.com/'
+ md5 '2b088a486f6e431110c6926f4f63b489'
+ version '2011.1.393975'
+
+ def install
+ sbin.install 'p4p'
+
+ (var+"p4p").mkpath
+
+ plist_path.write startup_plist
+ plist_path.chmod 0644
+ end
+
+ def caveats; <<-EOS.undent
+ To use the Perforce proxy to access your Perforce server, set your P4PORT
+ environment variable to "localhost:1666".
+
+ To launch on startup:
+ * if this is your first install:
+ mkdir -p ~/Library/LaunchAgents
+ cp #{plist_path} ~/Library/LaunchAgents/
+ launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename}
+
+ * if this is an upgrade and you already have the #{plist_path.basename} loaded:
+ launchctl unload -w ~/Library/LaunchAgents/#{plist_path.basename}
+ cp #{plist_path} ~/Library/LaunchAgents/
+ launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename}
+
+ Before starting the proxy server, you probably need to edit the plist to use
+ the correct host and port for your Perforce server (replacing the default
+ perforce:1666).
+ EOS
+ end
+
+ def startup_plist; <<-EOPLIST.undent
+ <?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+ <plist version="1.0">
+ <dict>
+ <key>Label</key>
+ <string>#{plist_name}</string>
+ <key>ProgramArguments</key>
+ <array>
+ <string>#{HOMEBREW_PREFIX}/sbin/p4p</string>
+ <string>-p</string>
+ <string>1666</string>
+ <string>-r</string>
+ <string>#{var}/p4p</string>
+ <string>-t</string>
+ <string>perforce:1666</string>
+ </array>
+ <key>RunAtLoad</key>
+ <true/>
+ <key>KeepAlive</key>
+ <true/>
+ <key>UserName</key>
+ <string>#{`whoami`.chomp}</string>
+ <key>WorkingDirectory</key>
+ <string>#{var}/p4p</string>
+ </dict>
+ </plist>
+ EOPLIST
+ end
+end