tasks/rendr_stitch.js
function assertFiles(expectedNumFiles, tmpDir, callback) {
    function countFiles() {
      var numFiles = 0;
      grunt.file.recurse(tmpDir, function(abspath, rootdir, subdir, filename) {
        numFiles++;
      });
      return numFiles === expectedNumFiles;
    }

    var interval = setInterval(function() {
      if (countFiles()) {
        clearInterval(interval);
        callback();
      }
    }, 100);
  }
function assertFiles(expectedNumFiles, tmpDir, callback) {
    function countFiles() {
      var numFiles = 0;
      grunt.file.recurse(tmpDir, function(abspath, rootdir, subdir, filename) {
        numFiles++;
      });
      return numFiles === expectedNumFiles;
    }

    var interval = setInterval(function() {
      if (countFiles()) {
        clearInterval(interval);
        callback();
      }
    }, 100);
  }
function assertFiles ( expectedNumFiles , tmpDir , callback ) { function countFiles ( ) { var numFiles = 0 ; grunt . file . recurse ( tmpDir , function ( abspath , rootdir , subdir , filename ) { numFiles ++ ; } ) ; return numFiles === expectedNumFiles ; } var interval = setInterval ( function ( ) { if ( countFiles ( ) ) { clearInterval ( interval ) ; callback ( ) ; } } , 100 ) ; }
Sometimes, the Stitch compliation appears to happen before all files are copied over to
the `tmpDir`.  We simply wait until they are.
Sometimes the Stitch compliation appears to happen before all files are copied over to the tmpDir . We simply wait until they are .