Class: Factorix::CLI::Commands::MOD::Check

Inherits:
Base
  • Object
show all
Defined in:
lib/factorix/cli/commands/mod/check.rb

Overview

Validate MOD dependencies without making changes

Instance Method Summary collapse

Methods inherited from Base

backup_support!, confirmable!, inherited, require_game_stopped!

Instance Method Details

#callvoid

This method returns an undefined value.

Execute the check command

Raises:



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/factorix/cli/commands/mod/check.rb', line 25

def call(**)
  mod_list = MODList.load
  presenter = Progress::Presenter.new(title: "\u{1F50D}\u{FE0E} Scanning MOD(s)", output: err)
  handler = Progress::ScanHandler.new(presenter)
  installed_mods = InstalledMOD.all(handler:)
  graph = Dependency::Graph::Builder.build(installed_mods:, mod_list:)

  validator = Dependency::Validator.new(graph:, mod_list:, installed_mods:)
  result = validator.validate

  display_result(result, graph)

  raise ValidationError, "MOD dependency validation failed" unless result.valid?
end