homebrew-core/Formula/ipfs.rb

61 lines
1.7 KiB
Ruby

class Ipfs < Formula
desc "Peer-to-peer hypermedia protocol"
homepage "https://ipfs.io/"
url "https://github.com/ipfs/go-ipfs.git",
tag: "v0.8.0",
revision: "ce693d7e81e0206b3afbce30333c21a36a9f094b"
license all_of: [
"MIT",
any_of: ["MIT", "Apache-2.0"],
]
head "https://github.com/ipfs/go-ipfs.git"
livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)$/i)
end
bottle do
sha256 cellar: :any_skip_relocation, big_sur: "26b96618554fa924bf04a04b0f3c68714b92b1493f9391c973b7eb7b3409a744"
sha256 cellar: :any_skip_relocation, catalina: "f75c5837fecebbeeb36be86091e719d85b0922654d406753bfe3c4f7f4a2e1a9"
sha256 cellar: :any_skip_relocation, mojave: "868371961578f442159865ff5111d778dbc730cda71058f942cbb354e6a46029"
end
depends_on "go@1.14" => :build
def install
ENV["GOPATH"] = buildpath
(buildpath/"src/github.com/ipfs/go-ipfs").install buildpath.children
cd("src/github.com/ipfs/go-ipfs") { system "make", "install" }
bin.install "bin/ipfs"
cd("src/github.com/ipfs/go-ipfs") { bash_completion.install "misc/completion/ipfs-completion.bash" }
end
plist_options manual: "ipfs daemon"
def plist
<<~EOS
<?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>#{opt_bin}/ipfs</string>
<string>daemon</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
EOS
end
test do
assert_match "initializing IPFS node", shell_output(bin/"ipfs init")
end
end