Created
October 28, 2010 03:15
-
-
Save olsonjeffery/650546 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exec = require('child_process').exec | |
spawn = require('child_process').spawn | |
sha1Hash = (path, cb) -> | |
curr = process.cwd() | |
process.chdir path | |
bleh = '' | |
exec 'git log -1', (er, o, e) -> | |
process.chdir curr | |
sha1 = o.split('\n')[0].replace('commit ', '')[0..7] | |
cb sha1 | |
pullOnRepo = (path, cb) -> | |
curr = process.cwd() | |
process.chdir path | |
exec 'git pull', (er, o, e) -> | |
process.chdir curr | |
sha1Hash path, (sha1) -> | |
cb sha1 | |
postGist = (code, gistBin, cb) -> | |
stdout = '' | |
output = (d) -> stdout += if !!d then d else '' | |
child = spawn gistBin | |
child.stdout.addListener 'data', output | |
child.addListener 'exit', (exitCode) -> | |
cb stdout | |
child.stdin.write code | |
child.stdin.end() | |
module.exports = {sha1Hash:sha1Hash, pullOnRepo:pullOnRepo, postGist:postGist} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jeff@smoke:~/src/coffeebot$ coffee -c gitinterface.coffee | |
Error: In gitinterface.coffee, Parse error on line 10: Unexpected 'NUMBER' | |
at Object.parseError (/home/jeff/lib/coffee-script/lib/parser.js:493:11) | |
at Object.parse (/home/jeff/lib/coffee-script/lib/parser.js:564:71) | |
at Object.compile (/home/jeff/lib/coffee-script/lib/coffee-script.js:23:22) | |
at /home/jeff/lib/coffee-script/lib/command.js:111:33 | |
at /home/jeff/lib/coffee-script/lib/command.js:75:24 | |
at fs:84:13 | |
at node.js:772:9 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment