Skip to content

Instantly share code, notes, and snippets.

@Nolski
Created April 13, 2015 20:18
Show Gist options
  • Save Nolski/2e952fd976f7d05587c1 to your computer and use it in GitHub Desktop.
Save Nolski/2e952fd976f7d05587c1 to your computer and use it in GitHub Desktop.
xmsg brew formula
# Documentation: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Formula-Cookbook.md
# /usr/local/Library/Contributions/example-formula.rb
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
class Xmsg < Formula
homepage "https://nolski.github.io/xmsg"
url "https://github.com/Nolski/xmsg/archive/0.0.1.tar.gz"
sha1 "8a652fdfe432b07230be0af39d1a45f09af6dc68"
version "0.1.0"
depends_on :python if MacOS.version <= :snow_leopard
def install
# Set PYTHONPATH env variable to this packages libexec site-packages dir
ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python2.7/site-packages"
# Invokes setup.py
system "python", *Language::Python.setup_install_args(libexec)
# This invokes some wizardry to symlink the things
bin.install Dir[libexec/"bin/*"]
bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"])
end
test do
# `test do` will create, run in and delete a temporary directory.
#
# This test will fail and we won't accept that! It's enough to just replace
# "false" with the main program this formula installs, but it'd be nice if you
# were more thorough. Run the test with `brew test xmsg`. Options passed
# to `brew install` such as `--HEAD` also need to be provided to `brew test`.
#
# The installed folder is not in the path, so use the entire path to any
# executables being tested: `system "#{bin}/program", "do", "something"`.
system "true"
end
# Does your plist need to be loaded at startup?
plist_options :startup => true
# Define this method to provide a plist.
# Looking for another example? Check out Apple's handy manpage =>
# https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man5/plist.5.html
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>xmsg</string>
<key>ProgramArguments</key>
<array>
<string>#{bin}/xmsg</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardErrorPath</key>
<string>/dev/null</string>
<key>StandardOutPath</key>
<string>/dev/null</string>
</plist>
EOS
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment