docs: function(apps) {
  
    var filepath = getGlobalConfig().appRegistry;
  
    var tempFilepath = filepath + '.tmp';
  
    // Write to temp file.
    return Promise.fromNode(function(cb) {
      fs.writeFile(tempFilepath, JSON.stringify(apps), cb);
      log.debug(format('Setting app registry with %j', apps));
    })
    // Rename temp file to normal file.
    .then(function() {
      return Promise.fromNode(function(cb) {
        fs.rename(tempFilepath, filepath, cb);
      });
    });
  
  }