homebrew-core/Formula/logstash.rb
Jason Tedor 03558a3e83 logstash: add HEAD.
This commit enables support for building and installing logstash from
the master branch of the logstash repository.

Closes Homebrew/homebrew#46495.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-12-07 15:17:15 +00:00

48 lines
1.5 KiB
Ruby

class Logstash < Formula
desc "Tool for managing events and logs"
homepage "https://www.elastic.co/products/logstash"
url "https://download.elastic.co/logstash/logstash/logstash-2.1.0.tar.gz"
sha256 "1f132e0fc9fc46ebe836951bb44c5cd1a5f8e3f653bb44bded55300cc6c892dc"
bottle :unneeded
head do
url "https://github.com/elastic/logstash.git"
depends_on :java => "1.8"
end
depends_on :java => "1.7+"
def install
if build.head?
# Build the package from source
system "rake", "artifact:tar"
# Extract the package to the current directory
mkdir "tar"
system "tar", "--strip-components=1", "-xf", Dir["build/logstash-*.tar.gz"].first, "-C", "tar"
cd "tar"
end
sub = if build.head? then "SOURCEPATH" else "0" end
inreplace %w[bin/logstash], %r{^\. "\$\(cd `dirname \$#{sub}`\/\.\.; pwd\)\/bin\/logstash\.lib\.sh\"}, ". #{libexec}/bin/logstash.lib.sh"
inreplace %w[bin/logstash.lib.sh], /^LOGSTASH_HOME=.*$/, "LOGSTASH_HOME=#{libexec}"
libexec.install Dir["*"]
bin.install_symlink libexec/"bin/logstash"
end
def caveats; <<-EOS.undent
Please read the getting started guide located at:
https://www.elastic.co/guide/en/logstash/current/getting-started-with-logstash.html
EOS
end
test do
(testpath/"simple.conf").write <<-EOS.undent
input { stdin { type => stdin } }
output { stdout { codec => rubydebug } }
EOS
output = pipe_output("#{bin}/logstash -f simple.conf", "hello world\n")
assert_match /hello world/, output
end
end