forked from jqueipo/datim-dedupe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulphelp.js
47 lines (40 loc) · 1.28 KB
/
gulphelp.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
/* global require, console */
module.exports = {
checkForDHIS2ConfigFile: checkForDHIS2ConfigFile,
runKarma: runKarma
};
function runKarma(watch) {
var karma = require('gulp-karma');
var config = {
configFile: 'test/karma.conf.js'
};
if (!watch) {
watch = false;
}
if (watch === true) {
config.action = 'watch';
}
return karma(config);
}
/**
* Checks if the dhis.json file is present in the root of the project. This will be required for
* tasks that interact with a running dhis2 instance (for example to circumvent the install process)
*/
function checkForDHIS2ConfigFile() {
var dhisConfig;
var path = require('path');
try {
dhisConfig = require(path.resolve('./dhis.json'));
} catch (e) {
console.log('DHIS 2 config file not found. Deploying dhis using gulp will not work.');
return {};
}
if (!dhisConfig.dhisDeployDirectory) {
console.log('');
console.log('Dhis 2 deploy directory not set, please add a dhis.json to your project that looks like');
console.log(JSON.stringify({ dhisDeployDirectory: '<YOUR DHIS2 DIRECTORY>' }, undefined, 2));
console.log('');
throw new Error('DHIS deploy location not found');
}
return dhisConfig;
}