module Neruda

Constants

VERSION

@return [String] the version number of the current Neruda release.

Public Class Methods

start_preview() click to toggle source
# File lib/neruda/preview.rb, line 45
def start_preview
  # Inspired by ruby un.rb library, which allows normally to start a
  # webrick server in one line: ruby -run -e httpd public_html -p 5000
  port = Neruda::Config.settings.dig('preview', 'server_port') || 5000
  s = WEBrick::HTTPServer.new(Port: port)
  s.mount '/', Neruda::PreviewServlet
  ['TERM', 'QUIT', 'INT'].each { |sig| trap(sig, proc { s.shutdown }) }
  s.start
end