Skip to content

Instantly share code, notes, and snippets.

@525c1e21-bd67-4735-ac99-b4b0e5262290
Created October 7, 2011 07:29
Show Gist options
  • Save 525c1e21-bd67-4735-ac99-b4b0e5262290/1269687 to your computer and use it in GitHub Desktop.
Save 525c1e21-bd67-4735-ac99-b4b0e5262290/1269687 to your computer and use it in GitHub Desktop.
meow -- growls for git
{exec} = require 'child_process'
growl = require 'growl'
git = require 'nodegit'
path = '/Users/pyrotechnick/.meow/repos/webclient'
db = {}
notify = (commit) ->
growl.notify commit.message, image: "/Users/pyrotechnick/.meow/avatars/#{commit.author.email}.png"
git.repo path, (error, repo) ->
repo.branch 'master', (error, branch) ->
tick = ->
exec 'git fetch -v', cwd: path, ->
history = branch.history()
history.on 'commit', (commit) ->
today = new Date
today.setHours 0
today.setMinutes 0
today.setSeconds 0
today.setMilliseconds 0
notify commit if commit.time >= today and not db[commit.sha]?
db[commit.sha] = {}
tick()
setInterval ->
tick()
, 1000 * 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment