checkManifest method

  1. @override
Future<bool> checkManifest(
  1. ReleaseManifest manifest, {
  2. bool verbose = false,
  3. bool checkNewReleaseFiles = true,
})
override

Checks the manifest with the stored files to this storage implementation.

Implementation

@override
Future<bool> checkManifest(ReleaseManifest manifest,
    {bool verbose = false, bool checkNewReleaseFiles = true}) async {
  var release = manifest.release;
  var dir = releaseDirectory(release);

  if (verbose) {
    print(
        '»  Checking manifest (${manifest.release}) with release at: ${dir.path}');
  }

  if (!dir.existsSync()) {
    print("  ▒  Can't find release directory: ${dir.path}");
    return false;
  }

  var checkOK = true;

  for (var f in manifest.files) {
    var localFile = File(joinPaths(dir.path, f.filePath));

    bool? ok;

    if (!overwriteFiles && checkNewReleaseFiles) {
      var localFile2 = File(localFile.path + _newReleaseSuffix);
      if (localFile2.existsSync()) {
        ok = await f.checkFile(localFile2);
      }
    }

    ok ??= await f.checkFile(localFile);

    if (!ok) {
      print("  ▒  Error checking file: ${localFile.path}");
      checkOK = false;
      continue;
    }
  }

  return checkOK;
}