diff --git a/Formula/kettle.rb b/Formula/kettle.rb new file mode 100644 index 0000000000..00bee7ac98 --- /dev/null +++ b/Formula/kettle.rb @@ -0,0 +1,104 @@ +class Kettle < Formula + homepage "http://community.pentaho.com/projects/data-integration/" + url "https://downloads.sourceforge.net/project/pentaho/Data%20Integration/5.0.1-stable/pdi-ce-5.0.1-stable.zip" + sha1 "c34fa3dbe8b75280fd3f7ddcaf609acbcdd2ed78" + + def install + rm_rf Dir["*.{bat}"] + libexec.install Dir["*"] + + (var + "log/kettle").mkpath + (etc + "kettle/simple-jndi").mkpath + + # We don't assume that kitchen and pan are in anyway unique command names so we'll prepend "pdi" + %w[kitchen pan].each do |command| + wrapper_file = libexec + command + wrapper_file.write command_wrapper_file_content(command) + chmod 0755, wrapper_file + bin.install_symlink wrapper_file => "pdi#{command}" + end + + carte_password_config_file = etc + "kettle/pwd/kettle.pwd" + carte_password_config_file.write carte_password_config_content unless carte_password_config_file.exist? + + carte_server_config_file = etc + "kettle/carte.xml" + carte_server_config_file.write carte_server_config_content unless carte_server_config_file.exist? + end + + def command_wrapper_file_content(command); <<-EOS.undent + #!/bin/bash + + cd /usr/local/opt/kettle/libexec/ + ./#{command}.sh "$@" + EOS + end + + def carte_password_config_content; <<-EOS.undent + cluster:cluster + EOS + end + + def carte_server_config_content; <<-EOS.undent + + + + + + localhost + localhost + 8080 + cluster + cluster + N + + + EOS + end + + def plist; <<-EOS.undent + + + + + Label + #{plist_name} + ProgramArguments + + #{opt_libexec}/carte.sh + #{etc}/kettle/carte.xml + + WorkingDirectory + #{etc}/kettle + EnvironmentVariables + + KETTLE_HOME + #{etc}/kettle + + StandardOutPath + #{var}/log/kettle/carte.log + StandardErrorPath + #{var}/log/kettle/carte.log + RunAtLoad + + + + EOS + end + + def caveats; <<-EOS.undent + The `kitchen` and `pan` scripts have been installed + under the names `pdikitchen` and `pdipan`. + EOS + end + + test do + %w[pdikitchen pdipan].each do |command| + assert_equal "6", shell_output("#{bin}/#{command} -version > /dev/null 2>&1; echo $?").strip + end + end +end