Skip to content

Instantly share code, notes, and snippets.

@divanvisagie
Created December 3, 2013 06:01
Show Gist options
  • Select an option

  • Save divanvisagie/7764578 to your computer and use it in GitHub Desktop.

Select an option

Save divanvisagie/7764578 to your computer and use it in GitHub Desktop.
Node build scripts for brackets, to be placed in home directory. Requires brackets builder , theseus for brackets and node-theseus
[
{
"name": "Python",
"cmd": "python $FILE"
},
{
"name": "JavaScript",
"cmd": "sh nodebuild.sh $FILE"
},
{
"name": "Ruby",
"cmd": "ruby $FILE"
}
]
var fs = require('fs'),
spawn = require('child_process').spawn,
util = require('util');
function killProc( pid ) {
var proc = spawn('kill',[pid]);
proc.stdout.pipe( process.stdout );
proc.stderr.pipe( process.stderr );
proc.on('close',function(code){
console.log('exited with code %d',code);
})
}
process.stdin.on('data',function(data){
var lst = data.toString().split('\n');
lst = lst.map(function(itm){
return itm.split('??')[0].trim();
});
lst = lst.filter(function(data){
if(data !== '') return data;
});
for (var i=0; i <lst.length; i++){
killProc( lst[i] );
}
console.log(lst);
});
#!/bin/bash
export PATH=$PATH:/usr/local/bin
args=("$@")
ps -e | grep node | grep ${args[0]} | grep theseus | node nodebuild.js
node-theseus ${args[0]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment