Class: Lutaml::Cli::Uml::VerifyCommand
- Inherits:
-
Object
- Object
- Lutaml::Cli::Uml::VerifyCommand
- Defined in:
- lib/lutaml/cli/uml/verify_command.rb
Overview
VerifyCommand verifies XMI/QEA equivalence
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ VerifyCommand
constructor
A new instance of VerifyCommand.
-
#run(xmi_path, qea_path) ⇒ Object
rubocop:disable Metrics/CyclomaticComplexity,Metrics/AbcSize,Metrics/MethodLength,Metrics/PerceivedComplexity.
Constructor Details
#initialize(options = {}) ⇒ VerifyCommand
Returns a new instance of VerifyCommand.
13 14 15 |
# File 'lib/lutaml/cli/uml/verify_command.rb', line 13 def initialize( = {}) @options = .transform_keys(&:to_sym) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
11 12 13 |
# File 'lib/lutaml/cli/uml/verify_command.rb', line 11 def @options end |
Class Method Details
.add_options_to(thor_class, _method_name) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/lutaml/cli/uml/verify_command.rb', line 17 def self.(thor_class, _method_name) thor_class.long_desc <<-DESC Verify that QEA and XMI files contain equivalent information. Examples: lutaml uml verify model.xmi model.qea lutaml uml verify model.xmi model.qea --report report.json DESC thor_class.option :report, type: :string, desc: "Save report to file" thor_class.option :format, type: :string, default: "text", desc: "Output format (text|json|yaml)" end |
Instance Method Details
#run(xmi_path, qea_path) ⇒ Object
rubocop:disable Metrics/CyclomaticComplexity,Metrics/AbcSize,Metrics/MethodLength,Metrics/PerceivedComplexity
31 32 33 34 35 36 37 38 39 40 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 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/lutaml/cli/uml/verify_command.rb', line 31 def run(xmi_path, qea_path) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/AbcSize,Metrics/MethodLength,Metrics/PerceivedComplexity unless File.exist?(xmi_path) puts OutputFormatter.error("XMI file not found: #{xmi_path}") raise Thor::Error, "XMI file not found: #{xmi_path}" end unless File.exist?(qea_path) puts OutputFormatter.error("QEA file not found: #{qea_path}") raise Thor::Error, "QEA file not found: #{qea_path}" end puts OutputFormatter.colorize( "\n=== XMI/QEA Equivalence Verification ===\n", :cyan ) puts "XMI File: #{xmi_path}" puts "QEA File: #{qea_path}" puts "" OutputFormatter.progress("Verifying equivalence") verifier = Lutaml::Qea::Verification::DocumentVerifier.new begin result = verifier.verify(xmi_path, qea_path) OutputFormatter.progress_done rescue StandardError => e OutputFormatter.progress_done(success: false) puts OutputFormatter.error("Verification failed: #{e.}") raise Thor::Error, "Verification failed: #{e.}" end display_verification_result(result) if [:report] save_verification_report(result, [:report]) end # Exit with appropriate status if [:strict] && !result.equivalent? puts "" puts OutputFormatter.error("Verification FAILED") raise Thor::Error, "Verification FAILED" elsif result.equivalent? puts "" puts OutputFormatter.success("Verification PASSED") end end |