Class: Lutaml::Xmi::WebUi::App

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/lutaml/uml_repository/web_ui/app.rb

Overview

Sinatra web application for browsing UML models.

Serves the modern SPA interface with JSON API endpoints and lunr.js search. Uses shared Liquid templates with the static site generator.

Examples:

Starting the server

Lutaml::Xmi::WebUi::App.serve("model.lur", port: 3000)

Class Method Summary collapse

Class Method Details

.serve(lur_path, port: 3000, host: "localhost") ⇒ Object

Start the web server



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/lutaml/uml_repository/web_ui/app.rb', line 101

def self.serve(lur_path, port: 3000, host: "localhost") # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
  repo = if File.extname(lur_path) == ".lur"
           UmlRepository::Repository.from_package(lur_path)
         else
           UmlRepository::Repository.from_xmi(lur_path)
         end

  set :repository, repo
  set :port, port
  set :bind, host

  puts ""
  puts "╔═══════════════════════════════════════════════════════════╗"
  puts "║        LutaML UML Browser - Web Server                  ║"
  puts "╚═══════════════════════════════════════════════════════════╝"
  puts ""
  puts "  Loading: #{File.basename(lur_path)}"
  puts "  Server:  http://#{host}:#{port}"
  puts ""
  puts "  Features:"
  puts "    • Modern SPA interface"
  puts "    • Live data via JSON API"
  puts "    • Full-text search with lunr.js"
  puts "    • Dark/light themes"
  puts "    • Responsive design"
  puts ""
  puts "  Press Ctrl+C to stop"
  puts ""
  puts "" * 60
  puts ""

  run!
end