Class: Suma::Cli::ValidateLinks
- Inherits:
-
Thor
- Object
- Thor
- Suma::Cli::ValidateLinks
- Defined in:
- lib/suma/cli/validate_links.rb
Overview
ValidateLinks command for managing EXPRESS links
Instance Method Summary collapse
Instance Method Details
#extract_and_validate(schemas_file = "schemas-srl.yml", documents_path = "documents", output_file = "validation_results.txt") ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/suma/cli/validate_links.rb', line 12 def extract_and_validate(schemas_file = "schemas-srl.yml", documents_path = "documents", output_file = "validation_results.txt") load_dependencies paths = prepare_file_paths(schemas_file, documents_path, output_file) # Load schemas and extract links schemas_config = load_schemas_config(paths[:schemas_file]) exp_files = collect_schema_paths(schemas_config, paths[:schemas_file_rel]) adoc_files = find_adoc_files(paths[:documents_path]) all_files = adoc_files + exp_files display_file_counts(adoc_files, exp_files) # Extract links from files links_by_file = extract_links(all_files) # Validate links against schemas repo = load_express_schemas(schemas_config) unresolved_links = validate_links(links_by_file, repo) # Generate and output results write_validation_results(paths[:output_file], paths[:output_file_rel], unresolved_links, links_by_file) end |