<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>.gitignore</filename>
    </added>
    <added>
      <filename>autotest-growl.gemspec</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -73,6 +73,16 @@ All tests have passed&quot;, add the following to your ~/.autotest:
 
   Autotest::Growl::clear_before_run = false
 
+=== Wrap the message on commas
+
+  Autotest::Growl::wrap_lines = true
+
+=== Try and make the message a little more readable
+
+Setting this true sets wrap_lines to false as they don't play nice together
+
+  Autotest::Growl::pretty_print = true
+
 == TROUBLESHOOTING:
 
 === Missing Cucumber Notifications</diff>
      <filename>README.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -1,27 +1,29 @@
-require 'rubygems' unless ENV['NO_RUBYGEMS']
-%w[rake rake/clean fileutils newgem rubigen].each { |f| require f }
-require File.dirname(__FILE__) + '/lib/autotest/growl'
-
-$hoe = Hoe.new('autotest-growl', Autotest::Growl::VERSION) do |p|
-  p.developer('Sven Schwyn', 'ruby@bitcetera.com')
-  p.summary              = %q{Next generation Growl notification support for ZenTest's autotest.}
-  p.description          = %q{This gem aims to improve support for Growl notification by ZenTest's autotest. It comes with a nice colored Ruby icon set and - for now - supports Cucumber by means of a workaround.}
-  p.url                  = %q{http://www.bitcetera.com/products/autotest-growl}
-  p.changes              = p.paragraphs_of(&quot;History.txt&quot;, 0..1).join(&quot;\n\n&quot;)
-  p.post_install_message = File.read('PostInstall.txt')
-  p.rubyforge_name       = p.name
-  p.extra_deps         = [
-    ['ZenTest','&gt;= 4.0.0'],
-  ]
-  p.extra_dev_deps = [
-    ['newgem', &quot;&gt;= #{::Newgem::VERSION}&quot;]
-  ]
-
-  p.clean_globs |= %w[**/.DS_Store tmp *.log]
-  path = (p.rubyforge_name == p.name) ? p.rubyforge_name : &quot;\#{p.rubyforge_name}/\#{p.name}&quot;
-  p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
-  p.rsync_args = '-av --delete --ignore-errors'
-end
-
-require 'newgem/tasks'
-Dir['tasks/**/*.rake'].each { |t| load t }
+require 'rubygems' unless ENV['NO_RUBYGEMS']
+%w[rake rake/clean fileutils newgem rubigen].each { |f| require f }
+require File.dirname(__FILE__) + '/lib/autotest/growl'
+
+$hoe = Hoe.new('autotest-growl', Autotest::Growl::VERSION) do |p|
+  p.developer('Sven Schwyn', 'ruby@bitcetera.com')
+  p.summary              = %q{Next generation Growl notification support for ZenTest's autotest.}
+  p.description          = %q{This gem aims to improve support for Growl notification by ZenTest's autotest. It comes with a nice colored Ruby icon set and - for now - supports Cucumber by means of a workaround.}
+  p.url                  = %q{http://www.bitcetera.com/products/autotest-growl}
+  p.changes              = p.paragraphs_of(&quot;History.txt&quot;, 0..1).join(&quot;\n\n&quot;)
+  p.post_install_message = File.read('PostInstall.txt')
+  p.rubyforge_name       = p.name
+  p.extra_deps         = [
+    ['ZenTest','&gt;= 4.0.0'],
+  ]
+  p.extra_dev_deps = [
+    ['newgem', &quot;&gt;= #{::Newgem::VERSION}&quot;]
+  ]
+
+  p.clean_globs |= %w[**/.DS_Store tmp *.log]
+  path = (p.rubyforge_name == p.name) ? p.rubyforge_name : &quot;\#{p.rubyforge_name}/\#{p.name}&quot;
+  p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
+  p.rsync_args = '-av --delete --ignore-errors'
+end
+
+require 'newgem/tasks'
+Dir['tasks/**/*.rake'].each { |t| load t }
+
+task :default =&gt; [:spec]</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,8 @@ require 'rubygems'
 require 'autotest'
 
 $:.unshift(File.dirname(__FILE__)) unless
-  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
+  $:.include?(File.dirname(__FILE__)) ||
+    $:.include?(File.expand_path(File.dirname(__FILE__)))
 
 ##
 # Autotest::Growl
@@ -14,93 +15,112 @@ $:.unshift(File.dirname(__FILE__)) unless
 # == SYNOPSIS:
 # ~/.autotest
 #   require 'autotest/growl'
-module Autotest::Growl
+class Autotest
+  class Growl
 
-  VERSION  = '0.1.1'
-  GEM_PATH = File.expand_path(File.join(File.dirname(__FILE__), '../..'))
+    VERSION  = '0.1.2'
+    GEM_PATH = File.expand_path(File.join(File.dirname(__FILE__), '../..'))
 
-  @@remote_notification = false
-  @@hide_label = false
-  @@clear_term = true
+    @label = ''
+    @run_scenarios = false
+    @@remote_notification = false
+    @@hide_label = false
+    @@clear_term = true
+    @@wrap_lines = false
+    @@pretty_print = false
 
-  ##
-  # Whether to use remote or local notificaton (default).
-  def self.remote_notification=(boolean)
-    @@remote_notification = boolean
-  end
+    ##
+    # Whether to use remote or local notificaton (default).
+    def self.remote_notification=(boolean)
+      @@remote_notification = boolean
+    end
 
-  ##
-  # Whether to display the label (default) or not.
-  def self.hide_label=(boolean)
-    @@hide_label = boolean
-  end
+    ##
+    # Whether to display the label (default) or not.
+    def self.hide_label=(boolean)
+      @@hide_label = boolean
+    end
 
-  ##
-  # Whether to clear the terminal before each run (default) or not.
-  def self.clear_before_run=(boolean)
-    @@clear_term = boolean
-  end
+    ##
+    # Whether to clear the terminal before each run (default) or not.
+    def self.clear_before_run=(boolean)
+      @@clear_term = boolean
+    end
 
-  ##
-  # Display a message through Growl.
-  def self.growl title, message, icon, priority=0, stick=&quot;&quot;
-    growl = File.join(GEM_PATH, 'growl', 'growlnotify')
-    image = File.join(ENV['HOME'], '.autotest-growl', &quot;#{icon}.png&quot;)
-    image = File.join(GEM_PATH, 'img', &quot;#{icon}.png&quot;) unless File.exists?(image)
-    if @@remote_notification
-      system &quot;#{growl} -H localhost -n autotest --image '#{image}' -p #{priority} -m #{message.inspect} '#{title}' #{stick}&quot;
-    else
-      system &quot;#{growl} -n autotest --image '#{image}' -p #{priority} -m #{message.inspect} '#{title}' #{stick}&quot;
+    ##
+    # Whether to wrap the message at the commas or not (default).
+    def self.wrap_lines=(boolean)
+      @@wrap_lines = boolean
     end
-  end
 
-  ##
-  # Set the label and clear the terminal.
-  Autotest.add_hook :run_command do
-    @label = (@@hide_label) ? ('') : (File.basename(Dir.pwd).upcase + ': ')
-    @run_scenarios = false
-    print &quot;\n&quot;*2 + '-'*80 + &quot;\n&quot;*2
-    print &quot;\e[2J\e[f&quot; if @@clear_term # clear the terminal
-    false
-  end
+    ##
+    # Whether to try and make a more readable format or not (default).
+    def self.pretty_print=(boolean)
+      @@pretty_print = boolean
+    end
+
+    def self.pretty_print(msg)
+      out = ''
+      msg.split(/,\s?/).each do |line|
+        matches = line.match(/(\d+)\s(\w+)/)
+        str = &quot;#{matches[1].rjust(6)} #{matches[2]}\n&quot;
+        out &lt;&lt; str
+      end
+      out
+    end
+
+    ##
+    # Display a message through Growl.
+    def self.growl title, message, icon, priority=0, stick=&quot;&quot;
+      growl = File.join(GEM_PATH, 'growl', 'growlnotify')
+      image = File.join(ENV['HOME'], '.autotest-growl', &quot;#{icon}.png&quot;)
+      image = File.join(GEM_PATH, 'img', &quot;#{icon}.png&quot;) unless File.exists?(image)
+      message = message.gsub(/,\s?/, &quot;\n&quot;) if @@wrap_lines &amp;&amp; !@@pretty_print
+      message = pretty_print(message) if @@pretty_print
 
-  ##
-  # Parse the test results and send them to Growl.
-  Autotest.add_hook :ran_command do |autotest|
-    gist = autotest.results.grep(/\d+\s+(example|test)s?/).map {|s| s.gsub(/(\e.*?m|\n)/, '') }.join(&quot; / &quot;)
-    if gist == ''
-      growl @label + 'Cannot run tests.', '', 'error', 2
-    else
-      if gist =~ /[1-9]\d*\s+(failure|error)/
-        growl @label + 'Some tests have failed.', gist, 'failed', 2
-      elsif gist =~ /pending/
-        growl @label + 'Some tests are pending.', gist, 'pending', -1
-        @run_scenarios = true
+      if @@remote_notification
+        system &quot;#{growl} -H localhost -n autotest --image '#{image}' -p #{priority} -m \&quot;#{message}\&quot; '#{title}' #{stick}&quot;
       else
-        growl @label + 'All tests have passed.', gist, 'passed', -2
-        @run_scenarios = true
+        system &quot;#{growl} -n autotest --image '#{image}' -p #{priority} -m \&quot;#{message}\&quot; '#{title}' #{stick}&quot;
       end
     end
-    false
-  end
 
-  # FIXME: This is a temporary workaround until Cucumber is properly integrated!
-  Autotest.add_hook :waiting do |autotest|
-    if @run_scenarios &amp;&amp; autotest.results.grep(/cucumber/)
-      gist = autotest.results.grep(/\d+\s+(scenario|step)s?/).map {|s| s.gsub(/(\e.*?m|\n)/, '') }.join(&quot; / &quot;)
+    ##
+    # Set the label and clear the terminal.
+    Autotest.add_hook :run_command do
+      @label = (@@hide_label) ? ('') : (File.basename(Dir.pwd).upcase + ': ')
+      @run_scenarios = false
+      print &quot;\n&quot;*2 + '-'*80 + &quot;\n&quot;*2
+      print &quot;\e[2J\e[f&quot; if @@clear_term # clear the terminal
+      false
+    end
+
+    ##
+    # Parse the test results and send them to Growl.
+    Autotest.add_hook :ran_command do |autotest|
+      gist = autotest.results.grep(/\d+\s+(example|test|scenario|step)s?/).map {|s|
+        s.gsub(/(\e.*?m|\n)/, '')
+      }.join(&quot; / &quot;)
+
       if gist == ''
-        growl @label + 'Cannot run scenarios.', '', 'error', 2
+        growl @label + 'Cannot run specs/tests/scenarios', '', 'error', 2
       else
-        if gist =~ /failed/
-          growl @label + 'Some scenarios have failed.', gist, 'failed', 2
-        elsif gist =~ /undefined/
-          growl @label + 'Some scenarios are undefined.', gist, 'pending', -1
-        else
-          growl @label + 'All scenarios have passed.', gist, 'passed', -2
+        case gist
+          when /[1-9]\d*\s+(failure|error)/
+            growl @label + 'Tests failed', gist, 'failed', 2
+          when /pending/
+            growl @label + 'Tests pending', gist, 'pending', -1
+          when /failed/
+            growl @label + 'Scenarios failed', gist, 'failed', 2
+          when /undefined/
+            growl @label + 'Scenarios undefined', gist, 'pending', -1
+          when /scenario|step/
+            growl @label + 'Scenarios passed', gist, 'passed', -2
+          else
+            growl @label + 'Tests passed', gist, 'passed', -2
         end
       end
+      false
     end
-    false
   end
-
 end</diff>
      <filename>lib/autotest/growl.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1 +1,62 @@
 require File.dirname(__FILE__) + '/spec_helper.rb'
+
+describe &quot;handling results&quot; do
+  before do
+    @at = Autotest.new
+    @atg = Autotest::Growl
+  end
+
+  describe &quot;for Rspec&quot; do
+    it &quot;should show a passing growl&quot; do
+      Autotest::Growl.should_receive(:growl).and_return('passed')
+      @at.results = [&quot;10 examples, 0 failures&quot;]
+      @at.hook(:ran_command)
+    end
+
+    it &quot;should show a failing growl&quot; do
+      Autotest::Growl.should_receive(:growl).and_return('passed')
+      @at.results = [&quot;10 examples, 1 failures&quot;]
+      @at.hook(:ran_command)
+    end
+
+    it &quot;should show a pending growl&quot; do
+      Autotest::Growl.should_receive(:growl).and_return('passed')
+      @at.results = [&quot;10 examples, 0 failures, 1 pending&quot;]
+      @at.hook(:ran_command)
+    end
+  end
+
+  describe &quot;for Cucumber&quot; do
+    # not sure what cucumber output looks like
+    # it &quot;should show a passing growl&quot; do
+    #   @at.results = [&quot;10 examples, 0 failures&quot;]
+    #   @at.hook(:ran_command)
+    # end
+    #
+    # it &quot;should show a failing growl&quot; do
+    #   @at.results = [&quot;10 examples, 1 failures&quot;]
+    #   @at.hook(:ran_command)
+    # end
+    #
+    # it &quot;should show a pending growl&quot; do
+    #   @at.results = [&quot;10 examples, 0 failures, 1 pending&quot;]
+    #   @at.hook(:ran_command)
+    # end
+  end
+
+  describe &quot;for Test::Unit&quot; do
+    it &quot;should show a passing growl&quot; do
+      Autotest::Growl.should_receive(:growl).and_return('passed')
+      @at.results = [&quot;1 tests, 1 assertions, 0 failures, 0 errors&quot;]
+      @at.hook(:ran_command)
+    end
+
+    it &quot;should show a failing growl&quot; do
+      Autotest::Growl.should_receive(:growl).twice.and_return('passed')
+      @at.results = [&quot;1 tests, 1 assertions, 1 failures, 0 errors&quot;]
+      @at.hook(:ran_command)
+      @at.results = [&quot;1 tests, 1 assertions, 0 failures, 1 errors&quot;]
+      @at.hook(:ran_command)
+    end
+  end
+end</diff>
      <filename>spec/autotest-growl_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,4 +7,13 @@ rescue LoadError
 end
 
 $:.unshift(File.dirname(__FILE__) + '/../lib')
-require 'autotest-growl'
+
+require 'autotest/growl'
+
+class Autotest
+  class Growl
+    def self.growl(title, message, icon, priority=0, stick=&quot;&quot;)
+      icon
+    end
+  end
+end</diff>
      <filename>spec/spec_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>20b51b38be4087ff76895fddfe6f7fee13efafed</id>
    </parent>
  </parents>
  <author>
    <name>Michael Moen</name>
    <email>michael@underpantsgnome.com</email>
  </author>
  <url>http://github.com/UnderpantsGnome/autotest-growl/commit/963e71c010415862e8fb671eeb1784e791adfa9c</url>
  <id>963e71c010415862e8fb671eeb1784e791adfa9c</id>
  <committed-date>2009-06-02T12:15:57-07:00</committed-date>
  <authored-date>2009-06-02T12:15:57-07:00</authored-date>
  <message>add a couple more config options. write some specs to test autotest output parsing</message>
  <tree>543874871bcb32f1aa7620dc9a6d85c573a6f2e1</tree>
  <committer>
    <name>Michael Moen</name>
    <email>michael@underpantsgnome.com</email>
  </committer>
</commit>
