chocolateyNuspec top-level property

ConfigVariable<String> chocolateyNuspec
final

The text contents of the Chocolatey package's .nuspec file.

By default, this is loaded from a file ending in .nuspec at the root of the repository, if a single such file exists.

cli_pkg will automatically add a "version" field and a dependency on the Dart SDK when building the Chocolatey package.

Implementation

final chocolateyNuspec = InternalConfigVariable.fn<String>(() {
  var possibleNuspecs = [
    for (var entry in Directory(".").listSync())
      if (entry is File && entry.path.endsWith(".nuspec")) entry.path
  ];

  if (possibleNuspecs.isEmpty) {
    fail("pkg.chocolateyNuspec must be set to build a Chocolatey package.");
  } else if (possibleNuspecs.length > 1) {
    fail("pkg.chocolateyNuspec found multiple .nuspec files: " +
        possibleNuspecs.join(", "));
  }

  return File(possibleNuspecs.single).readAsStringSync();
});