-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathskynet.rb
81 lines (64 loc) · 2.2 KB
/
skynet.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
require 'formula'
class Skynet < Formula
homepage 'https://github.com/skynetservices/skynet2'
url 'http://homebrew-skynet.s3.amazonaws.com/skynet-0.1.0.tar.gz'
sha1 '1e05c04f314539d871711a8da59d61d0ae441ac2'
depends_on 'go' => :recommended
option 'without-skydaemon', 'Disable installation of daemon'
fails_with :clang do
cause "clang: error: no such file or directory: 'libgcc.a'"
end
def install
ENV.deparallelize
ENV.no_optimization
ENV['CGO_CFLAGS'] = "-I#{pwd}/src/github.com/skynetservices/skynet2/tools/starter-kit-osx/zookeeper/include"
ENV['CGO_LDFLAGS'] = "#{pwd}/src/github.com/skynetservices/skynet2/tools/starter-kit-osx/zookeeper/lib/libzookeeper_mt.a"
ENV['GOPATH'] = pwd
cd 'src/github.com/skynetservices/skynet2/cmd/sky' do
system 'go build -a'
bin.install 'sky'
end
unless build.without? 'skydaemon'
cd 'src/github.com/skynetservices/skynet2/cmd/skydaemon' do
system 'go build -a'
bin.install 'skydaemon'
mkdir_p 'lib/skynet'
cd 'lib' do
system 'touch skynet/.skystate'
lib.install 'skynet'
end
end
end
end
def caveats; <<-EOS.undent
If ZooKeeper is not located at "localhost:2181", please set your SKYNET_ZOOKEEPER environment variable appropriately
When using launchd you may also need to set your zookeeper enviroment variable there as well: launchctl setenv SKYNET_ZOOKEEPER host:2181
EOS
end
plist_options :manual => "skydaemon"
def plist; <<-EOS.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>KeepAlive</key>
<true/>
<key>Label</key>
<string>skynet</string>
<key>EnableGlobbing</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>#{bin}/skydaemon</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardOutPath</key>
<string>~/Library/Logs/skydaemon.log</string>
<key>StandardErrorPath</key>
<string>~/Library/Logs/skydaemon_err.log</string>
</dict>
</plist>
EOS
end
end