Sha256: c25bbf2e25a943cddefc4a976f948bccffcc62529ec49d72c986f1f3a59477b0

Contents?: true

Size: 692 Bytes

Versions: 4

Compression:

Stored size: 692 Bytes

Contents

require 'webrick'

module GitObjectBrowser

  module Server

    class Main

      def initialize(target)
        @target = target
      end

      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('/.git', GitServlet, @target)
        trap 'INT' do
          server.shutdown
        end
        server.start
      end

      def self.execute(target, host, port)
        self.new(target).start(host, port)
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
git-object-browser-0.0.6 lib/git-object-browser/server/main.rb
git-object-browser-0.0.4 lib/git-object-browser/server/main.rb
git-object-browser-0.0.3 lib/git-object-browser/server/main.rb
git-object-browser-0.0.2 lib/git-object-browser/server/main.rb