Skip to content

Instantly share code, notes, and snippets.

@passcod
Forked from anonymous/hookz.rb
Created August 15, 2013 04:10
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save passcod/6238200 to your computer and use it in GitHub Desktop.
Save passcod/6238200 to your computer and use it in GitHub Desktop.
Hookz: Lolcommits plugin to execute custom hooks. Place an executable (shell script, binary, something else with a shebang...) in ~/.lolcommits/project-name/Hookfile, and it will be called every time a commit picture is taken, with its path as argument. Use for anything you can't be bothered writing Ruby for: posting to tumblr, sending email, up…
module Lolcommits
class Hookz < Plugin
def initialize(runner)
super
self.name = 'hookz'
self.default = true
end
def run
hookfile = File.join self.runner.config.loldir, "Hookfile"
if File.exists? hookfile
unless File.executable? hookfile
puts "==> #{hookfile} is not executable"
return
end
puts "==> Running #{hookfile}"
puts `#{hookfile} #{self.runner.main_image}`
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment