Comparing version 0.1.3 to 0.2.0
38
index.js
@@ -14,3 +14,2 @@ 'use strict'; | ||
cp = require('cp'), | ||
debounce = require('debounce'), | ||
mkdirp = require('mkdirp'); | ||
@@ -21,2 +20,5 @@ | ||
function now() { | ||
return new Date().getTime(); | ||
} | ||
@@ -32,3 +34,7 @@ function AwesomeMaven(mvnPath, options) { | ||
var starting = 0; | ||
function runMaven(cleanStart) { | ||
starting = starting || now(); | ||
if (!cleanStart) { | ||
@@ -50,2 +56,4 @@ log('[AMVN] restarting mvn...'.yellow); | ||
} | ||
starting = 0; | ||
} | ||
@@ -55,2 +63,9 @@ | ||
// already starting | ||
if (starting) { | ||
return; | ||
} | ||
starting = now(); | ||
if (mvn) { | ||
@@ -66,9 +81,20 @@ log('[AMVN] sending KILL to mvn...'.yellow); | ||
delayedRestartMaven(); | ||
var timer = setInterval(function() { | ||
try { | ||
process.kill(mvn.pid, 0); | ||
} catch (e) { | ||
// does not exist | ||
log('[AMVN] mvn gone'.yellow); | ||
// clear timer | ||
clearInterval(timer); | ||
// restart | ||
runMaven(); | ||
} | ||
}, 500); | ||
} | ||
var delayedReloadMaven = debounce(reloadMaven, 2000); | ||
var delayedRestartMaven = debounce(runMaven, 4000); | ||
function registerWatch() { | ||
@@ -103,3 +129,3 @@ | ||
watcher.on('change', delayedReloadMaven); | ||
watcher.on('change', reloadMaven); | ||
} | ||
@@ -106,0 +132,0 @@ |
@@ -13,3 +13,3 @@ { | ||
], | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"scripts": { | ||
@@ -16,0 +16,0 @@ "test": "echo \"Error: no test specified\" && exit 1" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6455
142