Sha256: c20fe2cbd961792df8febf9fd0ee7d56eda475573d086c8ac9977f0a53408757
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
require 'nox/version' require 'nox/ghserver' require 'highline/import' require 'thor' require 'webrick' # The Thor subclass containing useful tasks # class Nox::App < Thor desc "version", "Show the version" def version puts "Version #{Nox::VERSION}" end desc "ghserver [PATH]", "Start a webserver that does GitHub markup" method_option :port, type: :numeric, aliases: '-p', default: 8019, desc: 'Port' def ghserver(path=Dir.getwd) Encoding.default_internal = 'utf-8' WEBrick::HTTPServlet::FileHandler.add_handler('md', ::Nox::GitHubRenderer) WEBrick::HTTPServlet::FileHandler.add_handler('markdown', ::Nox::GitHubRenderer) server = WEBrick::HTTPServer.new DocumentRoot: path, BindAddress: '0.0.0.0', Port: options.port server.mount '/style.css', ::Nox::Styles ['INT', 'TERM'].each {|signal| trap(signal) { server.shutdown } } server.start end private def die msg, rc = 1 HighLine.say HighLine.color(msg, HighLine::RED) exit(rc) end end # vim: ft=ruby sts=2 sw=2 ts=8
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nox-0.1.1 | lib/nox.rb |