Sha256: e1f51c9d429597e633034b9792f56616d42917ef4b5dec67e1913f4f2d50bde1
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
require 'thor' require 'grape' require 'grape-route-helpers' require 'site_hook/webhook' require 'thin' require 'site_hook/config' module SiteHook module Commands class ServerClass < Thor SiteHook::Config.config # def __version # puts SiteHook::VERSION # end # map ['-v', '--version'] => __version method_option(:host, banner: 'HOST', aliases: ['-h'], type: :string, default: SiteHook::Config.webhook.host) method_option(:port, banner: 'PORT', aliases: ['-p'], type: :numeric, default: SiteHook::Config.webhook.port) desc 'listen [options]', '' def listen $threads << Thread.new do PreLogger.debug options ::Thin::Server.start(options[:host], options[: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 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
site_hook-1.0.26 | lib/site_hook/commands/server_class.rb |
site_hook-1.0.25 | lib/site_hook/commands/server_class.rb |