Class: Fontisan::Commands::ValidateCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- Fontisan::Commands::ValidateCommand
- Defined in:
- lib/fontisan/commands/validate_command.rb
Overview
ValidateCommand provides CLI interface for font validation
This command validates fonts against quality checks, structural integrity, and OpenType specification compliance. It supports different validation levels and output formats.
Instance Method Summary collapse
-
#initialize(input:, level: :standard, format: :text, verbose: true, quiet: false) ⇒ ValidateCommand
constructor
Initialize validate command.
-
#run ⇒ Integer
Run the validation command.
Constructor Details
#initialize(input:, level: :standard, format: :text, verbose: true, quiet: false) ⇒ ValidateCommand
Initialize validate command
31 32 33 34 35 36 37 38 39 |
# File 'lib/fontisan/commands/validate_command.rb', line 31 def initialize(input:, level: :standard, format: :text, verbose: true, quiet: false) super() @input = input @level = level.to_sym @format = format.to_sym @verbose = verbose @quiet = quiet end |
Instance Method Details
#run ⇒ Integer
Run the validation command
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/fontisan/commands/validate_command.rb', line 44 def run validate_params! # Load font font = load_font return 1 unless font # Create validator validator = Validation::Validator.new(level: @level) # Run validation report = validator.validate(font, @input) # Add variable font validation if applicable validate_variable_font(font, report) if font.has_table?("fvar") # Output results unless quiet mode output_report(report) unless @quiet # Return appropriate exit code determine_exit_code(report) rescue StandardError => e puts "Error: #{e.}" unless @quiet puts e.backtrace.join("\n") if @verbose && !@quiet 1 end |