Skip to content

Instantly share code, notes, and snippets.

@Maffsie
Last active August 29, 2015 14:17
Show Gist options
  • Save Maffsie/b47eed3f38156298455a to your computer and use it in GitHub Desktop.
Save Maffsie/b47eed3f38156298455a to your computer and use it in GitHub Desktop.
class Ayudantelobo < Formula
homepage "https://github.com/MaffC/ayudante-lobo"
url "https://github.com/MaffC/ayudante-lobo/archive/v0.9.4.tar.gz"
sha256 "06fc0b51789862a50bec02791aba1d007dcbb87c78a3d2fe9295fcf910c3db70"
head "https://github.com/MaffC/ayudante-lobo.git"
depends_on "cpanminus"
depends_on "libssh2"
# depends_on "Net::SSH2" => :perl
# depends_on "POE" => :perl
# depends_on "POE::Component::DirWatch::WithCaller" => :perl
# depends_on "Try::Tiny" => :perl
# depends_on "Unix::PID" => :perl
# depends_on "YAML" => :perl
def install
bin.mkpath
share.mkpath
lib.mkpath
mkdir_p lib/"Maff/Common"
bin.install "ayudante-lobo"
share.install "sample.ayudante-loborc"
mv "lib/Maff-Common-OSX.pm",lib/"Maff/Common/OSX.pm"
prefix.install_metafiles
system "cpanm",
"-q", "--exclude-vendor", "-l", "#{prefix}",
"Net::SSH2", "POE::Component::DirWatch::WithCaller",
"Try::Tiny", "Unix::PID", "YAML"
end
test do
system "perl -c #{bin}/ayudante-lobo"
end
def caveats
"You'll need to copy #{share}/sample.ayudante-loborc to ~/.ayudante-loborc and then edit it to your needs before loading the launchd agent. The agent is designed such that if ayudante-lobo encounters an error, it will be silently restarted and the error will be logged to wherever you've configured it to log errors to."
end
def plist; <<-EOS.undent
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//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>KeepAlive</key>
<true/>
<key>RunAtLoad</key>
<true/>
<key>EnvironmentVariables</key>
<dict>
<key>PERL5LIB</key>
<string>#{lib}:#{lib}/perl5/darwin-thread-multi-2level</string>
</dict>
<key>Program</key>
<string>#{bin}/ayudante-lobo</string>
</dict>
</plist>
EOS
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment