-
Notifications
You must be signed in to change notification settings - Fork 2
/
swarm-bee.rb
64 lines (53 loc) · 2.05 KB
/
swarm-bee.rb
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# typed: false
# frozen_string_literal: true
# This file was generated by GoReleaser. DO NOT EDIT.
class SwarmBee < Formula
desc "Ethereum Swarm node"
homepage "https://swarm.ethereum.org/"
version "2.3.2"
depends_on :macos
if Hardware::CPU.intel?
url "https://github.com/ethersphere/bee/releases/download/v2.3.2/bee-darwin-amd64.tar.gz"
sha256 "65cab755995c00e362a49a53d132db5d58faca7ed590dac7d5ebca71d07bbe3c"
def install
(etc/"swarm-bee").mkpath
(var/"lib/swarm-bee").mkpath
bin.install ["bee", "bee-get-addr"]
etc.install "bee.yaml" => "swarm-bee/bee.yaml" unless File.exists? etc/"swarm-bee/bee.yaml"
end
end
if Hardware::CPU.arm?
url "https://github.com/ethersphere/bee/releases/download/v2.3.2/bee-darwin-arm64.tar.gz"
sha256 "8cc63a1134d29edf3e5ef777c99578309f65e794c2e87fc26d69e1f12f1fc570"
def install
(etc/"swarm-bee").mkpath
(var/"lib/swarm-bee").mkpath
bin.install ["bee", "bee-get-addr"]
etc.install "bee.yaml" => "swarm-bee/bee.yaml" unless File.exists? etc/"swarm-bee/bee.yaml"
end
end
def post_install
unless File.exists? "#{var}/lib/swarm-bee/password"
system("openssl", "rand", "-out", var/"lib/swarm-bee/password", "-base64", "32")
end
system(bin/"bee", "init", "--config", etc/"swarm-bee/bee.yaml", ">/dev/null", "2>&1")
end
def caveats
<<~EOS
Logs: #{var}/log/swarm-bee/bee.log
Config: #{etc}/swarm-bee/bee.yaml
Bee requires a Gnosis Chain RPC endpoint to function. By default this is expected to be found at ws://localhost:8546.
Please see https://docs.ethswarm.org/docs/installation/install for more details on how to configure your node.
After you finish configuration run 'bee-get-addr' and fund your node with XDAI, and also XBZZ if so desired.
EOS
end
service do
run [bin/"bee", "start", "--config", etc/"swarm-bee/bee.yaml"]
keep_alive true
error_log_path var/"log/swarm-bee/bee.log"
log_path var/"log/swarm-bee/bee.log"
end
test do
system "#{bin}/bee version"
end
end