forked from cretz/dust-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jakefile
45 lines (42 loc) · 1.42 KB
/
Jakefile
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
var fs = require('fs-extra');
function copyAll(pairs, onComplete) {
var index = -1;
function next() {
if (++index >= pairs.length) onComplete();
else {
console.log('Copying ' + pairs[index].src + ' to ' + pairs[index].dest);
fs.copy(pairs[index].src, pairs[index].dest, function (err) {
if (err) throw err;
else next();
});
}
}
next();
}
desc('Build');
task('build', {async: true}, function () {
//recreate src and test folders
console.log('Recreating src and tests folders');
if (fs.existsSync('src')) fs.removeSync('src');
if (fs.existsSync('tests')) fs.removeSync('tests');
fs.mkdirSync('src');
fs.mkdirSync('tests');
//compile
console.log('Compiling with Pratphall');
var cmds = [
//regular src
'node ./node_modules/pratphall/bin/ppc.js --no-php-lib -o ./src ./pratphall/src/common.ts',
//test src
'node ./node_modules/pratphall/bin/ppc.js --no-php-lib --exclude-outside --ext pratphall/tests/spec-ext.ts -o ./tests ./pratphall/tests/common.ts'
];
jake.exec(cmds, complete, {printStdout: true, printStderr: true});
});
desc('Run Tests');
task('test', ['build'], {async: true}, function () {
console.log('Running tests');
var cmds = [
'vendor/bin/phpunit tests'
];
jake.exec(cmds, complete, {printStdout: true, printStderr: true});
});