Skip to content

Commit a4f9fdd

Browse files
improving gulp and .travis.yml scripts
1 parent 6232ae4 commit a4f9fdd

File tree

3 files changed

+42
-17
lines changed

3 files changed

+42
-17
lines changed

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
language: node_js
22
node_js:
33
- "node"
4+
before_script:
5+
- gulp checkJavaFiles
6+
- gulp generate-vocabularies
7+
- gulp generate-libraries
8+
script: npm test

gulpfile.js

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,46 @@ var fetch = function (url, c) {
1818
});
1919
};
2020

21-
gulp.task('checkJavaFiles', function () {
22-
// In the current design, the version of dash.ttl in the Java repo (and TopBraid) is slightly different
23-
// because the Java version requires some hard-coded features from the tosh namespace, so this is left
24-
// out of the synch test for now
25-
var files = {
21+
gulp.task('checkJavaFiles', function (cb) {
22+
// In the current design, the version of dash.ttl in the Java repo (and TopBraid) is slightly different
23+
// because the Java version requires some hard-coded features from the tosh namespace, so this is left
24+
// out of the synch test for now
25+
var files = [
2626
//"./vocabularies/dash.ttl": "https://raw.githubusercontent.com/TopQuadrant/shacl/master/src/main/resources/etc/dash.ttl",
27-
"./vocabularies/shacl.ttl": "https://raw.githubusercontent.com/TopQuadrant/shacl/master/src/main/resources/etc/shacl.ttl",
28-
"./shared/dash.js": "https://raw.githubusercontent.com/TopQuadrant/shacl/master/src/main/resources/etc/dash.js",
29-
"./shared/rdfquery.js": "https://raw.githubusercontent.com/TopQuadrant/shacl/master/src/main/resources/etc/rdfquery.js"
27+
["./vocabularies/shacl.ttl", "https://raw.githubusercontent.com/TopQuadrant/shacl/master/src/main/resources/etc/shacl.ttl"],
28+
["./shared/dash.js", "https://raw.githubusercontent.com/TopQuadrant/shacl/master/src/main/resources/etc/dash.js"],
29+
["./shared/rdfquery.js", "https://raw.githubusercontent.com/TopQuadrant/shacl/master/src/main/resources/etc/rdfquery.js"]
30+
];
31+
32+
var uptodate = true;
33+
var checkFile = function (fileInfo, cb) {
34+
var p = fileInfo[0];
35+
var url = fileInfo[1];
36+
var read = fs.readFileSync(p).toString();
37+
fetch(url, function (data) {
38+
console.log(url);
39+
console.log(read === data);
40+
uptodate = uptodate && (read === data);
41+
cb();
42+
});
3043
};
3144

32-
for (var p in files) {
33-
(function (p, url) {
34-
var read = fs.readFileSync(p).toString();
35-
fetch(url, function (data) {
36-
console.log(url);
37-
console.log(read === data);
45+
var checkFiles = function (files) {
46+
if (files.length === 0) {
47+
if (uptodate) {
48+
cb();
49+
} else {
50+
cb(new Error("Some Java files are not in sync"));
51+
}
52+
} else {
53+
var file = files.shift();
54+
checkFile(file, function () {
55+
checkFiles(files);
3856
});
39-
})(p, files[p]);
40-
}
57+
}
58+
};
59+
60+
checkFiles(files);
4161
});
4262

4363
gulp.task('test', function () {

src/vocabularies.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)