homebrew-core/Formula/kibana@6.rb

89 lines
2.8 KiB
Ruby

class KibanaAT6 < Formula
desc "Analytics and search dashboard for Elasticsearch"
homepage "https://www.elastic.co/products/kibana"
url "https://github.com/elastic/kibana.git",
tag: "v6.8.11",
revision: "0bf552bd6baafe3053c68dd20af14a088065df69"
license "Apache-2.0"
bottle do
cellar :any_skip_relocation
sha256 "14afbf843c4d5c49a9d954d97d14dfe5191441cdf80ae81b0938ce0f1caf0ab4" => :catalina
sha256 "a61a2125471d6f22601d938f4626f0d962cec6b17bc511bcff67ca6ce8d14655" => :mojave
sha256 "3c72706fade6f3ecf040761629a7a51bb709614e61d197285a268fd7f65f647d" => :high_sierra
end
keg_only :versioned_formula
depends_on "yarn" => :build
depends_on :macos # Due to Python 2
depends_on "node@10"
def install
# remove non open source files
rm_rf "x-pack"
inreplace "package.json", /"x-pack":.*/, ""
# patch build to not try to read tsconfig.json's from the removed x-pack folder
inreplace "src/dev/typescript/projects.ts" do |s|
s.gsub! "new Project(resolve(REPO_ROOT, 'x-pack/tsconfig.json')),", ""
s.gsub! "new Project(resolve(REPO_ROOT, 'x-pack/test/tsconfig.json'), 'x-pack/test'),", ""
end
inreplace "package.json", /"node": "10\.\d+\.\d+"/, %Q("node": "#{Formula["node@10"].version}")
system "yarn", "kbn", "bootstrap"
system "yarn", "build", "--oss", "--release", "--skip-os-packages", "--skip-archives"
prefix.install Dir
.glob("build/oss/kibana-#{version}-darwin-x86_64/**")
.reject { |f| File.fnmatch("build/oss/kibana-#{version}-darwin-x86_64/{node, data, plugins}", f) }
mv "licenses/APACHE-LICENSE-2.0.txt", "LICENSE.txt" # install OSS license
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