mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
26 lines
725 B
Ruby
Executable File
26 lines
725 B
Ruby
Executable File
#!/usr/bin/env ruby
|
|
|
|
require "md_to_pdf/core"
|
|
require "md_to_pdf/style/validation"
|
|
require "yaml"
|
|
require "json"
|
|
|
|
class SchemaValidator
|
|
include MarkdownToPDF::StyleValidation
|
|
|
|
def validate
|
|
root = File.expand_path("../../", __dir__)
|
|
export_folder = File.join(root, "app", "models", "work_package", "pdf_export", "export")
|
|
%w[report wp timesheet].each do |type|
|
|
puts "Validating #{type} styles"
|
|
schema = JSON::load_file(File.join(export_folder, type, "schema.json"))
|
|
styles_file = File.join(export_folder, type, "standard.yml")
|
|
styles = YAML.load_file(styles_file)
|
|
validate_schema!(styles, schema)
|
|
puts "Valid: #{styles_file}"
|
|
end
|
|
end
|
|
end
|
|
|
|
SchemaValidator.new.validate
|