Sha256: d18eee82d6022aae2bbc092b482300952057e07e36e922ff3bf1b6127476f3c4
Contents?: true
Size: 1.25 KB
Versions: 2
Compression:
Stored size: 1.25 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) method_option(:port, banner: 'PORT', aliases: ['-p'], type: :numeric) desc 'listen [options]', '' 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 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
site_hook-1.0.30 | lib/site_hook/commands/server_class.rb |
site_hook-1.0.29 | lib/site_hook/commands/server_class.rb |