Class: Nox::App

Inherits:
Thor
  • Object
show all
Defined in:
lib/nox.rb

Overview

The Thor subclass containing useful tasks

Instance Method Summary collapse

Instance Method Details

#ghserver(path = Dir.getwd) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/nox.rb', line 19

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

#versionObject



13
14
15
# File 'lib/nox.rb', line 13

def version
  puts "Version #{Nox::VERSION}"
end