Class: MendixBridge::DesktopApp

Inherits:
Object
  • Object
show all
Defined in:
lib/mendix_bridge/desktop_app.rb

Constant Summary collapse

APP_TITLE =
"Mendix Ruby Bridge"
WINDOW_WIDTH =
1280
WINDOW_HEIGHT =
800
READY_TIMEOUT =
15

Instance Method Summary collapse

Constructor Details

#initialize(inventory_dir:, bridge_dir: nil) ⇒ DesktopApp

Returns a new instance of DesktopApp.



13
14
15
16
17
18
# File 'lib/mendix_bridge/desktop_app.rb', line 13

def initialize(inventory_dir:, bridge_dir: nil)
  @inventory_dir = File.expand_path(inventory_dir)
  @bridge_dir = bridge_dir || File.expand_path("../..", __dir__)
  @server_thread = nil
  @backend = nil
end

Instance Method Details

#runObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/mendix_bridge/desktop_app.rb', line 20

def run
  require_gtk!
  configure_env!

  port = free_port
  start_backend(port)
  wait_for_backend(port)

  Gtk.init
  window = build_window(port)
  window.show_all
  Gtk.main
ensure
  @backend&.shutdown
  @server_thread&.kill
end