diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-11-05 15:45:30 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-11-05 15:45:30 -0400 |
commit | e75c457449e49e5f18f07fffec963c9aa626662d (patch) | |
tree | 1f913d9b98c9db2c7bff20c7452cb442335e1b22 /src | |
parent | 0175df41994ed44d2dded79ac21badf463140e14 (diff) |
upd8: move "not applicable" checks to top of upd8 evaluation
Diffstat (limited to 'src')
-rwxr-xr-x | src/upd8.js | 82 |
1 files changed, 47 insertions, 35 deletions
diff --git a/src/upd8.js b/src/upd8.js index 23182778..84e6ea84 100755 --- a/src/upd8.js +++ b/src/upd8.js @@ -488,6 +488,53 @@ async function main() { }); } + // Prepare not-applicable steps before anything else. + + if (skipThumbs) { + Object.assign(stepStatusSummary.generateThumbnails, { + status: STATUS_NOT_APPLICABLE, + annotation: `provided --skip-thumbs`, + }); + } else { + Object.assign(stepStatusSummary.loadThumbnailCache, { + status: STATUS_NOT_APPLICABLE, + annotation: `using cache from thumbnail generation`, + }); + } + + if (!migrateThumbs) { + Object.assign(stepStatusSummary.migrateThumbnails, { + status: STATUS_NOT_APPLICABLE, + annotation: `--migrate-thumbs not provided`, + }); + } + + if (!precacheData) { + Object.assign(stepStatusSummary.precacheData, { + status: STATUS_NOT_APPLICABLE, + annotation: `--precache-data not provided`, + }); + } + + if (!langPath) { + Object.assign(stepStatusSummary.loadLanguageFiles, { + status: STATUS_NOT_APPLICABLE, + annotation: `neither --lang-path nor HSMUSIC_LANG provided`, + }); + } + + if (noBuild) { + Object.assign(stepStatusSummary.performBuild, { + status: STATUS_NOT_APPLICABLE, + annotation: `--no-build provided`, + }); + } + + if (skipThumbs && thumbsOnly) { + logInfo`Well, you've put yourself rather between a roc and a hard place, hmmmm?`; + return false; + } + stepStatusSummary.determineMediaCachePath.status = STATUS_STARTED_NOT_DONE; const {mediaCachePath, annotation: mediaCachePathAnnotation} = @@ -557,11 +604,6 @@ async function main() { logInfo`Good to go! Run hsmusic again without ${'--migrate-thumbs'} to start`; logInfo`using the migrated media cache.`; return true; - } else { - Object.assign(stepStatusSummary.migrateThumbnails, { - status: STATUS_NOT_APPLICABLE, - annotation: `--migrate-thumbs not provided`, - }); } const niceShowAggregate = (error, ...opts) => { @@ -572,19 +614,9 @@ async function main() { }); }; - if (skipThumbs && thumbsOnly) { - logInfo`Well, you've put yourself rather between a roc and a hard place, hmmmm?`; - return false; - } - let thumbsCache; if (skipThumbs) { - Object.assign(stepStatusSummary.generateThumbnails, { - status: STATUS_NOT_APPLICABLE, - annotation: `provided --skip-thumbs`, - }); - stepStatusSummary.loadThumbnailCache.status = STATUS_STARTED_NOT_DONE; const thumbsCachePath = path.join(mediaCachePath, thumbsCacheFile); @@ -627,11 +659,6 @@ async function main() { logInfo`Skipping thumbnail generation.`; } else { - Object.assign(stepStatusSummary.loadThumbnailCache, { - status: STATUS_NOT_APPLICABLE, - annotation: `using cache from thumbnail generation`, - }); - stepStatusSummary.generateThumbnails.status = STATUS_STARTED_NOT_DONE; logInfo`Begin thumbnail generation... -----+`; @@ -852,19 +879,9 @@ async function main() { .map(thing => () => CacheableObject.cacheAllExposedProperties(thing))); stepStatusSummary.precacheData.status = STATUS_DONE_CLEAN; - } else { - Object.assign(stepStatusSummary.precacheData, { - status: STATUS_NOT_APPLICABLE, - annotation: `--precache-data not provided`, - }); } if (noBuild) { - Object.assign(stepStatusSummary.performBuild, { - status: STATUS_NOT_APPLICABLE, - annotation: `--no-build provided`, - }); - displayCompositeCacheAnalysis(); if (precacheData) { @@ -931,11 +948,6 @@ async function main() { stepStatusSummary.loadLanguageFiles.status = STATUS_DONE_CLEAN; } else { languages = {}; - - Object.assign(stepStatusSummary.loadLanguageFiles, { - status: STATUS_NOT_APPLICABLE, - annotation: `neither --lang-path nor HSMUSIC_LANG provided`, - }); } stepStatusSummary.initializeDefaultLanguage.status = STATUS_STARTED_NOT_DONE; |