last-run.js 483 B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. var retrieveLastRun = require('last-run');
  3. var metadata = require('./helpers/metadata');
  4. function lastRun(task, timeResolution) {
  5. if (timeResolution == null) {
  6. timeResolution = process.env.UNDERTAKER_TIME_RESOLUTION;
  7. }
  8. var fn = task;
  9. if (typeof task === 'string') {
  10. fn = this._getTask(task);
  11. }
  12. var meta = metadata.get(fn);
  13. if (meta) {
  14. fn = meta.orig || fn;
  15. }
  16. return retrieveLastRun(fn, timeResolution);
  17. }
  18. module.exports = lastRun;