Sha256: ce375b76381064dcd371336108fdb678cd2163f3705b7c1c2ee3d86be333b577

Contents?: true

Size: 914 Bytes

Versions: 11

Compression:

Stored size: 914 Bytes

Contents

#!/usr/bin/env ruby
#
# Starts up a simple web server for local testing of generated documents.
#
# A typical dev flow:
#
# 1. Create your html docs using giblish
# 2. If you want to enable text search, copy or symlink the `gibsearch.rb` script
# from the giblish gem to the correct location under the target tree.
# 3. Run this script to kick-off a web server that serves your html docs.

require "webrick"
require "webrick/cgi"

# the root directory for the web server
web_root = "#{__dir__}/html_docs"

# the port the web server listens to
port = 8000

puts "Trying to start a WEBrick instance at port #{port} serving files from #{web_root}..."
server = WEBrick::HTTPServer.new(
  Port: port,
  DocumentRoot: File.expand_path(web_root),
  Logger: WEBrick::Log.new("webrick.log", WEBrick::Log::DEBUG)
)

puts "WEBrick instance now listening to localhost:#{port}"
trap "INT" do
  server.shutdown
end
server.start

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
giblish-2.2.2 scripts/wserv_development.rb
giblish-2.2.1 scripts/wserv_development.rb
giblish-2.2.0 scripts/wserv_development.rb
giblish-2.1.2 scripts/wserv_development.rb
giblish-2.1.1 scripts/wserv_development.rb
giblish-2.1.0 scripts/wserv_development.rb
giblish-2.0.1 scripts/wserv_development.rb
giblish-2.0.0 scripts/wserv_development.rb
giblish-2.0.0.pre.alpha1 scripts/wserv_development.rb
giblish-1.0.0 scripts/wserv_development.rb
giblish-1.0.0.rc2 scripts/wserv_development.rb