kibana@4.1: import from homebrew/versions.
This commit is contained in:
parent
b217444a02
commit
5fd336a961
1 changed files with 97 additions and 0 deletions
97
Formula/kibana@4.1.rb
Normal file
97
Formula/kibana@4.1.rb
Normal file
|
@ -0,0 +1,97 @@
|
|||
require "language/node"
|
||||
|
||||
class KibanaAT41 < Formula
|
||||
desc "Analytics and search dashboard for Elasticsearch"
|
||||
homepage "https://www.elastic.co/products/kibana"
|
||||
url "https://github.com/elastic/kibana.git", :tag => "v4.1.8", :revision => "e4f4c5bef5fbec91f0890bd08f6a622f6c4648ad"
|
||||
head "https://github.com/elastic/kibana.git"
|
||||
|
||||
keg_only :versioned_formula
|
||||
|
||||
resource "node" do
|
||||
url "https://nodejs.org/dist/v4.4.4/node-v4.4.4.tar.gz"
|
||||
sha256 "53c694c203ee18e7cd393612be08c61ed6ab8b2a165260984a99c014d1741414"
|
||||
end
|
||||
|
||||
def install
|
||||
resource("node").stage buildpath/"node"
|
||||
cd buildpath/"node" do
|
||||
system "./configure", "--prefix=#{libexec}/node"
|
||||
system "make", "install"
|
||||
end
|
||||
|
||||
# do not download binary installs of Node.js
|
||||
inreplace buildpath/"tasks/build.js", /('download_node_binaries',)/, "// \\1"
|
||||
|
||||
# do not build packages for other platforms
|
||||
if MacOS.prefer_64_bit?
|
||||
platform = "darwin-x64"
|
||||
else
|
||||
raise "Installing Kibana via Homebrew is only supported on macOS x86_64"
|
||||
end
|
||||
inreplace buildpath/"Gruntfile.js", /^(\s+)platforms: .*/, "\\1platforms: [ '#{platform}' ],"
|
||||
|
||||
# do not build zip packages
|
||||
inreplace buildpath/"tasks/config/compress.js", /(build_zip: .*)/, "// \\1"
|
||||
|
||||
ENV.prepend_path "PATH", prefix/"libexec/node/bin"
|
||||
Pathname.new("#{ENV["HOME"]}/.npmrc").write Language::Node.npm_cache_config
|
||||
system "npm", "install", "grunt-cli", "bower"
|
||||
system "npm", "install"
|
||||
system "node_modules/.bin/bower", "install"
|
||||
system "node_modules/.bin/grunt", "build"
|
||||
|
||||
mkdir "tar" do
|
||||
system "tar", "--strip-components", "1", "-xf", Dir[buildpath/"target/kibana-*-#{platform}.tar.gz"].first
|
||||
|
||||
rm_f Dir["bin/*.bat"]
|
||||
prefix.install "bin", "config", "plugins", "src"
|
||||
end
|
||||
|
||||
inreplace "#{bin}/kibana", %r{/node/bin/node}, "/libexec/node/bin/node"
|
||||
|
||||
cd prefix do
|
||||
inreplace "config/kibana.yml", %r{/var\/run\/kibana.pid}, var/"run/kibana.pid"
|
||||
(etc/"kibana").install Dir["config/*"]
|
||||
rm_rf "config"
|
||||
|
||||
(var/"kibana/plugins").install Dir["plugins/*"]
|
||||
rm_rf "plugins"
|
||||
end
|
||||
end
|
||||
|
||||
def post_install
|
||||
ln_s etc/"kibana", prefix/"config"
|
||||
ln_s var/"kibana/plugins", prefix/"plugins"
|
||||
end
|
||||
|
||||
def caveats; <<-EOS.undent
|
||||
Plugins: #{var}/kibana/plugins/
|
||||
Config: #{etc}/kibana/
|
||||
EOS
|
||||
end
|
||||
|
||||
plist_options :manual => "kibana"
|
||||
|
||||
def plist; <<-EOS.undent
|
||||
<?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
|
Loading…
Reference in a new issue