homebrew-core/Formula/kibana@6.rb

89 lines
3.0 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.12",
revision: "e6710c74e05998719369fe1b92ac1726aa6f0271"
license "Apache-2.0"
bottle do
sha256 cellar: :any_skip_relocation, big_sur: "c6851cd00abc11d5bf62fd244e601e9b9071443c545e3713077ec0cccfd8fc59"
sha256 cellar: :any_skip_relocation, catalina: "d13d9e35a2d55f1e316a16a6dc7662a0be783b11e0707f445902da1a6084a207"
sha256 cellar: :any_skip_relocation, mojave: "726bc34894f26bc18d9b1b9d756febefb03d76ef598445c406f18840554f6198"
sha256 cellar: :any_skip_relocation, high_sierra: "4bd89cc139a35c58402dabeaab5dcbccf02e6bd269122b454723941449984f9e"
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.to_s, shell_output("#{bin}/kibana -V")
end
end