homebrew-core/Formula/hadoop.rb
Jake Good d350ae403e hadoop: fix inreplace
Closes Homebrew/homebrew#10532.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-02-27 14:30:18 -06:00

37 lines
941 B
Ruby

require 'formula'
class Hadoop < Formula
homepage 'http://hadoop.apache.org/common/'
url 'http://www.apache.org/dyn/closer.cgi?path=hadoop/core/hadoop-1.0.0/hadoop-1.0.0.tar.gz'
md5 'fa150612de0efe80be88144c28225780'
def shim_script target
<<-EOS.undent
#!/bin/bash
exec "#{libexec}/bin/#{target}" "$@"
EOS
end
def install
rm_f Dir["bin/*.bat"]
libexec.install %w[bin conf lib webapps]
libexec.install Dir['*.jar']
bin.mkpath
Dir["#{libexec}/bin/*"].each do |b|
n = Pathname.new(b).basename
(bin+n).write shim_script(n)
end
inreplace "#{libexec}/conf/hadoop-env.sh",
"# export JAVA_HOME=/usr/lib/j2sdk1.5-sun",
"export JAVA_HOME=\"$(/usr/libexec/java_home)\""
end
def caveats; <<-EOS.undent
In Hadoop's config file:
#{libexec}/conf/hadoop-env.sh
$JAVA_HOME has been set to be the output of:
/usr/libexec/java_home
EOS
end
end