Class: Suma::Eengine::Wrapper
- Inherits:
-
Object
- Object
- Suma::Eengine::Wrapper
- Defined in:
- lib/suma/eengine/wrapper.rb
Overview
Wrapper for eengine binary to compare EXPRESS schemas
Class Method Summary collapse
-
.available? ⇒ Boolean
Check if eengine is available on the system.
-
.compare(trial_schema, reference_schema, options = {}) ⇒ Hash
Compare two EXPRESS schemas using eengine.
-
.version ⇒ String?
Get the eengine version.
Class Method Details
.available? ⇒ Boolean
Check if eengine is available on the system
37 38 39 40 41 |
# File 'lib/suma/eengine/wrapper.rb', line 37 def available? return false if ENV["EENGINE_DISABLED"] == "true" eengine_path && eengine_executable? end |
.compare(trial_schema, reference_schema, options = {}) ⇒ Hash
Compare two EXPRESS schemas using eengine
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/suma/eengine/wrapper.rb', line 20 def compare(trial_schema, reference_schema, = {}) ensure_eengine_available! cmd = build_command(trial_schema, reference_schema, ) output, error, status = Open3.capture3(*cmd) unless status.success? = error.empty? ? "Unknown eengine error" : error.strip raise ComparisonError.new(, error) end parse_output(output, ) end |
.version ⇒ String?
Get the eengine version
46 47 48 49 50 51 52 53 54 |
# File 'lib/suma/eengine/wrapper.rb', line 46 def version return nil unless available? cmd = [eengine_path, "--version"] output, _, status = Open3.capture3(*cmd) status.success? ? parse_version(output) : nil rescue StandardError nil end |