forked from lotia/homebrew-versions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkibana41.rb
102 lines (84 loc) · 3.28 KB
/
kibana41.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
class Kibana41 < 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.4", :revision => "3df681b3f205b2b75e11ddf68c0985f80460d7bc"
head "https://github.com/elastic/kibana.git"
bottle do
sha256 "abdc7a48eb0123e9942ec7cac51194682f760799d5f03f27c3a28673fb6dda5c" => :el_capitan
sha256 "3a715512faf54f477792a656227dd02c952efab6a6d6f410349b5f9ccaad9f6d" => :yosemite
sha256 "a9d3a8e678f4ad263d79eed44702f380d3adf5c52bdaaf29946eae03fbe2b28f" => :mavericks
end
conflicts_with "kibana", :because => "Different versions of same formula"
resource "node" do
url "https://nodejs.org/dist/v0.10.35/node-v0.10.35.tar.gz"
sha256 "0043656bb1724cb09dbdc960a2fd6ee37d3badb2f9c75562b2d11235daa40a03"
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 OS.mac? && Hardware::CPU.is_64_bit?
platform = "darwin-x64"
elsif OS.linux?
platform = Hardware::CPU.is_64_bit? ? "linux-x64" : "linux-x86"
else
raise "Installing Kibana via Homebrew is only supported on Darwin x86_64, Linux i386, Linux i686, and Linux 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"
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
plist_options :manual => "kibana"
def caveats; <<-EOS.undent
Plugins: #{var}/kibana/plugins/
Config: #{etc}/kibana/
EOS
end
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