Class: SvgConform::Commands::SvgcheckGenerate

Inherits:
Object
  • Object
show all
Defined in:
lib/svg_conform/commands/svgcheck_generate.rb

Overview

Generate svgcheck outputs using Open3 for proper process management

Instance Method Summary collapse

Constructor Details

#initialize(svgcheck_repo_path, options) ⇒ SvgcheckGenerate

Returns a new instance of SvgcheckGenerate.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/svg_conform/commands/svgcheck_generate.rb', line 12

def initialize(svgcheck_repo_path, options)
  @svgcheck_repo_path = svgcheck_repo_path
  @options = options
  @svgcheck_exec = @options[:svgcheck_exec] || "svgcheck"
  @fixtures_path = @options[:fixtures_path] || "spec/fixtures/svgcheck"
  @test_dir = File.join(@svgcheck_repo_path, "svgcheck", "Tests")
  @svgcheck_dir = File.join(@svgcheck_repo_path, "svgcheck")
  @single_file = @options[:single_file]
  @force = @options[:force] || false
  @verbose = @options[:verbose] || false
  @mode = @options[:mode] || "both" # 'check', 'repair', or 'both'

  # File renaming map: svgcheck filename => our fixture filename
  @file_rename_map = {
    "full-tiny.xml" => "full-tiny.svg",
    "rfc-svg.xml" => "rfc-svg.svg",
  }
end

Instance Method Details

#executeObject



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/svg_conform/commands/svgcheck_generate.rb', line 31

def execute
  puts Paint["🔧 Generating svgcheck outputs...", :blue, :bold]
  puts Paint["📋 Mode: #{@mode}", :cyan]

  # Ensure output directories exist
  ensure_output_directories

  if @single_file
    generate_single_output(@single_file)
  else
    generate_all_outputs
  end
end