homebrew-core/Formula/titan-server.rb

62 lines
1.8 KiB
Ruby
Raw Normal View History

titan-server 0.4.4 (new formula) This commit adds the Titan graph database homebrew formula. Of all versions of Titan ([found here](https://github.com/thinkaurelius/titan/wiki/Downloads)) available, this will install and configure the Titan/All version with everything prepackaged. As a Java-based install it puts all necessary items into the libexec folder and symlinks the titan.sh file (into 'titan') and rexster-console.sh (into 'titan-rexster-console'). Considering that the primary goal of the Titan package is to launch the titan graphDB and provide a function to connect remotely (through the rexster console) I felt it best to only symlink the aforementioned files rather than everything within the /bin directory. This better allows homebrew users to only receive the necessary files in their path as to not confuse against other possible homebrew formulas (now or later) that come packaged with titan (i.e. cassandra). Also, I feel it best to keep the inline patch for the two script files rather than report the symlink issue upstream as this is primarily a homebrew install issue. Also, given that the titan /bin directory comes with so many files it seems unnecessary to patch all possible files when not all are needed (i.e. symlinked). That said if one were not to submit a patch upstream to titan for all bin/ items, then it seems only relevant, regarding the homebrew formula, to keep the inline patch for the necessary items that homebrew would symlink. Closes Homebrew/homebrew#30107. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2014-06-13 01:43:51 +00:00
require "formula"
class TitanServer < Formula
homepage "https://thinkaurelius.github.io/titan/"
url "http://s3.thinkaurelius.com/downloads/titan/titan-server-0.4.4.zip"
sha1 "549f14f372fb94bf567a34f7e1bcc650addfee8a"
# In reference to PR #30107 this patch will update the titan.sh and rexster-console.sh
# scripts to properly follow multiple symlinks so that java calls can accurately find
# their associated necessary libraries.
patch :DATA
def install
libexec.install %w[bin conf doc ext lib log rexhome]
bin.install_symlink libexec/"bin/titan.sh" => "titan"
bin.install_symlink libexec/"bin/rexster-console.sh" => "titan-rexster-console"
end
test do
system "#{bin}/titan", "stop"
end
end
__END__
diff --git a/bin/rexster-console.sh b/bin/rexster-console.sh
index dabc213..145085c 100755
--- a/bin/rexster-console.sh
+++ b/bin/rexster-console.sh
@@ -1,7 +1,13 @@
#!/bin/bash
set_unix_paths() {
- BIN="$(dirname $0)"
+ SOURCE="${BASH_SOURCE[0]}"
+ while [ -h "$SOURCE" ]; do
+ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+ SOURCE="$(readlink "$SOURCE")"
+ [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
+ done
+ BIN="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
CP="$(echo $BIN/../conf $BIN/../lib/*.jar . | tr ' ' ':')"
CP="$CP:$(find -L $BIN/../ext/ -name "*.jar" | tr '\n' ':')"
}
diff --git a/bin/titan.sh b/bin/titan.sh
index 0ea74c9..a78c48b 100755
--- a/bin/titan.sh
+++ b/bin/titan.sh
@@ -1,6 +1,12 @@
#!/bin/bash
-BIN="`dirname $0`"
+SOURCE="${BASH_SOURCE[0]}"
+while [ -h "$SOURCE" ]; do
+ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+ SOURCE="$(readlink "$SOURCE")"
+ [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
+done
+BIN="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
REXSTER_CONFIG_TAG=cassandra-es
: ${CASSANDRA_STARTUP_TIMEOUT_S:=60}
: ${REXSTER_SHUTDOWN_TIMEOUT_S:=60}