Class: Crawlscope::Run

Inherits:
Object
  • Object
show all
Defined in:
lib/crawlscope/run.rb

Instance Method Summary collapse

Constructor Details

#initialize(configuration: Crawlscope.configuration, reporter: Reporter.new(io: configuration.output)) ⇒ Run

Returns a new instance of Run.



5
6
7
8
# File 'lib/crawlscope/run.rb', line 5

def initialize(configuration: Crawlscope.configuration, reporter: Reporter.new(io: configuration.output))
  @configuration = configuration
  @reporter = reporter
end

Instance Method Details

#validate(base_url: nil, sitemap_path: nil, rule_names: nil) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/crawlscope/run.rb', line 10

def validate(base_url: nil, sitemap_path: nil, rule_names: nil)
  resolved_base_url = base_url || default_base_url
  crawl = @configuration.audit(
    base_url: resolved_base_url,
    sitemap_path: sitemap_path || default_sitemap_path(base_url: resolved_base_url),
    rule_names: rule_names
  )

  result = crawl.call
  @reporter.report(result)
  result
end

#validate_json_ld(urls:, debug: false, renderer: @configuration.renderer, timeout_seconds: @configuration.timeout_seconds, report_path: nil, summary: false) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/crawlscope/run.rb', line 23

def validate_json_ld(urls:, debug: false, renderer: @configuration.renderer, timeout_seconds: @configuration.timeout_seconds, report_path: nil, summary: false)
  StructuredData::Check.new(configuration: @configuration).call(
    urls: urls,
    debug: debug,
    renderer: renderer,
    timeout_seconds: timeout_seconds,
    report_path: report_path,
    summary: summary
  )
end