This repository has been archived by the owner on Jun 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathgulpfile.js
50 lines (44 loc) · 1.56 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
var gulp = require("gulp");
var Stex = require("stex");
var StexDev = require("stex/dev");
var gulp = StexDev.gulp();
var plugins = StexDev.gulpPlugins();
var paths = StexDev.paths;
var fs = require("fs");
paths.root = __dirname; //HACK: can't think of a better way to expose the app root prior to stex init
gulp.task('default', ['test']);
gulp.task('dist', []);
gulp.task('test', ['lint', 'mocha-copy']);
gulp.task('db:setup', ['db:migrate-copy']);
// After spending too much time trying to fix bad paths in stex, I decided to
// copy gulp tasks with correct files here.
// Correct fix is hard because we need to make sure stex is working here but
// also for stellar-api. The problem is npm somehow creates a different tree in
// /node_modules/stex/node_modules for stellar-wallet and stellar-api.
gulp.task('db:migrate-copy', ['db:ensure-created'], function(done) {
var kexec = require("kexec");
if (!fs.existsSync("./migrations")) {
console.info("No migrations in /migrations");
process.exit(0);
return;
}
var program = __dirname + '/node_modules/.bin/db-migrate';
var args = [
"--config",
__dirname + "/node_modules/stex/lib/db-migrate/config.js",
"--env",
"test",
"up"
]
kexec(program, args);
done();
});
gulp.task('mocha-copy', function() {
return gulp.src('test/*.js', {"cwd": './'})
.pipe(require('gulp-spawn-mocha')({
'reporter' : 'list',
'env' : {'NODE_ENV': 'test'},
'istanbul' : true
}));
});
// you can find individual gulp tasks in ./node_modules/stex-dev/lib/gulp.js