- Sublime Text 2 - text editor and syntax highlighting
- jslint - Lint tool for Javascript code. It's basically a syntax checker, together with a bit of static analysis
- npm - this is the node package manager. Think maven. It can also run your tests
- guard - this is a ruby gem I use to watch for file changes. It can execute arbitrary commands whenever a file changes
- libnotify/notify-send - libnotify is used to make popups on the desktop
This file contains 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
var exec = require("child_process").exec, | |
spawn = require("child_process").spawn, | |
command = "mocha -R json tests/*-test.js", | |
_ = require("underscore"); | |
var child = exec(command, function (error, stdout, stderr) { | |
var output, STATUS, ICON, status; | |
if (stderr) { | |
STATUS="BROKEN"; | |
ICON="/usr/share/icons/gnome/32x32/actions/gtk-close.png"; | |
output = "Command run failure: " + error + "\n" + stderr; | |
} else { | |
try { | |
var results = JSON.parse(stdout); | |
output = "<b>Failures: " + results.stats.failures + "</b>\n"; | |
output += "Successes: " + results.stats.passes + "\n"; | |
if (results.stats.failures > 0) { | |
STATUS="FAILURE"; | |
ICON="/usr/share/icons/gnome/32x32/actions/gtk-close.png"; | |
output += "\n\n<b>Failure details</b>\n-----------\n"; | |
output += _(results.failures).map(function (f) { return f.fullTitle + "\n"; }); | |
} else { | |
STATUS="Success"; | |
ICON="/usr/share/icons/gnome/32x32/actions/add.png"; | |
} | |
} catch (e) { | |
output = stdout; | |
STATUS="BROKEN"; | |
ICON="/usr/share/icons/gnome/32x32/actions/gtk-close.png"; | |
} | |
} | |
spawn("notify-send", [STATUS, output, "-i", ICON, "-t", "10000"]); | |
}); |
This file contains 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
guard 'shell' do | |
watch(%r"tests/.*test\..*") {|m| | |
`node bgtests.js` | |
} | |
watch(%r"js/.*js") {|m| | |
`node bgtests.js` | |
} | |
end |
notify-send "Test" teston your PC to see what it does. Anyway, first post! Here's an example of the popup: