15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/gemkeeper/cli/commands/server/start.rb', line 15
def call(**options)
port = options[:port]
config = Configuration.load(options[:config])
config = override_port(config, port) if port
manager = ServerManager.new(config)
url = config.geminabox_url
if options[:foreground]
puts "Starting Geminabox server at #{url}"
puts "Press Ctrl+C to stop"
manager.start_foreground
else
manager.start
puts "Geminabox server started at #{url}"
puts "PID: #{File.read(config.pid_file).strip}"
end
rescue ServerAlreadyRunningError => error
warn "Error: #{error.message}"
exit 1
rescue ServerError => error
warn "Error starting server: #{error.message}"
exit 1
rescue Interrupt
puts "\nShutting down..."
end
|