class GitObjectBrowser::Server::Main

Public Class Methods

execute(target, host, port) click to toggle source
# File lib/git-object-browser/server/main.rb, line 25
def self.execute(target, host, port)
  self.new(target).start(host, port)
end
new(target) click to toggle source
# File lib/git-object-browser/server/main.rb, line 9
def initialize(target)
  @target = target
end

Public Instance Methods

start(host, port) click to toggle source
# File lib/git-object-browser/server/main.rb, line 13
def start(host, port)
  root = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__))))
  root = File.expand_path(File.join(root, "htdocs"))
  opts = { :BindAddress => host, :Port => port, :DocumentRoot => root }
  server = WEBrick::HTTPServer.new(opts)
  server.mount('/json', GitServlet, @target)
  trap 'INT' do
    server.shutdown
  end
  server.start
end