Sha256: 86c658da1a0805893ba85ee2ecbda4e52b3d10c365f9e470f02fc48560982029
Contents?: true
Size: 1.13 KB
Versions: 3
Compression:
Stored size: 1.13 KB
Contents
require 'webrick' require 'webrick/https' module Guard class WEBrick class Server attr_reader :server def initialize(options = {}) if options[:ssl] @server = ::WEBrick::HTTPServer.new( :BindAddress => options[:host], :Port => options[:port], :DocumentRoot => File.expand_path(options[:docroot]), :SSLEnable => true, :SSLCertName => [%w[CN localhost]] ) else @server = ::WEBrick::HTTPServer.new( :BindAddress => options[:host], :Port => options[:port], :DocumentRoot => File.expand_path(options[:docroot]) ) end end def start %w{TERM HUP}.each { |signal| trap(signal){ server.shutdown } } # ignore signals for guard %w{INT TSTP QUIT}.each { |signal| trap(signal) {} } @server.start end end end end if __FILE__ == $0 host, port, ssl, docroot = ARGV Guard::WEBrick::Server.new( :host => host, :port => port, :ssl => ssl == 'true', :docroot => docroot ).start end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
guard-webrick-0.1.4 | lib/guard/webrick/server.rb |
guard-webrick-0.1.3 | lib/guard/webrick/server.rb |
guard-webrick-0.1.2 | lib/guard/webrick/server.rb |