91 lines
3.1 KiB
Ruby
91 lines
3.1 KiB
Ruby
require "language/node"
|
|
|
|
class Kibana < Formula
|
|
desc "Analytics and search dashboard for Elasticsearch"
|
|
homepage "https://www.elastic.co/products/kibana"
|
|
# Pinned at 6.2.x because of a licencing issue
|
|
# See: https://github.com/Homebrew/homebrew-core/pull/28995
|
|
url "https://github.com/elastic/kibana.git",
|
|
:tag => "v6.2.4",
|
|
:revision => "ee501cfd9c1281cfbd6948e1c5f80dc9356ee56f"
|
|
head "https://github.com/elastic/kibana.git"
|
|
|
|
bottle do
|
|
sha256 "990d72d9eb8572e62424519be38041c48c24e3e3206b8f1e58f72449c3c34906" => :high_sierra
|
|
sha256 "de9ecf592509e75446c5298a8423982ed9e9d705691818233242f6a35519a50c" => :sierra
|
|
sha256 "057d166935aa00f6564b4ca6ee4eb237b3c7f08a3d9d9bf351f3c08f5d08bff7" => :el_capitan
|
|
end
|
|
|
|
resource "node" do
|
|
url "https://github.com/nodejs/node.git",
|
|
:tag => "v6.14.0",
|
|
:revision => "2c93af2da3b696e2389ba46608efb9bdffd8badd"
|
|
end
|
|
|
|
def install
|
|
resource("node").stage do
|
|
system "./configure", "--prefix=#{libexec}/node"
|
|
system "make", "install"
|
|
end
|
|
|
|
# do not build packages for other platforms
|
|
inreplace buildpath/"tasks/config/platforms.js", /('(linux-x64|windows-x64)',?(?!;))/, "// \\1"
|
|
|
|
# trick the build into thinking we've already downloaded the Node.js binary
|
|
mkdir_p buildpath/".node_binaries/#{resource("node").version}/darwin-x64"
|
|
|
|
# set npm env and fix cache edge case (https://github.com/Homebrew/brew/pull/37#issuecomment-208840366)
|
|
ENV.prepend_path "PATH", prefix/"libexec/node/bin"
|
|
system "npm", "install", "-ddd", "--build-from-source", "--#{Language::Node.npm_cache_config}"
|
|
system "npm", "run", "build", "--", "--release", "--skip-os-packages", "--skip-archives"
|
|
|
|
prefix.install Dir["build/kibana-#{version}-darwin-x86_64/{bin,config,node_modules,optimize,package.json,src,ui_framework,webpackShims}"]
|
|
|
|
inreplace "#{bin}/kibana", %r{/node/bin/node}, "/libexec/node/bin/node"
|
|
inreplace "#{bin}/kibana-plugin", %r{/node/bin/node}, "/libexec/node/bin/node"
|
|
|
|
cd prefix do
|
|
inreplace "config/kibana.yml", "/var/run/kibana.pid", var/"run/kibana.pid"
|
|
(etc/"kibana").install Dir["config/*"]
|
|
rm_rf "config"
|
|
end
|
|
end
|
|
|
|
def post_install
|
|
ln_s etc/"kibana", prefix/"config"
|
|
(prefix/"data").mkdir
|
|
(prefix/"plugins").mkdir
|
|
end
|
|
|
|
def caveats; <<~EOS
|
|
Config: #{etc}/kibana/
|
|
If you wish to preserve your plugins upon upgrade, make a copy of
|
|
#{opt_prefix}/plugins before upgrading, and copy it into the
|
|
new keg location after upgrading.
|
|
EOS
|
|
end
|
|
|
|
plist_options :manual => "kibana"
|
|
|
|
def plist; <<~EOS
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
|
|
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
<plist version="1.0">
|
|
<dict>
|
|
<key>Label</key>
|
|
<string>#{plist_name}</string>
|
|
<key>Program</key>
|
|
<string>#{opt_bin}/kibana</string>
|
|
<key>RunAtLoad</key>
|
|
<true/>
|
|
</dict>
|
|
</plist>
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
ENV["BABEL_CACHE_PATH"] = testpath/".babelcache.json"
|
|
assert_match /#{version}/, shell_output("#{bin}/kibana -V")
|
|
end
|
|
end
|