Class: JekyllAeo::Commands::Validate

Inherits:
Jekyll::Command
  • Object
show all
Defined in:
lib/jekyll-aeo/commands/validate.rb

Class Method Summary collapse

Class Method Details

.init_with_program(prog) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/jekyll-aeo/commands/validate.rb', line 9

def init_with_program(prog)
  prog.command(:"aeo:validate") do |c|
    c.syntax "aeo:validate [options]"
    c.description "Validate AEO output files (llms.txt, llms-full.txt, and referenced .md files)"

    c.option "destination", "-d", "--destination DESTINATION",
             "The destination directory to validate"
    c.option "source", "-s", "--source SOURCE", "Custom source directory"
    c.option "config", "--config CONFIG_FILE[,CONFIG_FILE2,...]", Array,
             "Custom configuration file"

    c.action do |_args, options|
      JekyllAeo::Commands::Validate.process(options)
    end
  end
end

.process(options) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/jekyll-aeo/commands/validate.rb', line 26

def process(options)
  options = configuration_from_options(options)
  dest = options["destination"]
  baseurl = options["baseurl"].to_s.chomp("/")
  errors, warnings = validate(dest, baseurl)
  report(errors, warnings)
end

.validate(dest, baseurl = "") ⇒ Object



34
35
36
37
38
39
40
41
42
# File 'lib/jekyll-aeo/commands/validate.rb', line 34

def validate(dest, baseurl = "")
  errors = []
  warnings = []
  validate_llms_txt(dest, errors)
  validate_llms_full_txt(dest, errors)
  validate_md_references(dest, baseurl, errors)
  validate_domain_profile(dest, errors, warnings)
  [errors, warnings]
end