summaryrefslogtreecommitdiff
path: root/gulpfile.js
diff options
context:
space:
mode:
Diffstat (limited to 'gulpfile.js')
-rw-r--r--gulpfile.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/gulpfile.js b/gulpfile.js
index f4160c3..a1bfd3d 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -1,6 +1,8 @@
'use strict';
+var fs = require('fs');
var gulp = require('gulp');
var server = require('gulp-express');
+var spawn = require('child_process').spawn;
var pkg = require('./package.json');
gulp.task('server', function() {
@@ -12,5 +14,26 @@ gulp.task('server', function() {
gulp.watch([pkg.main], [server.run]);
});
+/** Creates a directory tree if it does not yet exist. */
+function makedirs(path) {
+ var dirPath = '.';
+ path.split('/').forEach(function(dir) {
+ dirPath += '/' + dir;
+ if (!fs.existsSync(dirPath)) {
+ fs.mkdirSync(dirPath);
+ }
+ });
+}
+
+gulp.task('mongod', function() {
+ makedirs('db/data');
+ // listen on localhost instead of wildcard for security reasons.
+ spawn('mongod', [
+ '--dbpath', 'db/data',
+ '--nounixsocket',
+ '--bind_ip', '127.0.0.1',
+ ]);
+});
+
// Lazy me, make "gulp" the same as "gulp server" for now.
gulp.task('default', ['server']);