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 profiles and output formats, with ftxvalidator-compatible options.
Instance Method Summary collapse
-
#initialize(input:, profile: nil, exclude: [], output: nil, format: :text, full_report: false, summary_report: false, table_report: false, verbose: false, suppress_warnings: false, return_value_results: false) ⇒ ValidateCommand
constructor
Initialize validate command.
-
#run ⇒ Integer
Run the validation command.
Constructor Details
#initialize(input:, profile: nil, exclude: [], output: nil, format: :text, full_report: false, summary_report: false, table_report: false, verbose: false, suppress_warnings: false, return_value_results: false) ⇒ ValidateCommand
Initialize validate command
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/fontisan/commands/validate_command.rb', line 41 def initialize( input:, profile: nil, exclude: [], output: nil, format: :text, full_report: false, summary_report: false, table_report: false, verbose: false, suppress_warnings: false, return_value_results: false ) @input = input @profile = profile || :default @exclude = exclude @output = output @format = format @full_report = full_report @summary_report = summary_report @table_report = table_report @verbose = verbose @suppress_warnings = suppress_warnings @return_value_results = return_value_results end |
Instance Method Details
#run ⇒ Integer
Run the validation command
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/fontisan/commands/validate_command.rb', line 70 def run # Load font with appropriate mode profile_config = Validators::ProfileLoader.profile_info(@profile) unless profile_config unless @suppress_warnings puts "Error: Unknown profile '#{@profile}'" puts "" puts "Available profiles:" Validators::ProfileLoader.all_profiles.each do |name, config| puts " #{name.to_s.ljust(20)} - #{config[:description]}" end puts "" puts "Use --list to see all available profiles" end return 1 end mode = profile_config[:loading_mode].to_sym # Check if input is a collection if FontLoader.collection?(@input) validate_collection(mode) else validate_single_font(mode) end rescue StandardError => e puts "Error: #{e.}" unless @suppress_warnings puts e.backtrace.join("\n") if @verbose && !@suppress_warnings 1 end |