15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/gemkeeper/cli/commands/manifest/validate.rb', line 15
def call(path: nil, **options)
manifest_path = path || ManifestReader::DEFAULT_PATH
validator = ManifestValidator.new(manifest_path)
puts "Checking #{manifest_path}..." if options[:resolve]
errors = validator.validate(resolve: options[:resolve], output: $stdout)
if errors.empty?
entry_count = entry_count(manifest_path)
puts "#{manifest_path}: valid (#{entry_count} #{entry_count == 1 ? "entry" : "entries"})"
else
warn "#{manifest_path}: #{errors.size} #{"error".then { |w| errors.size == 1 ? w : "#{w}s" }}"
errors.each { |e| warn " #{e}" }
exit 1
end
end
|