<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,26 +1,19 @@
 #!/usr/bin/env ruby
 #
-#  Created on 2008-2-17.
-#  Copyright (c) 2008-2009 Kevin Rutherford, Rutherford Software Ltd. All rights reserved.
+# Reek examines Ruby source code for smells.
+# Visit http://reek.rubyforge.org/ for docs etc.
+#
+# Author: Kevin Rutherford
 #
 
 require 'reek'
 require 'reek/source'
 require 'reek/options'
 
-sources = Reek::Options.parse(ARGV)
 exitstatus = 0
-sources.each do |src|
-  warnings = src.report
-  next if warnings.empty?
-  if sources.size == 1
-    puts warnings.to_s
-  else
-    puts &quot;\&quot;#{src}\&quot; -- #{warnings.length} warnings:&quot;
-    puts warnings.to_s
-    puts
-  end
+source = Reek::Options.parse(ARGV)
+if source.smelly?
+  puts source.report
   exitstatus = 2
 end
-
 exit(exitstatus)</diff>
      <filename>bin/reek</filename>
    </modified>
    <modified>
      <diff>@@ -45,9 +45,9 @@ EOB
       begin
         @@opts = parse_args(args)
         if ARGV.length &gt; 0
-          return ARGV.map {|arg| Source.from_path(arg)}
+          return Source.from_pathlist(ARGV)
         else
-          return [Source.from_io($stdin, 'stdin')]
+          return Source.from_io($stdin, 'stdin')
         end
       rescue OptionParser::ParseError, SystemCallError =&gt; err
         fatal_error(err)</diff>
      <filename>lib/reek/options.rb</filename>
    </modified>
    <modified>
      <diff>@@ -46,6 +46,15 @@ module Reek
       return new(code, filename, File.dirname(filename))
     end
 
+    #
+    # Factory method: creates a +Source+ object from an array of file paths.
+    # No source code is actually parsed until the report is accessed.
+    #
+    def self.from_pathlist(paths)
+      sources = paths.map {|path| Source.from_path(path) }
+      SourceList.new(sources)
+    end
+
     def initialize(code, desc, dir = '.')     # :nodoc:
       @source = code
       @dir = dir
@@ -82,4 +91,21 @@ module Reek
       @desc
     end
   end
+
+  class SourceList
+    def initialize(sources)
+      @sources = sources
+    end
+
+    def smelly?
+      @sources.any? {|source| source.smelly? }
+    end
+
+    def report
+      @sources.select {|src| src.smelly? }.map do |src|
+        warnings = src.report
+        &quot;\&quot;#{src}\&quot; -- #{warnings.length} warnings:\n#{warnings.to_s}\n&quot;
+      end.join(&quot;\n&quot;)
+    end
+  end
 end</diff>
      <filename>lib/reek/source.rb</filename>
    </modified>
    <modified>
      <diff>@@ -115,6 +115,12 @@ class String
   end
 end
 
+class Array
+  def to_source
+    Reek::Source.from_pathlist(self)
+  end
+end
+
 module Reek
   class Source
     def to_source</diff>
      <filename>lib/reek/spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,10 +5,10 @@ describe 'Reek source code:' do
     it &quot;reports no smells in #{path}&quot; do
       File.new(path).should_not reek
     end
-    it &quot;reports no smells in #{path} via bin/reek&quot; do
-      `ruby -Ilib bin/reek #{path}`.should == ''
-      $?.exitstatus.should == 0
-    end
+  end
+
+  it 'reports no smells via the Dir matcher' do
+    Dir['lib/**/*.rb'].should_not reek
   end
 end
 </diff>
      <filename>spec/integration/reek_source_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,4 @@
 $:.unshift File.dirname(__FILE__) + '/../lib'
-require 'reek'
 
 begin
   require 'spec'
@@ -9,6 +8,7 @@ rescue LoadError
   require 'spec'
 end
 
+require 'reek'
 require 'reek/spec'
 
 Spec::Runner.configure do |config|</diff>
      <filename>spec/spec_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ae2f0c3821a6a6d311ca0411062c64d09cb13c35</id>
    </parent>
  </parents>
  <author>
    <name>Kevin Rutherford</name>
    <email>kevin@rutherford-software.com</email>
  </author>
  <url>http://github.com/kevinrutherford/reek/commit/b775e26264883783b07541280c78697dd378ab0b</url>
  <id>b775e26264883783b07541280c78697dd378ab0b</id>
  <committed-date>2009-03-30T14:06:11-07:00</committed-date>
  <authored-date>2009-03-30T14:06:11-07:00</authored-date>
  <message>Added a 'reek' matcher for Dirs [#32 state:resolved]</message>
  <tree>4e1749d53794f672089df111b587993a3d8c2878</tree>
  <committer>
    <name>Kevin Rutherford</name>
    <email>kevin@rutherford-software.com</email>
  </committer>
</commit>
