require 'formula' class ScmManager < Formula homepage 'http://www.scm-manager.org' url 'http://maven.scm-manager.org/nexus/content/repositories/releases/sonia/scm/scm-server/1.36/scm-server-1.36-app.tar.gz' version '1.36' sha1 '610a45faa8d8f1d38811d614bb1492388b47eecf' skip_clean 'libexec/var/log' resource 'client' do url 'http://maven.scm-manager.org/nexus/content/repositories/releases/sonia/scm/clients/scm-cli-client/1.36/scm-cli-client-1.36-jar-with-dependencies.jar' sha1 '5af0797d81307551d5f3de157a2c6a6f5d80e671' end def install rm_rf Dir['bin/*.bat'] libexec.install Dir['*'] (bin/'scm-server').write <<-EOS.undent #!/bin/bash BASEDIR="#{libexec}" REPO="#{libexec}/lib" export JAVA_HOME=$(/usr/libexec/java_home -v 1.6) "#{libexec}/bin/scm-server" "$@" EOS chmod 0755, bin/'scm-server' tools = libexec/'tools' tools.install resource('client') scmCliClient = bin+'scm-cli-client' scmCliClient.write <<-EOS.undent #!/bin/bash java -jar "#{tools}/scm-cli-client-#{version}-jar-with-dependencies.jar" "$@" EOS chmod 0755, scmCliClient end plist_options :manual => 'scm-server start' def plist; <<-EOS.undent Label #{plist_name} ProgramArguments #{opt_bin}/scm-server start RunAtLoad EOS end end