Skip to content
Browse files

Added specifying main for node to be able to require swake; set versi…

…on to 0.1.1; added callback chain to swake
  • Loading branch information...
1 parent 1b9a346 commit 97475af7b14125b30724325c300d2761c5d38209 @tristanls committed
Showing with 12 additions and 3 deletions.
  1. +10 −2 lib/swake.js
  2. +2 −1 package.json
View
12 lib/swake.js
@@ -23,7 +23,7 @@ exports.executeSwakeFile = function( swakeTaskFile, args, options ) {
};
-exports.swake = function( task, args, options ) {
+exports.swake = function( task, args, options, callback ) {
// set swake path from environment or options
var swakePath = process.env.SWAKE_PATH;
@@ -58,5 +58,13 @@ exports.swake = function( task, args, options ) {
args.unshift( swakeTask );
args.unshift( '-e' );
logly.debug( 'launching new swake process with ' + args );
- spawn( 'swake', args );
+ if ( ! callback ) {
+ spawn( 'swake', args );
+ } else {
+ var swakeProcess = spawn( 'swake', args );
+
+ swakeProcess.on( 'exit', function( code ) {
+ callback( code );
+ });
+ }
};
View
3 package.json
@@ -1,9 +1,10 @@
{ "name" : "swake"
, "description" : "Task execution tool used by swarm"
-, "version" : "0.1.0"
+, "version" : "0.1.1"
, "homepage" : "https://github.com/tristanls/swake"
, "author" : "Tristan Slominski <tristan.slominski@gmail.com> (http://github.com/tristanls)"
, "bin" : "./bin/swake"
+, "main": "./lib/swake.js"
, "repository" :
{ "type" : "git"
, "url" : "http://github.com/tristanls/swake.git" }

0 comments on commit 97475af

Please sign in to comment.
Something went wrong with that request. Please try again.