2014-07-07 23:43:44 +00:00
|
|
|
class Cayley < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Graph database inspired by Freebase and Knowledge Graph"
|
2016-10-04 18:50:59 +00:00
|
|
|
homepage "https://github.com/cayleygraph/cayley"
|
|
|
|
url "https://github.com/cayleygraph/cayley/archive/v0.6.0.tar.gz"
|
|
|
|
sha256 "b55d6b02567dd0a1c51001cb25d5bde602358f621cdf78ba40bdf8a8c51422b0"
|
2014-07-07 23:43:44 +00:00
|
|
|
head "https://github.com/google/cayley.git"
|
|
|
|
|
2014-07-08 18:04:56 +00:00
|
|
|
bottle do
|
2015-12-07 04:33:10 +00:00
|
|
|
cellar :any_skip_relocation
|
2016-10-04 19:04:39 +00:00
|
|
|
sha256 "06e628c51dffbcebc9cc881e1179c9174d445940877bba122759d2c8c67e6dbb" => :sierra
|
|
|
|
sha256 "452f7b30fe5159cf9ef3775b8f2ecaf930b21b84c635ecd54fc003aad8ae183f" => :el_capitan
|
|
|
|
sha256 "e3895acb97793b73d523db3060a6aa12d92460e37f2c8dbc40262bc60ab63b76" => :yosemite
|
2014-07-08 18:04:56 +00:00
|
|
|
end
|
|
|
|
|
2016-07-04 10:42:25 +00:00
|
|
|
option "without-samples", "Don't install sample data"
|
2015-12-19 06:35:21 +00:00
|
|
|
|
2014-07-07 23:43:44 +00:00
|
|
|
depends_on "bazaar" => :build
|
2016-09-24 15:45:48 +00:00
|
|
|
depends_on :hg => :build
|
2016-10-04 18:50:59 +00:00
|
|
|
depends_on "glide" => :build
|
2014-07-07 23:43:44 +00:00
|
|
|
depends_on "go" => :build
|
2015-05-25 00:41:09 +00:00
|
|
|
|
2014-07-07 23:43:44 +00:00
|
|
|
def install
|
|
|
|
ENV["GOPATH"] = buildpath
|
2016-10-04 18:50:59 +00:00
|
|
|
ENV["GLIDE_HOME"] = HOMEBREW_CACHE/"glide_home/#{name}"
|
|
|
|
|
|
|
|
(buildpath/"src/github.com/cayleygraph/cayley").install buildpath.children
|
|
|
|
cd "src/github.com/cayleygraph/cayley" do
|
|
|
|
system "glide", "install"
|
|
|
|
system "go", "build", "-o", bin/"cayley", "-ldflags",
|
|
|
|
"-X main.Version=#{version}", ".../cmd/cayley"
|
2014-07-07 23:43:44 +00:00
|
|
|
|
2016-07-04 10:42:25 +00:00
|
|
|
inreplace "cayley.cfg.example", "/tmp/cayley_test", var/"cayley"
|
|
|
|
etc.install "cayley.cfg.example" => "cayley.conf"
|
2014-07-07 23:43:44 +00:00
|
|
|
|
2016-07-04 10:42:25 +00:00
|
|
|
(pkgshare/"assets").install "docs", "static", "templates"
|
2014-07-07 23:43:44 +00:00
|
|
|
|
2016-07-04 10:42:25 +00:00
|
|
|
if build.with? "samples"
|
|
|
|
system "gzip", "-d", "data/30kmoviedata.nq.gz"
|
|
|
|
(pkgshare/"samples").install "data/testdata.nq", "data/30kmoviedata.nq"
|
|
|
|
end
|
2014-07-07 23:43:44 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-07-09 16:22:08 +00:00
|
|
|
def post_install
|
2016-07-04 10:42:25 +00:00
|
|
|
unless File.exist? var/"cayley"
|
2014-07-09 16:22:08 +00:00
|
|
|
(var/"cayley").mkpath
|
|
|
|
|
2016-07-04 10:42:25 +00:00
|
|
|
# Initialize the database
|
|
|
|
system bin/"cayley", "init", "--config=#{etc}/cayley.conf"
|
2014-07-09 16:22:08 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-09-24 15:45:48 +00:00
|
|
|
plist_options :manual => "cayley http --assets=#{HOMEBREW_PREFIX}/share/cayley/assets --config=#{HOMEBREW_PREFIX}/etc/cayley.conf"
|
2014-07-07 23:43:44 +00:00
|
|
|
|
|
|
|
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>
|
|
|
|
<dict>
|
|
|
|
<key>SuccessfulExit</key>
|
|
|
|
<false/>
|
|
|
|
</dict>
|
|
|
|
<key>Label</key>
|
|
|
|
<string>#{plist_name}</string>
|
|
|
|
<key>ProgramArguments</key>
|
|
|
|
<array>
|
|
|
|
<string>#{opt_bin}/cayley</string>
|
2014-07-09 16:22:08 +00:00
|
|
|
<string>http</string>
|
2016-01-20 11:50:13 +00:00
|
|
|
<string>--assets=#{opt_pkgshare}/assets</string>
|
2014-07-07 23:43:44 +00:00
|
|
|
<string>--config=#{etc}/cayley.conf</string>
|
|
|
|
</array>
|
|
|
|
<key>RunAtLoad</key>
|
|
|
|
<true/>
|
|
|
|
<key>WorkingDirectory</key>
|
|
|
|
<string>#{var}/cayley</string>
|
|
|
|
<key>StandardErrorPath</key>
|
|
|
|
<string>#{var}/log/cayley.log</string>
|
|
|
|
<key>StandardOutPath</key>
|
|
|
|
<string>#{var}/log/cayley.log</string>
|
|
|
|
</dict>
|
|
|
|
</plist>
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2016-07-04 10:42:25 +00:00
|
|
|
assert_match version.to_s, shell_output("#{bin}/cayley version")
|
2014-07-07 23:43:44 +00:00
|
|
|
end
|
|
|
|
end
|