git-revision.js 504 B

12345678910111213141516171819202122
  1. var simple = require('simple-git');
  2. var services = require('./sharelatex/config/services');
  3. const fs = require('fs');
  4. function print_latest(repoDir) {
  5. git = simple(repoDir);
  6. opt = [];
  7. opt['max-count'] = 1;
  8. git.log(opt, function(err, log) {
  9. if (!err) {
  10. console.log(repoDir + ',' + log.latest.hash);
  11. }
  12. })
  13. }
  14. for (id in services) {
  15. service = services[id];
  16. dirPath = __dirname + '/sharelatex/'+service.name;
  17. if (fs.existsSync(dirPath)) {
  18. print_latest(dirPath);
  19. }
  20. }