class SiteHook::Commands::ServerClass
Public Instance Methods
listen()
click to toggle source
# File lib/site_hook/commands/server_class.rb, line 19 def listen host = SiteHook::Config.webhook.host port = SiteHook::Config.webhook.port if options['host'] host = options['host'] end if options['port'] port = options['port'] end $threads << Thread.new do ::Thin::Server.start(host, port, SiteHook::Server, debug: true) end $threads << Thread.new do loop do case $stdin.gets when "reload\n" ::SiteHook::Config.reload! when "quit\n" $threads.each do |thr| thr == Thread.current ? exit(0) : thr.exit end end end end $threads.each(&:join) end