Skip to content

Instantly share code, notes, and snippets.

@takumakei
Last active August 29, 2015 13:59
Show Gist options
  • Save takumakei/10807336 to your computer and use it in GitHub Desktop.
Save takumakei/10807336 to your computer and use it in GitHub Desktop.
Homebrew formula for the latest stable version 1.3.176 and beta version 1.4.177 of h2
require 'formula'
class H2 < Formula
homepage 'http://www.h2database.com/'
url 'http://www.h2database.com/h2-2014-04-05.zip'
version '1.3.176'
sha1 '9a87bf67741e1b9f9711db160e783898f4242bfe'
devel do
url 'http://www.h2database.com/h2-2014-04-12.zip'
version '1.4.177'
sha1 '6988446007b31849267d8382678a22ee207d6e48'
end
def script; <<-EOS.undent
#!/bin/sh
cd #{libexec} && bin/h2.sh "$@"
EOS
end
def install
# Remove windows files
rm_f Dir["bin/*.bat"]
# Fix the permissions on the script
chmod 0755, "bin/h2.sh"
libexec.install Dir['*']
(bin+'h2').write script
end
plist_options :manual => 'h2'
def plist; <<-EOS.undent
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//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>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/h2</string>
<string>-tcp</string>
<string>-web</string>
<string>-pg</string>
</array>
<key>WorkingDirectory</key>
<string>#{HOMEBREW_PREFIX}</string>
</dict>
</plist>
EOS
end
end
@takumakei
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment