forked from raws/homebrew-tap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsplunk-forwarder.rb
47 lines (39 loc) · 1.06 KB
/
splunk-forwarder.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
require 'formula'
require 'shellwords'
class SplunkForwarder < Formula
homepage 'http://www.splunk.com'
url 'https://www.splunk.com/bin/splunk/DownloadActivityServlet?architecture=x86&platform=Macos&version=6.2.2&product=splunk_light&filename=splunklight-6.2.2-255606-macosx-10.7-intel.dmg&wget=true'
# sha1 '7a6074edf8f67f442b9a2e853ba2912a1283731a'
keg_only 'Splunk forwarder includes an invasive number of binaries and support files.'
def caveats
<<-EOS.undent
This formula installs a wrapper executable at #{wrapper}. The
wrapper sets SPLUNK_HOME to #{prefix} and
launches #{real}.
EOS
end
def install
prefix.install Dir['*']
install_wrapper
end
def test
system 'splunk'
end
private
def install_wrapper
wrapper.open 'w' do |f|
f.puts <<-EOS.undent
#!/bin/bash
SPLUNK_HOME=#{prefix.to_s.shellescape}
#{real.to_s.shellescape} "$@"
EOS
end
wrapper.chmod 0755
end
def real
bin.join 'splunk'
end
def wrapper
HOMEBREW_PREFIX.join 'bin', 'splunk'
end
end