code: function isAppDir_p(dirPath) {
        var deferred = Q.defer();
        fs.exists(dirPath, function(exists) {
          if (!exists)
            deferred.resolve({
              exists: false, 
              isApp: false, 
              isRmd: false, 
              index: false
            });
          else {
            deferred.resolve(
              Q.nfcall(fs.readdir, dirPath)
              .then(
                function(entries) {
                  var app = _.find(entries, function(entry) {
                    return /^server\.r$/i.test(entry);
                  });
                  var singleApp = _.find(entries, function(entry) {
                    return /^app\.r$/i.test(entry);
                  });
                  var rmd = _.find(entries, function(entry) {
                    return /\.rmd$/i.test(entry);
                  });
                  var indexRmd = _.find(entries, function(entry) {
                    if (/^index\.rmd$/i.test(entry)){
                      return entry;
                    }
                    return false;
                  });
                  var indexHtm = _.find(entries, function(entry) {
                    if (/index\.htm(l)?$/i.test(entry)){
                      return entry;
                    }
                    return false;
                  });
  
                  // Give priority to an Rmd index, the fall back to an html index
                  return {
                    exists: true, 
                    isApp: (!!app || !!singleApp), 
                    isRmd: !!rmd, 
                    indexType: indexRmd ? 'rmd' : indexHtm ? 'html' : null,
                    indexPath: indexRmd || indexHtm
                  };
                },
                function(err) {
                  if (err.code == 'ENOTDIR') {
                    return {
                      exists: false, 
                      isApp: false, 
                      isRmd: false, 
                      indexType: null
                    };
                  }
                  else {
                    logger.error('Error reading dir: ' + err.message);
                    return {
                      exists: true, 
                      isApp: false, 
                      isRmd: false, 
                      indexType: null
                    };
                  }
                }
              )
            );
          }
        });
  
        return deferred.promise;
      }
docs: Returns { exists: true|false, isApp: true|false, isRmd: true|false }