mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2025-10-30 06:07:56 +00:00
* Add suggest and psmodule to schema.json * Fix required fields in schema.json * Improve url validation in schema.json * Add validator.exe as a single file validation tool * Add Scoop.Validator Lib for use in Manifest-Tests * Add buildscript for Scoop.Validator and validator.exe * Exclude .dll and packages folder from Project-Tests * Validate manifests against JSON Schema in CI Tests * Complete JSON Schema Validation * Dlls shouldn't be treated as text
38 lines
920 B
C#
38 lines
920 B
C#
using System;
|
|
using System.IO;
|
|
|
|
namespace Scoop
|
|
{
|
|
public class Program
|
|
{
|
|
public static int Main(string[] args)
|
|
{
|
|
bool ci = (args.Length == 3 && args[2] == "-ci");
|
|
bool valid = false;
|
|
|
|
if (args.Length < 2)
|
|
{
|
|
Console.WriteLine("Usage: validator.exe schema.json manifest.json");
|
|
return 1;
|
|
}
|
|
|
|
Scoop.Validator validator = new Scoop.Validator(args[0], ci);
|
|
valid = validator.Validate(args[1]);
|
|
|
|
if (valid)
|
|
{
|
|
Console.WriteLine("Yay! {0} validates against the schema!", Path.GetFileName(args[1]));
|
|
}
|
|
else
|
|
{
|
|
foreach (var error in validator.Errors)
|
|
{
|
|
Console.WriteLine(error);
|
|
}
|
|
}
|
|
|
|
return valid ? 0 : 1;
|
|
}
|
|
}
|
|
}
|