0
@@ -207,85 +207,7 @@ module Gitjour
0
- port = args.shift || 9850
0
- DNSSD.browse("_http._tcp") do |reply|
0
- DNSSD.resolve reply.name, reply.type, reply.domain do |resolve_reply|
0
- service = GitService.new(reply.name,
0
- resolve_reply.text_record['description'].to_s)
0
- if services.member? service
0
- services.delete service
0
- # usually a jacked DNS text record
0
- http = WEBrick::HTTPServer.new(:Port => port.to_i)
0
- http.mount_proc("/") do |req, res|
0
- res['Content-Type'] = 'text/html'
0
- <link rel="stylesheet" href="/style.css" type="text/css" media="screen"/>
0
- <h1>Browseable Git Repositories</h1>
0
- #{mutex.synchronize do
0
- "<li><a href='http://#{s.host}:#{s.port}'>#{s.name}</a> #{s.description}</li>"
0
- http.mount_proc("/style.css") do |req, res|
0
- res['Content-Type'] = 'text/css'
0
- font-family: sans-serif;
0
- background-color: #fff;
0
- border: 1px dashed #999;
0
- background-color: #ccc;
0
- trap("INT") { http.shutdown }
0
- t = Thread.new { http.start }
0
- url = "http://localhost:#{port}"
0
- `git web--browse -b '#{browser}' http://localhost:9850`
0
- `git web--browse -c "instaweb.browser" http://localhost:9850`
0
+ Browser.new(*args).start
0
@@ -313,4 +235,92 @@ module Gitjour
0
+ @port = args.shift || 9850
0
+ DNSSD.browse("_http._tcp") do |reply|
0
+ DNSSD.resolve reply.name, reply.type, reply.domain do |resolve_reply|
0
+ service = GitService.new(reply.name,
0
+ resolve_reply.text_record['description'].to_s)
0
+ if @services.member? service
0
+ @services.delete service
0
+ @services << service if service.name =~ /\.git$/
0
+ rescue ArgumentError # usually a jacked DNS text record
0
+ http = WEBrick::HTTPServer.new(:Port => @port.to_i)
0
+ http.mount_proc("/") { |req, res| index(req, res) }
0
+ http.mount_proc("/style.css") { |req, res| css(req, res) }
0
+ trap("INT") { http.shutdown }
0
+ t = Thread.new { http.start }
0
+ url = "http://localhost:#{@port}"
0
+ `git web--browse -b '#{@browser}' http://localhost:9850`
0
+ `git web--browse -c "instaweb.browser" http://localhost:9850`
0
+ res['Content-Type'] = 'text/html'
0
+ <link rel="stylesheet" href="/style.css" type="text/css" media="screen"/>
0
+ <h1>Browseable Git Repositories</h1>
0
+ #{@mutex.synchronize do
0
+ "<li><a href='http://#{s.host}:#{s.port}'>#{s.name}</a> #{s.description}</li>"
0
+ res['Content-Type'] = 'text/css'
0
+ font-family: sans-serif;
0
+ background-color: #fff;
0
+ border: 1px dashed #999;
0
+ background-color: #ccc;
Comments
No one has commented yet.