aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/pow.rb
blob: 8f06dae37e98f0b9209f45289a49407d69aad62b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
require "formula"

class Pow < Formula
  homepage "http://pow.cx/"
  url "http://get.pow.cx/versions/0.5.0.tar.gz"
  sha1 "ef44f886a444340b91fb28e2fab3ce5471837a08"

  depends_on "node"

  def install
    libexec.install Dir["*"]
    (bin/"pow").write <<-EOS.undent
      #!/bin/sh
      export POW_BIN="#{bin}/pow"
      exec "#{Formula["node"].opt_bin}/node" "#{libexec}/lib/command.js" "$@"
    EOS
  end

  def caveats;
    <<-EOS.undent
      Create the required host directories:
        mkdir -p ~/Library/Application\\ Support/Pow/Hosts
        ln -s ~/Library/Application\\ Support/Pow/Hosts ~/.pow

      Setup port 80 forwarding and launchd agents:
        sudo pow --install-system
        pow --install-local

      Load launchd agents:
        sudo launchctl load -w /Library/LaunchDaemons/cx.pow.firewall.plist
        launchctl load -w ~/Library/LaunchAgents/cx.pow.powd.plist
    EOS
  end
end