class Fontist::ValidateCLI
Public Instance Methods
Source
# File lib/fontist/validate_cli.rb, line 64 def cache handle_class_options(options) cache_path = validation_cache_path # Check if existing cache is valid if !options[:force] && File.exist?(cache_path) existing_cache = Validator.load_cache(cache_path) if existing_cache && !existing_cache.stale? age_hours = (Time.now.to_i - existing_cache.generated_at) / 3600.0 Fontist.ui.say("Validation cache exists and is fresh (#{age_hours.round(1)} hours old)") Fontist.ui.say("Use --force to rebuild") return CLI::STATUS_SUCCESS end end start_time = Time.now puts Paint["Building validation cache...", :cyan, :bright] puts Paint["-" * 80, :cyan] # Build cache validator = Validator.new validator.build_cache(cache_path, verbose: options[:verbose]) total_time = Time.now - start_time puts puts Paint["-" * 80, :cyan] puts Paint["Cache file: ", :white] + Paint[cache_path, :cyan] puts Paint["Total time: ", :white] + Paint["#{total_time.round(2)}s", :green, :bright] CLI::STATUS_SUCCESS rescue Fontist::Errors::GeneralError => e Fontist.ui.error(e.message) CLI::STATUS_UNKNOWN_ERROR end
Source
# File lib/fontist/validate_cli.rb, line 104 def clear handle_class_options(options) cache_path = validation_cache_path if File.exist?(cache_path) File.delete(cache_path) Fontist.ui.success("Validation cache cleared: #{cache_path}") else Fontist.ui.say("Validation cache does not exist") end CLI::STATUS_SUCCESS rescue Fontist::Errors::GeneralError => e Fontist.ui.error(e.message) CLI::STATUS_UNKNOWN_ERROR end
Source
# File lib/fontist/validate_cli.rb, line 23 def report handle_class_options(options) start_time = Time.now puts Paint["Generating font validation report...", :cyan, :bright] puts Paint["-" * 80, :cyan] # Validate all fonts validator = Validator.new validator.validate_all(parallel: options[:parallel], verbose: options[:verbose]) report = validator.report total_time = Time.now - start_time # Output report based on format case options[:format].downcase when "json" output_json_report(report, options[:output]) when "yaml" output_yaml_report(report, options[:output]) when "text" output_text_report(report, options[:output], total_time) else Fontist.ui.error("Unknown format: #{options[:format]}. Use 'text', 'yaml', or 'json'.") return CLI::STATUS_UNKNOWN_ERROR end CLI::STATUS_SUCCESS rescue Fontist::Errors::GeneralError => e Fontist.ui.error(e.message) CLI::STATUS_UNKNOWN_ERROR end