gulpTasks-whatsNew.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Import Dependencies.
  2. var gulp = require("gulp");
  3. var fs = require("fs");
  4. /**
  5. * Tests the whats new file to ensure changes have been made in the PR.
  6. */
  7. gulp.task("tests-whatsnew", function(done) {
  8. // Only checks on Travis
  9. if (!process.env.TRAVIS) {
  10. done();
  11. return;
  12. }
  13. // Only checks on Pull Requests
  14. if (process.env.TRAVIS_PULL_REQUEST == "false") {
  15. done();
  16. return;
  17. }
  18. // Do not check deploy
  19. if (process.env.TRAVIS_BRANCH == "preview") {
  20. done();
  21. return;
  22. }
  23. // Compare what's new with the current one in the preview release folder.
  24. const https = require("https");
  25. const url = "https://rawgit.com/BabylonJS/Babylon.js/master/dist/preview%20release/what's%20new.md";
  26. https.get(url, res => {
  27. res.setEncoding("utf8");
  28. let oldData = "";
  29. res.on("data", data => {
  30. oldData += data;
  31. });
  32. res.on("end", () => {
  33. fs.readFile("../../dist/preview release/what's new.md", "utf-8", function(err, newData) {
  34. console.log(newData)
  35. if (err || oldData != newData) {
  36. done();
  37. return;
  38. }
  39. console.error("What's new file did not change.");
  40. process.exit(1);
  41. });
  42. });
  43. });
  44. });