From 691696441111ff4b8830c3198e25fd257aa25c3d Mon Sep 17 00:00:00 2001 From: gunnaraasen Date: Tue, 8 Dec 2015 11:20:16 -0800 Subject: [PATCH] kapacitor 0.2.0 (new formula) Closes Homebrew/homebrew#46803. Signed-off-by: Mike McQuaid --- Formula/kapacitor.rb | 198 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 198 insertions(+) create mode 100644 Formula/kapacitor.rb diff --git a/Formula/kapacitor.rb b/Formula/kapacitor.rb new file mode 100644 index 0000000000..014d2e85ce --- /dev/null +++ b/Formula/kapacitor.rb @@ -0,0 +1,198 @@ +require "language/go" + +class Kapacitor < Formula + desc "Open source time series data processor" + homepage "https://github.com/influxdb/kapacitor" + url "https://github.com/influxdb/kapacitor.git", + :tag => "v0.2.0", + :revision => "18b2061efb263aae326f51bd74d7023a221996ef" + + head "https://github.com/influxdb/kapacitor.git" + + depends_on "go" => :build + + go_resource "github.com/armon/go-metrics" do + url "https://github.com/armon/go-metrics.git", + :revision => "6c5fa0d8f48f4661c9ba8709799c88d425ad20f0" + end + + go_resource "github.com/boltdb/bolt" do + url "https://github.com/boltdb/bolt.git", + :revision => "6e1ca38c6a73025366cd8705553b404746ee6e63" + end + + go_resource "github.com/gogo/protobuf" do + url "https://github.com/gogo/protobuf.git", + :revision => "d3235f01ecae4901dd9f7ea6af57a352c0189deb" + end + + go_resource "github.com/gorhill/cronexpr" do + url "https://github.com/gorhill/cronexpr.git", + :revision => "a557574d6c024ed6e36acc8b610f5f211c91568a" + end + + go_resource "github.com/hashicorp/go-msgpack" do + url "https://github.com/hashicorp/go-msgpack.git", + :revision => "fa3f63826f7c23912c15263591e65d54d080b458" + end + + go_resource "github.com/hashicorp/raft" do + url "https://github.com/hashicorp/raft.git", + :revision => "d136cd15dfb7876fd7c89cad1995bc4f19ceb294" + end + + go_resource "github.com/hashicorp/raft-boltdb" do + url "https://github.com/hashicorp/raft-boltdb.git", + :revision => "d1e82c1ec3f15ee991f7cc7ffd5b67ff6f5bbaee" + end + + go_resource "github.com/influxdb/enterprise-client" do + url "https://github.com/influxdb/enterprise-client.git", + :revision => "25665cba4f54fa822546c611c9414ac31aa10faa" + end + + go_resource "github.com/influxdb/influxdb" do + url "https://github.com/influxdb/influxdb.git", + :revision => "45502d288f79b60051a7ec9260ad59dacb5b1a6c" + end + + go_resource "github.com/twinj/uuid" do + url "https://github.com/twinj/uuid.git", + :revision => "89173bcdda19db0eb88aef1e1cb1cb2505561d31" + end + + go_resource "golang.org/x/crypto" do + url "https://go.googlesource.com/crypto.git", + :revision => "beef0f4390813b96e8e68fd78570396d0f4751fc" + end + + go_resource "gopkg.in/fatih/pool.v2" do + url "https://gopkg.in/fatih/pool.v2.git", + :revision => "cba550ebf9bce999a02e963296d4bc7a486cb715" + end + + go_resource "github.com/BurntSushi/toml" do + url "https://github.com/BurntSushi/toml.git", + :revision => "056c9bc7be7190eaa7715723883caffa5f8fa3e4" + end + + go_resource "github.com/kimor79/gollectd" do + url "https://github.com/kimor79/gollectd.git", + :revision => "61d0deeb4ffcc167b2a1baa8efd72365692811bc" + end + + go_resource "gopkg.in/gomail.v2" do + url "https://gopkg.in/gomail.v2.git", + :revision => "41f3572897373c5538c50a2402db15db079fa4fd" + end + + go_resource "github.com/serenize/snaker" do + url "https://github.com/serenize/snaker.git", + :revision => "d88cc11617e4f179fa2c821a60908d5fabd7bdad" + end + + go_resource "github.com/shurcooL/markdownfmt" do + url "https://github.com/shurcooL/markdownfmt.git", + :revision => "c6ad3c69d14e5089336af1e41e595f0826df1b82" + end + + go_resource "github.com/dustin/go-humanize" do + url "https://github.com/dustin/go-humanize.git", + :revision => "64dbdae0d393b7d71480a6dace78456396b55286" + end + + go_resource "github.com/mattn/go-runewidth" do + url "https://github.com/mattn/go-runewidth.git", + :revision => "d96d1bd051f2bd9e7e43d602782b37b93b1b5666" + end + + go_resource "github.com/russross/blackfriday" do + url "https://github.com/russross/blackfriday.git", + :revision => "300106c228d52c8941d4b3de6054a6062a86dda3" + end + + go_resource "github.com/shurcooL/go" do + url "https://github.com/shurcooL/go.git", + :revision => "ee4d3ba2f39466dd17fc55dd260e89b8963640f8" + end + + go_resource "github.com/shurcooL/sanitized_anchor_name" do + url "https://github.com/shurcooL/sanitized_anchor_name.git", + :revision => "10ef21a441db47d8b13ebcc5fd2310f636973c77" + end + + def install + ENV["GOPATH"] = buildpath + kapacitor_path = buildpath/"src/github.com/influxdb/kapacitor" + kapacitor_path.install Dir["*"] + revision = `git rev-parse HEAD` + + Language::Go.stage_deps resources, buildpath/"src" + + cd kapacitor_path do + system "go", "install", + "-ldflags", "-X main.version=#{version} -X main.commit=#{revision}", + "./..." + end + + inreplace kapacitor_path/"etc/kapacitor/kapacitor.conf" do |s| + s.gsub! "/var/lib/kapacitor", "#{var}/kapacitor" + s.gsub! "/var/log/kapacitor", "#{var}/log" + end + + bin.install "bin/kapacitord" + bin.install "bin/kapacitor" + etc.install kapacitor_path/"etc/kapacitor/kapacitor.conf" => "kapacitor.conf" + + (var/"kapacitor/replay").mkpath + (var/"kapacitor/tasks").mkpath + end + + plist_options :manual => "kapacitord -config #{HOMEBREW_PREFIX}/etc/kapacitor.conf" + + def plist; <<-EOS.undent + + + + + KeepAlive + + SuccessfulExit + + + Label + #{plist_name} + ProgramArguments + + #{opt_bin}/kapacitord + -config + #{HOMEBREW_PREFIX}/etc/kapacitor.conf + + RunAtLoad + + WorkingDirectory + #{var} + StandardErrorPath + #{var}/log/kapacitor.log + StandardOutPath + #{var}/log/kapacitor.log + + + EOS + end + + test do + logo = <<-EOS.undent + '##:::'##::::'###::::'########:::::'###:::::'######::'####:'########::'#######::'########:: + ##::'##::::'## ##::: ##.... ##:::'## ##:::'##... ##:. ##::... ##..::'##.... ##: ##.... ##: + ##:'##::::'##:. ##:: ##:::: ##::'##:. ##:: ##:::..::: ##::::: ##:::: ##:::: ##: ##:::: ##: + #####::::'##:::. ##: ########::'##:::. ##: ##:::::::: ##::::: ##:::: ##:::: ##: ########:: + ##. ##::: #########: ##.....::: #########: ##:::::::: ##::::: ##:::: ##:::: ##: ##.. ##::: + ##:. ##:: ##.... ##: ##:::::::: ##.... ##: ##::: ##:: ##::::: ##:::: ##:::: ##: ##::. ##:: + ##::. ##: ##:::: ##: ##:::::::: ##:::: ##:. ######::'####:::: ##::::. #######:: ##:::. ##: + ..::::..::..:::::..::..:::::::::..:::::..:::......:::....:::::..::::::.......:::..:::::..:: + EOS + (testpath/"config.toml").write shell_output("kapacitord config") + assert_match /#{logo}/m, shell_output("kapacitord -config #{testpath}/config.toml", 1) + end +end