Skip to content

Instantly share code, notes, and snippets.

@ivanoats
Forked from jonpacker/vanilla.js
Created September 24, 2013 22:29
Show Gist options
  • Save ivanoats/6692227 to your computer and use it in GitHub Desktop.
Save ivanoats/6692227 to your computer and use it in GitHub Desktop.
var refreshDb = function(done) {
spawn(neo4j, ['stop']).on('exit', function() {
spawn('rm', ['-rf', datapath]).on('exit', function() {
spawn('mkdir', ['-p', datapath]).on('exit', function() {
updateConf(TEST_INSTANCE_PORT, function() {
var n = spawn(neo4j, ['start'])
n.stdout.on('data', function(d) {
process.stdout.write(d.toString());
})
n.on('exit', function() {
done();
});
});
});
});
});
}
var refreshDb = function(done) {
async.series([
function stopNeo(next) {
spawn(neo4j, ['stop']).on('exit', function() { next(); })
},
function removeDataDir(next) {
spawn('rm', ['-rf', datapath]).on('exit', function() { next(); });
},
function recreateDatDir(next) {
spawn('mkdir', ['-p', datapath]).on('exit', function() { next(); });
},
function updateConfiguration(next) {
updateConf(TEST_INSTANCE_PORT, next);
},
function startNeo(next) {
var n = spawn(neo4j, ['start'])
n.stdout.on('data', function(d) {
process.stdout.write(d.toString());
})
n.on('exit', function() { next(); });
}
], done);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment