Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jonah Fox
authored and
Jonah Fox
committed
Oct 7, 2010
1 parent
698502e
commit 831151b
Showing
6 changed files
with
167 additions
and
52 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
cp bin/bounce /usr/local/bin | ||
echo "Bounce installed" | ||
echo "now use 'bounce' instead of 'node' to reload" | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// Growl - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed) | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
var child_process = require('child_process'), | ||
path = require('path') | ||
|
||
/** | ||
* Node-growl version. | ||
*/ | ||
|
||
exports.version = '1.0.2' | ||
|
||
/** | ||
* Fetch the binary version when available. | ||
* | ||
* @param {function} callback | ||
* @api public | ||
*/ | ||
|
||
exports.binVersion = function(callback) { | ||
child_process.exec('growlnotify -v', function(err, stdout, stderr){ | ||
if (err) callback(err) | ||
else callback(null, stdout) | ||
}) | ||
} | ||
|
||
/** | ||
* Send growl notification _msg_ with _options_. | ||
* | ||
* Options: | ||
* | ||
* - title Notification title | ||
* - sticky Make the notification stick (defaults to false) | ||
* - name Application name (defaults to growlnotify) | ||
* - image | ||
* - path to an icon sets --iconpath | ||
* - path to an image sets --image | ||
* - capitalized word sets --appIcon | ||
* - filename uses extname as --icon | ||
* - otherwise treated as --icon | ||
* | ||
* Examples: | ||
* | ||
* growl.notify('New email') | ||
* growl.notify('5 new emails', { title: 'Thunderbird' }) | ||
* growl.notify('Email sent', function(){ | ||
* // ... notification sent | ||
* }) | ||
* | ||
* @param {string} msg | ||
* @param {object} options | ||
* @param {function} callback | ||
* @api public | ||
*/ | ||
|
||
exports.notify = function(msg, options, callback) { | ||
var image, | ||
args = ['growlnotify', '-m', '"' + msg + '"'], | ||
options = options || {} | ||
exports.binVersion(function(err, version){ | ||
if (err) return callback(err) | ||
if (image = options.image) { | ||
var flag, ext = path.extname(image).substr(1) | ||
flag = flag || ext == 'icns' && 'iconpath' | ||
flag = flag || /^[A-Z]/.test(image) && 'appIcon' | ||
flag = flag || /^png|gif|jpe?g$/.test(ext) && 'image' | ||
flag = flag || ext && (image = ext) && 'icon' | ||
flag = flag || 'icon' | ||
args.push('--' + flag, image) | ||
} | ||
if (options.sticky) args.push('--sticky') | ||
if (options.name) args.push('--name', options.name) | ||
if (options.title) args.push(options.title) | ||
child_process.exec(args.join(' '), callback) | ||
}) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
throw "error" | ||
throw "error" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,9 @@ function go() { | |
} else { | ||
process.exit(0) | ||
} | ||
|
||
if(i == 10) | ||
throw "error!" | ||
} | ||
|
||
|
||
|