Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. diff --git a/lib/buildlist.js b/lib/buildlist.js
  2. index 2aaf39c..7758a5c 100644
  3. --- a/lib/buildlist.js
  4. +++ b/lib/buildlist.js
  5. @@ -1,5 +1,6 @@
  6. "use strict";
  7. var fs = require('fs');
  8. +var path = require('path');
  9.  
  10. function Buildlist(options) {
  11. function requiredOption(name) {
  12. @@ -40,4 +41,19 @@ Buildlist.prototype.reload = function() {
  13. return delta;
  14. };
  15.  
  16. +Buildlist.prototype.filterNonExisting = function() {
  17. + var deleting = [];
  18. + this.list.forEach(function (ident, i) {
  19. + var mypath = path.join(this.baseUrl, ident + '.js');
  20. + if (!fs.existsSync(mypath)) {
  21. + deleting.push(i);
  22. + }
  23. + });
  24. + deleting.reverse();
  25. + deleting.forEach(function (i) {
  26. + this.list.splice(i, 1);
  27. + });
  28. + return this.list;
  29. +};
  30. +
  31. module.exports = Buildlist;
  32. diff --git a/watcher.js b/watcher.js
  33. index bac35dd..c0bacf3 100644
  34. --- a/watcher.js
  35. +++ b/watcher.js
  36. @@ -212,6 +212,9 @@ var buildlist = new Buildlist({
  37. baseUrl: baseUrl
  38. });
  39.  
  40. +console.log(buildlist.filterNonExisting().length);
  41. +process.exit(0);
  42. +
  43. var buildQueue = new BuildQueue({
  44. log: log,
  45. fs: fileSystem,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement