Class: Lutaml::Xsd::InteractiveBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/lutaml/xsd/interactive_builder.rb

Overview

Interactive package builder for creating schema repository configurations Discovers dependencies, resolves ambiguities, and generates YAML config

Constant Summary collapse

SESSION_FILE =
".lutaml-xsd-session.yml"
CACHE_DIR =
File.expand_path("~/.lutaml-xsd/cache")

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entry_points, options = {}) ⇒ InteractiveBuilder

Returns a new instance of InteractiveBuilder.



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/lutaml/xsd/interactive_builder.rb', line 21

def initialize(entry_points, options = {})
  @entry_points = entry_points
  @options = options
  @prompt = TTY::Prompt.new
  @resolved_mappings = []
  @namespace_mappings = []
  @pattern_mappings = []
  @pending_schemas = []
  @processed_schemas = []
  @dependency_count = 0
end

Instance Attribute Details

#entry_pointsObject (readonly)

Returns the value of attribute entry_points.



15
16
17
# File 'lib/lutaml/xsd/interactive_builder.rb', line 15

def entry_points
  @entry_points
end

#namespace_mappingsObject (readonly)

Returns the value of attribute namespace_mappings.



15
16
17
# File 'lib/lutaml/xsd/interactive_builder.rb', line 15

def namespace_mappings
  @namespace_mappings
end

#optionsObject (readonly)

Returns the value of attribute options.



15
16
17
# File 'lib/lutaml/xsd/interactive_builder.rb', line 15

def options
  @options
end

#pattern_mappingsObject (readonly)

Returns the value of attribute pattern_mappings.



15
16
17
# File 'lib/lutaml/xsd/interactive_builder.rb', line 15

def pattern_mappings
  @pattern_mappings
end

#pending_schemasObject (readonly)

Returns the value of attribute pending_schemas.



15
16
17
# File 'lib/lutaml/xsd/interactive_builder.rb', line 15

def pending_schemas
  @pending_schemas
end

#processed_schemasObject (readonly)

Returns the value of attribute processed_schemas.



15
16
17
# File 'lib/lutaml/xsd/interactive_builder.rb', line 15

def processed_schemas
  @processed_schemas
end

#promptObject (readonly)

Returns the value of attribute prompt.



15
16
17
# File 'lib/lutaml/xsd/interactive_builder.rb', line 15

def prompt
  @prompt
end

#resolved_mappingsObject (readonly)

Returns the value of attribute resolved_mappings.



15
16
17
# File 'lib/lutaml/xsd/interactive_builder.rb', line 15

def resolved_mappings
  @resolved_mappings
end

Instance Method Details

#runBoolean

Run the interactive builder session

Returns:

  • (Boolean)

    Success status



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/lutaml/xsd/interactive_builder.rb', line 35

def run
  display_welcome

  if options[:resume] && session_exists?
    load_session
  else
    initialize_session
  end

  process_all_schemas
  save_configuration
  cleanup_session

  display_summary
  true
rescue StandardError => e
  error("Interactive builder failed: #{e.message}")
  save_session if @dependency_count.positive?
  false
end