<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -25,6 +25,16 @@ Publish your app in the ether using Bonjour.
   Publishing lachie on 4001
   Announcing lachie...
   
+== Port guessing
+
+In the initialization phase of your app put:
+
+  Appjour.publish('leet rails')
+  
+Appjour will endeavour to extract the port number from your app.
+
+It can currently discover mongrel's port.
+
 == TODO
 
 * make useable as Rails or Merb plugin for automatic publishing of apps
\ No newline at end of file</diff>
      <filename>README.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -64,8 +64,10 @@ module Appjour
   def self.publish(name,port=:guess)
     STDERR.puts &quot;Publishing #{name} on #{port}&quot;
     
+    should_sleep = true
     if port.is_a?(Symbol)
       port = guess_port(port)
+      should_sleep = false
     else
       port = port.to_i
     end
@@ -77,10 +79,19 @@ module Appjour
       STDERR.puts &quot;Announcing #{name}...&quot;
     end
     
-    sleep
+    sleep if should_sleep
   end
   
   def self.guess_port(kind)
+    
+    # guess mongrel
+    if defined?(Mongrel)
+      ObjectSpace.each_object do |o|
+        return o.port if o.is_a?(Mongrel::HttpServer)
+      end
+    end
+    
+    
     case kind
     when :mongrel
     end</diff>
      <filename>lib/appjour.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d0005a0b0f097d058b54569827c467f9125b4d0e</id>
    </parent>
  </parents>
  <author>
    <name>lachie</name>
    <email>lachiec@gmail.com</email>
  </author>
  <url>http://github.com/lachie/appjour/commit/ab1b9eaf41253aa9e6d68e74cebce03b7a64c19a</url>
  <id>ab1b9eaf41253aa9e6d68e74cebce03b7a64c19a</id>
  <committed-date>2008-06-20T06:15:38-07:00</committed-date>
  <authored-date>2008-06-20T06:15:38-07:00</authored-date>
  <message>made appjour guess ports from within a rails app</message>
  <tree>3b3ef3c14893bd227b6c2033fc54b782015e3fe3</tree>
  <committer>
    <name>lachie</name>
    <email>lachiec@gmail.com</email>
  </committer>
</commit>
