-
-
Notifications
You must be signed in to change notification settings - Fork 652
/
Copy pathconfig.ru
28 lines (22 loc) · 1011 Bytes
/
config.ru
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require_relative './webapp/tabula_settings.rb'
require_relative './webapp/tabula_web.rb'
run Cuba
puts "$PROGRAM_NAME : #{$PROGRAM_NAME}"
# if running as a jar, automatically open the user's web browser
if "#{$PROGRAM_NAME}".include? "tabula.jar"
require 'java'
# don't do "java_import java.net.URI" -- it conflicts with Ruby URI and
# makes Cuba/Rack really really upset. just call "java.*" classes
# directly.
url = "http://127.0.0.1:8080"
puts "\n======================================================"
puts "Launching web browser to #{url}\n\n"
puts "When you're done using the Tabula interface, you may"
puts "return to this window and press \"Control-C\" to close it."
puts "======================================================\n\n"
# Open browser after slight delay. (The server may take a while to actually
# serve HTTP, so we are trying to avoid a "Could Not Connect To Server".)
uri = java.net.URI.new(url)
sleep 0.5
java.awt.Desktop.getDesktop().browse(uri)
end