@@ -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
4363gulp . task ( 'test' , function ( ) {
0 commit comments