<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,25 +1,8 @@
-bin/gitjour
 History.txt
-License.txt
 Manifest.txt
 README.txt
 Rakefile
-config/hoe.rb
-config/requirements.rb
+bin/gitjour
 lib/gitjour.rb
-lib/gitjour/application.rb
-lib/gitjour/version.rb
-script/destroy
-script/generate
-script/txt2html
-setup.rb
-tasks/deployment.rake
-tasks/environment.rake
-tasks/website.rake
 test/test_gitjour.rb
 test/test_helper.rb
-website/index.html
-website/index.txt
-website/javascripts/rounded_corners_lite.inc.js
-website/stylesheets/screen.css
-website/template.rhtml</diff>
      <filename>Manifest.txt</filename>
    </modified>
    <modified>
      <diff>@@ -1,8 +1,49 @@
-README
+= gitjour
 
-DEVELOPMENT
+* http://github.com/chad/gitjour
 
-How to test from the console:
+== DESCRIPTION:
 
-irb -r 'lib/gitjour/application'
-&gt; Gitjour::Application.run &quot;list&quot;
+Automates DNSSD-powered serving and cloning of git repositories.
+
+== FEATURES/PROBLEMS:
+
+* As needed
+
+== SYNOPSIS:
+
+  % gitjour serve project_dir [name_to_advertise_as]
+  % gitjour list
+
+== REQUIREMENTS:
+
+* dnssd
+
+== INSTALL:
+
+* sudo gem install gitjour
+
+== LICENSE:
+
+(The MIT License)
+
+Copyright (c) 2008 Chad Fowler, Evan Phoenix, and Rich Kilmer
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</diff>
      <filename>README.txt</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,14 @@
-require 'config/requirements'
-require 'config/hoe' # setup Hoe + all gem configuration
-
-Dir['tasks/**/*.rake'].each { |rake| load rake }
\ No newline at end of file
+# -*- ruby -*-
+
+require 'rubygems'
+require 'hoe'
+require './lib/gitjour.rb'
+
+Hoe.new('gitjour', Gitjour::VERSION) do |p|
+  p.extra_deps =  ['dnssd']
+  p.developer('Chad Fowler', 'chad@chadfowler.com')
+  p.developer('Evan Phoenix', 'evan@fallingsnow.net')
+  p.developer('Rich Kilmer', 'rich@example.com')
+end
+
+# vim: syntax=Ruby</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -1 +1,183 @@
-require 'gitjour/application'
+require 'rubygems'
+require 'dnssd'
+require 'set'
+
+Thread.abort_on_exception = true
+
+module Gitjour
+  VERSION = &quot;6.3.0&quot;
+  GitService = Struct.new(:name, :host, :port, :description)  
+
+  class Application
+
+    class &lt;&lt; self
+      def run(*args)
+        case args.shift
+          when &quot;list&quot;
+            list
+          when &quot;clone&quot;
+            clone(*args)
+          when &quot;serve&quot;
+            serve(*args)
+          when &quot;remote&quot;
+            remote(*args)
+          else
+            help
+        end
+      end
+
+      private
+			def list
+				service_list.each do |service|
+          puts &quot;=== #{service.name} on #{service.host}:#{service.port} ===&quot;
+          puts &quot;  gitjour clone #{service.name}&quot;
+          if service.description != '' &amp;&amp; service.description !~ /^Unnamed repository/
+            puts &quot;  #{service.description}&quot;
+          end
+          puts
+        end
+			end
+
+      def clone(repository_name, *rest)
+        dir = rest.shift || repository_name
+        if File.exists?(dir)
+          exit_with! &quot;ERROR: Clone directory '#{dir}' already exists.&quot;
+        end
+
+        puts &quot;Cloning '#{repository_name}' into directory '#{dir}'...&quot;
+
+        unless service = locate_repo(repository_name)
+          exit_with! &quot;ERROR: Unable to find project named '#{repository_name}'&quot;
+        end
+
+        puts &quot;Connecting to #{service.host}:#{service.port}&quot;
+
+        system &quot;git clone git://#{service.host}:#{service.port}/ #{dir}/&quot;
+      end
+
+      def remote(repository_name, *rest)
+        dir = rest.shift || repository_name
+        service = locate_repo repository_name
+        system &quot;git remote add #{dir} git://#{service.host}:#{service.port}/&quot;
+      end
+
+      def serve(path=Dir.pwd, *rest)
+        path = File.expand_path(path)
+        name = rest.shift || File.basename(path)
+        port = rest.shift || 9418
+
+        # If the name starts with ^, then don't apply the prefix
+        if name[0] == ?^
+          name = name[1..-1]
+        else
+          prefix = `git config --get gitjour.prefix`.chomp
+          prefix = ENV[&quot;USER&quot;] if prefix.empty?
+          name   = [prefix, name].compact.join(&quot;-&quot;)
+        end
+
+        if File.exists?(&quot;#{path}/.git&quot;)
+          announce_repo(path, name, port.to_i)
+        else
+          Dir[&quot;#{path}/*&quot;].each do |dir|
+            if File.directory?(dir)
+              name = File.basename(dir)
+              announce_repo(dir, name, 9418)
+            end
+          end
+        end
+
+        `git-daemon --verbose --export-all --port=#{port} --base-path=#{path} --base-path-relaxed`
+      end
+
+      def help
+        puts &quot;Gitjour #{Gitjour::VERSION::STRING}&quot;
+        puts &quot;Serve up and use git repositories via Bonjour/DNSSD.&quot;
+        puts &quot;\nUsage: gitjour &lt;command&gt; [args]&quot;
+        puts
+        puts &quot;  list&quot;
+        puts &quot;      Lists available repositories.&quot;
+        puts
+        puts &quot;  clone &lt;project&gt; [&lt;directory&gt;]&quot;
+        puts &quot;      Clone a gitjour served repository.&quot;
+        puts
+        puts &quot;  serve &lt;path_to_project&gt; [&lt;name_of_project&gt;] [&lt;port&gt;] or&quot;
+        puts &quot;        &lt;path_to_projects&gt;&quot;
+        puts &quot;      Serve up the current directory or projects via gitjour.&quot;
+        puts
+        puts &quot;      The name of your project is automatically prefixed with&quot;
+        puts &quot;      `git config --get gitjour.prefix` or your username (preference&quot;
+        puts &quot;      in that order). If you don't want a prefix, put a ^ on the front&quot;
+        puts &quot;      of the name_of_project (the ^ is removed before announcing).&quot;
+        puts
+        puts &quot;  remote &lt;project&gt; [&lt;name&gt;]&quot;
+        puts &quot;      Add a Bonjour remote into your current repository.&quot;
+        puts &quot;      Optionally pass name to not use pwd.&quot;
+        puts
+      end
+
+      def exit_with!(message)
+        STDERR.puts message
+        exit!
+      end
+
+      class Done &lt; RuntimeError; end
+
+      def discover(timeout=5)
+        waiting_thread = Thread.current
+
+        dns = DNSSD.browse &quot;_git._tcp&quot; do |reply|
+          DNSSD.resolve reply.name, reply.type, reply.domain do |resolve_reply|
+            service = GitService.new(reply.name,
+                                     resolve_reply.target,
+                                     resolve_reply.port,
+                                     resolve_reply.text_record['description'].to_s)
+            begin
+              yield service
+            rescue Done
+              waiting_thread.run
+            end
+          end
+        end
+
+        puts &quot;Gathering for up to #{timeout} seconds...&quot;
+        sleep timeout
+        dns.stop
+      end
+
+      def locate_repo(name)
+        found = nil
+
+        discover do |obj|
+          if obj.name == name
+            found = obj
+            raise Done
+          end
+        end
+
+        return found
+      end
+
+      def service_list
+        list = Set.new
+        discover { |obj| list &lt;&lt; obj }
+
+        return list
+      end
+
+      def announce_repo(path, name, port)
+        return unless File.exists?(&quot;#{path}/.git&quot;)
+
+        tr = DNSSD::TextRecord.new
+        tr['description'] = File.read(&quot;#{path}/.git/description&quot;) rescue &quot;a git project&quot;
+
+        DNSSD.register(name, &quot;_git._tcp&quot;, 'local', port, tr.encode) do |rr|
+          puts &quot;Registered #{name} on port #{port}. Starting service.&quot;
+        end
+      end
+
+    end
+  end
+end
+
+
+</diff>
      <filename>lib/gitjour.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>License.txt</filename>
    </removed>
    <removed>
      <filename>config/hoe.rb</filename>
    </removed>
    <removed>
      <filename>config/requirements.rb</filename>
    </removed>
    <removed>
      <filename>lib/gitjour/application.rb</filename>
    </removed>
    <removed>
      <filename>lib/gitjour/version.rb</filename>
    </removed>
    <removed>
      <filename>log/debug.log</filename>
    </removed>
    <removed>
      <filename>script/destroy</filename>
    </removed>
    <removed>
      <filename>script/generate</filename>
    </removed>
    <removed>
      <filename>script/txt2html</filename>
    </removed>
    <removed>
      <filename>setup.rb</filename>
    </removed>
    <removed>
      <filename>tasks/deployment.rake</filename>
    </removed>
    <removed>
      <filename>tasks/environment.rake</filename>
    </removed>
    <removed>
      <filename>tasks/website.rake</filename>
    </removed>
    <removed>
      <filename>website/index.html</filename>
    </removed>
    <removed>
      <filename>website/index.txt</filename>
    </removed>
    <removed>
      <filename>website/javascripts/rounded_corners_lite.inc.js</filename>
    </removed>
    <removed>
      <filename>website/stylesheets/screen.css</filename>
    </removed>
    <removed>
      <filename>website/template.rhtml</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>465921a6518d34b3d34d3ae0b3dd30493b054bf5</id>
    </parent>
  </parents>
  <author>
    <name>Wilson Bilkovich</name>
    <email>wilson@supremetyrant.com</email>
  </author>
  <url>http://github.com/chad/gitjour/commit/3f1d70e473785b093a63b77b07d387acbc45c3d1</url>
  <id>3f1d70e473785b093a63b77b07d387acbc45c3d1</id>
  <committed-date>2008-08-23T18:37:16-07:00</committed-date>
  <authored-date>2008-08-23T18:37:16-07:00</authored-date>
  <message>Remove ridiculous newbie shit</message>
  <tree>78a486cc725ffd15c99d2ff12f0a711373978456</tree>
  <committer>
    <name>Wilson Bilkovich</name>
    <email>wilson@supremetyrant.com</email>
  </committer>
</commit>
