= autowatchr

Fork of viking's autowatchr library (http://github.com/viking/autowatchr) to fix
issues and add features. Provides some autotest-like behavior for
watchr (http://github.com/mynyml/watchr).

== Installation

  gem install harmon-autowatchr

== Current features

* Auto-watches test and lib files using the autotest layout
* Optionally run only failing-tests
* Optionally run entire suite after all tests pass
* Traps INT signal (Control-C) and re-runs all tests.

== Todo

* Cucumber support
* Expose algorithm to map test classes to test files

== Example use

test.watchr
  require 'autowatchr'

  Autowatchr.new(self) do |config|
    config.ruby = 'jruby'
    config.lib_dir = 'leet_lib'
    config.test_dir = 'leet_test'
  end

=== Configuration options
* command
  * An ERB template for the command
  * Default: <tt>"<%= ruby %> -I<%= include %> <% list_of_requires.each { |lib| %>-r<%= lib %> <% } %><%= predicate %>"</tt>
* ruby
  * The ruby executable to use
  * Default: <tt>"ruby"</tt>
* run_method
  * The way the ruby files are "require"-ed.
  * Two options:
    * <tt>:require  => ruby -e "%w[test/first_test.rb test/second_test.rb].each { |file| require file }"</tt>
    * <tt>:load     => ruby -e "%w[test/first_test.rb test/second_test.rb].each { |file| load file }"</tt>
  * Default: <tt>:require</tt>
  * It is advised to use <tt>:load</tt> when running tests in Rails since that is what "rake test" uses.
* include
  * Paths to include (with -I)
  * Default: <tt>".:#{self.lib_dir}:#{self.test_dir}"</tt>
* require
  * Libraries to include (with -r)
  * Can either be a string or an array (Ex: <tt>config.require = %w{rubygems active_support}</tt>)
  * Default: <tt>nil</tt>
* lib_dir
  * The lib path, where your library lives
  * Default: <tt>"lib"</tt>
* test_dir
  * The test path, where your tests live
  * Default: <tt>"test"</tt>
* lib_re
  * The regexp to use for discovering library files
  * Default: <tt>'^%s.*/.*\.rb$' % self.lib_dir</tt>
* test_re
  * The regexp to use for discovering library files
  * Default: <tt>'^%s.*/test_.*\.rb$' % self.test_dir</tt>
* failing_only
  * Run only failing tests the next time a test file is run
  * Default: <tt>true</tt>
* run_suite
  * Run entire test suite after failing tests pass
  * Default: <tt>true</tt>

All of the config options are optional.  You can also pass in a hash instead of a block. Also see: test.watchr[http://github.com/viking/autowatchr/blob/master/test.watchr].

== Copyright

Copyright (c) 2009 Jeremy Stephens. See LICENSE for details.

Many snippets were taken from ZenTest[http://github.com/seattlerb/ZenTest].

== Contributors

* Adam Grant (harmon)