<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -8,9 +8,9 @@ Mailtrap is a mock SMTP server for use in Rails development.
 
 Mailtrap waits on your choosen port for a client to connect and talks _just enough_ SMTP protocol for ActionMailer to successfully deliver its message.
 
-Mailtrap makes *no* attempt to actually deliver messages and, instead, writes them into sequentially numbered files on disk (hence the name 	Mail_trap_).
+Mailtrap makes *no* attempt to actually deliver messages and, instead, writes them into a file (hence the name 	Mail_trap_). Handy tip: use tail -f to see emails being received.
 
-You can configure the hostname (default: localhost) and port (default: 2525) for the server and also where the messages get written (default: /var/tmp). Messages will get written to files named smtp0001.msg, smtp0002.msg, and so on.
+You can configure the hostname (default: localhost) and port (default: 2525) for the server and also where the messages get written (default: /var/tmp/mailtrap.log).
 	
 == FEATURES/PROBLEMS:
 
@@ -21,17 +21,30 @@ You can configure the hostname (default: localhost) and port (default: 2525) for
 
 == SYNOPSIS:
 
+To use the defaults host:localhost, port:2525, file:/var/log/mailtrap.log
+
+* mailtrap start
+
+Customise startup:
+
+* sudo mailtrap start --host my.host --port 25 --once --file=/var/log/messages.txt
+
+(sudo because you want to use restricted port 25)
+
+For more info:
+
 * mailtrap --help (to see Daemonization options)
 * mailtrap start --help (to see Mailtrap options)
 
-* mailtrap start --host localhost --port 8025 --once --msgdir=/var/tmp
-
 == REQUIREMENTS:
 
-* Rubygems
+* Hoe rubygem
+* Rubygems rubygem
 * Daemons rubygem
 * Trollop rubygem
 
+All these are automatically installed if you use gem install -y
+
 == INSTALL:
 
 * sudo gem install -y mailtrap</diff>
      <filename>README.txt</filename>
    </modified>
    <modified>
      <diff>@@ -4,7 +4,7 @@ require 'rubygems'
 require 'hoe'
 require './lib/mailtrap.rb'
 
-Hoe.new('mailtrap', Mailtrap::VERSION) do |p|
+Hoe.new('mailtrap', Mailtrap::VERSION ) do |p|
   p.rubyforge_name = 'rubymatt'
   p.author = 'Matt Mower'
   p.email = 'self@mattmower.com'</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -11,7 +11,7 @@ opts = Trollop::options do
   opt :host, &quot;The host SMTP clients will connect to&quot;, :default =&gt; 'localhost'
   opt :port, &quot;The port SMTP clients will connect to&quot;, :default =&gt; 2525
   opt :once, &quot;Whether to terminate after serving the first client&quot;, :default =&gt; false
-  opt :msgdir, &quot;Where messages get stored&quot;, :default =&gt; &quot;/var/tmp&quot;
+  opt :file, &quot;File where messages get written&quot;, :default =&gt; &quot;/var/tmp/mailtrap.log&quot;
 end
 
 options = {
@@ -24,5 +24,5 @@ options = {
 }
 
 Daemons.run_proc( 'mailtrap', options ) do
-  Mailtrap.new( opts[:host], opts[:port], opts[:once], opts[:msgdir] )
+  Mailtrap.new( opts[:host], opts[:port], opts[:once], opts[:file] )
 end
\ No newline at end of file</diff>
      <filename>bin/mailtrap</filename>
    </modified>
    <modified>
      <diff>@@ -10,18 +10,21 @@ require 'trollop'
 # for them to deliver a message which it writes to disk.
 #
 class Mailtrap
-  VERSION = '0.1.0'
+  VERSION = '0.2.1'
   
   # Create a new Mailtrap on the specified host:port. If once it true it
   # will listen for one message then exit. Specify the msgdir where messages
   # are written.
-  def initialize( host, port, once, msgdir )
+  def initialize( host, port, once, msgfile )
     @host = host
     @port = port
     @once = once
-    @msgdir = msgdir
+    @msgfile = msgfile
+    
+    File.open( @msgfile, &quot;a&quot; ) do |file|
+      file.puts &quot;\n* Mailtrap started at #{@host}:#{port}\n&quot;
+    end
     
-    puts &quot;Mailtrap starting at #{@host}:#{port} and writing to #{@msgdir}&quot;
     service = TCPServer.new( @host, @port )
     accept( service )
   end
@@ -57,20 +60,14 @@ class Mailtrap
     from.gsub!( /MAIL FROM:\s*/, &quot;&quot; )
     to_list = to_list.map { |to| to.gsub( /RCPT TO:\s*/, &quot;&quot; ) }
     
-    # Figure out what the file name should be
-    n = 1
-    Dir.chdir( @msgdir ) do
-      files = Dir.glob( &quot;smtp*.msg&quot; )
-      if files.length &gt; 0
-        n = 1 + Integer( files.last.gsub( /smtp(\d+)\.msg/, '\1' ) )
-      end
-    end
-        
-    File.open( File.join( @msgdir, &quot;smtp%04d.msg&quot; % n ), &quot;w&quot; ) do |file|
+    # Append to the end of the messages file
+    File.open( @msgfile, &quot;a&quot; ) do |file|
+      file.puts &quot;* Message begins&quot;
       file.puts &quot;From: #{from}&quot;
       file.puts &quot;To: #{to_list.join(&quot;, &quot;)}&quot;
       file.puts &quot;Body:&quot;
       file.puts message
+      file.puts &quot;\n* Message ends&quot;
     end
 
   end</diff>
      <filename>lib/mailtrap.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>9b50b902fe4ffff7b40501b54ad53d5eccf072f8</id>
    </parent>
  </parents>
  <author>
    <name>Matt Mower</name>
    <email>self@mattmower.com</email>
  </author>
  <url>http://github.com/mmower/mailtrap/commit/81e1f294a3ec56b4aa1103d472d411a2b5fd4507</url>
  <id>81e1f294a3ec56b4aa1103d472d411a2b5fd4507</id>
  <committed-date>2008-03-26T14:15:21-07:00</committed-date>
  <authored-date>2008-03-26T14:15:21-07:00</authored-date>
  <message>Committing Mailtrap 0.2.1 to Git</message>
  <tree>ac18e6b786b04e2649b7182a0aa1fb1dfe4a64bd</tree>
  <committer>
    <name>Matt Mower</name>
    <email>self@mattmower.com</email>
  </committer>
</commit>
