91 lines
3.1 KiB
Ruby
91 lines
3.1 KiB
Ruby
require "language/node"
|
|
|
|
class KibanaAT56 < Formula
|
|
desc "Analytics and search dashboard for Elasticsearch"
|
|
homepage "https://www.elastic.co/products/kibana"
|
|
url "https://github.com/elastic/kibana.git",
|
|
:tag => "v5.6.7",
|
|
:revision => "8221b17926966fd1e433367d6f725a69f321d5ad"
|
|
head "https://github.com/elastic/kibana.git"
|
|
|
|
bottle do
|
|
sha256 "d35170e2f5c89a78fcbbeb6f899be299e1bc176ac97e3c51f8f81f6dad695700" => :high_sierra
|
|
sha256 "d1078f08d51d34e1de00e8b166cfb187e4691214552f49c6af32b0b0ed2c522b" => :sierra
|
|
sha256 "4a51eb5bba03797eb5a9b4d74e607883bbce6f2f776c5d87f33e480bbc298945" => :el_capitan
|
|
end
|
|
|
|
keg_only :versioned_formula
|
|
|
|
resource "node" do
|
|
url "https://nodejs.org/dist/v6.11.1/node-v6.11.1.tar.xz"
|
|
sha256 "6f6655b85919aa54cb045a6d69a226849802fcc26491d0db4ce59873e41cc2b8"
|
|
end
|
|
|
|
def install
|
|
resource("node").stage do
|
|
system "./configure", "--prefix=#{libexec}/node"
|
|
system "make", "test"
|
|
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
|