/
orientdb.rb
71 lines (58 loc) 路 2.67 KB
/
orientdb.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
class Orientdb < Formula
desc "Graph database"
homepage "https://orientdb.com"
url "https://orientdb.com/download.php?file=orientdb-community-2.2.5.tar.gz"
sha256 "958d479beeabeb5658c23460bf29043a7a4b80c0d238f36e586e3b108f12bae0"
bottle do
cellar :any_skip_relocation
sha256 "2d10047d91dd4171419f57a9c3ad35b77754496a63106cf412d41baebf01903e" => :el_capitan
sha256 "084c2e3d596a91c63a4f5a57f6c61c3df6c2531dca1e849eeb7983e3a099c84f" => :yosemite
sha256 "86f94f50e2e4c6d18263f256e0dd2f70fbb099254850afa0d286a59ade8d26ef" => :mavericks
end
# Fixing OrientDB init scripts
patch do
url "https://gist.githubusercontent.com/maggiolo00/84835e0b82a94fe9970a/raw/1ed577806db4411fd8b24cd90e516580218b2d53/orientdbsh"
sha256 "d8b89ecda7cb78c940b3c3a702eee7b5e0f099338bb569b527c63efa55e6487e"
end
def install
rm_rf Dir["{bin,benchmarks}/*.{bat,exe}"]
inreplace %W[bin/orientdb.sh bin/console.sh bin/gremlin.sh],
'"YOUR_ORIENTDB_INSTALLATION_PATH"', libexec
chmod 0755, Dir["bin/*"]
libexec.install Dir["*"]
inreplace "#{libexec}/config/orientdb-server-config.xml", "</properties>",
<<-EOS.undent
<entry name="server.database.path" value="#{var}/db/orientdb" />
</properties>
EOS
inreplace "#{libexec}/config/orientdb-server-log.properties", "../log", "#{var}/log/orientdb"
inreplace "#{libexec}/bin/orientdb.sh", "../log", "#{var}/log/orientdb"
inreplace "#{libexec}/bin/server.sh", "ORIENTDB_PID=$ORIENTDB_HOME/bin", "ORIENTDB_PID=#{var}/run/orientdb"
inreplace "#{libexec}/bin/shutdown.sh", "ORIENTDB_PID=$ORIENTDB_HOME/bin", "ORIENTDB_PID=#{var}/run/orientdb"
bin.install_symlink "#{libexec}/bin/orientdb.sh" => "orientdb"
bin.install_symlink "#{libexec}/bin/console.sh" => "orientdb-console"
bin.install_symlink "#{libexec}/bin/gremlin.sh" => "orientdb-gremlin"
end
def post_install
(var/"db/orientdb").mkpath
(var/"run/orientdb").mkpath
(var/"log/orientdb").mkpath
touch "#{var}/log/orientdb/orientdb.err"
touch "#{var}/log/orientdb/orientdb.log"
end
def caveats
"Use `orientdb <start | stop | status>`, `orientdb-console` and `orientdb-gremlin`."
end
test do
ENV["CONFIG_FILE"] = "#{testpath}/orientdb-server-config.xml"
cp "#{libexec}/config/orientdb-server-config.xml", testpath
inreplace "#{testpath}/orientdb-server-config.xml", "</properties>", " <entry name=\"server.database.path\" value=\"#{testpath}\" />\n </properties>"
system "#{bin}/orientdb", "start"
sleep 4
begin
assert_match "OrientDB Server v.2.2.5", shell_output("curl -I localhost:2480")
ensure
system "#{bin}/orientdb", "stop"
end
end
end