Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Modern continuous testing (flexible alternative to Autotest)

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
lib
test
.gitignore
LICENSE
README.rdoc
Rakefile
TODO.txt
rdoc.watchr
specs.watchr
watchr.gemspec
yard.watchr

README.rdoc

Summary

Agile development tool that monitors a directory recursively, and triggers a user defined action whenever an observed file is modified. Its most typical use is continious testing, and as such it is a more flexible alternative to autotest.

Features

  • Ridiculously simple to use

  • web framework agnostic (rails, merb, sinatra, camping, invisible, …)

  • test framework agnostic (test/unit, minitest, rspec, test/spec, expectations, …)

  • ruby interpreter agnostic (ruby1.8, ruby1.9, MRI, JRuby, …)

  • package framework agnostic (rubygems, rip, …)

  • Low level / highly flexible

Usage

On the command line,

$ watchr path/to/script.file

will monitor all files from within the current directory and below it recursively, and react to events on those files in accordance with the script.

Scripts

The script contains a set of simple rules that map observed files to an action. Its DSL is a single method: watch(pattern, &action)

watch( 'a regexp pattern matching paths to observe' )  {|match_data_object| command_to_run }

So for example,

watch( 'test/test_.*\.rb' )  {|md| system("ruby #{md[0]}") }

will match test files and run them whenever they are modified.

A continious testing script for a basic project could be

watch( 'test/test_.*\.rb' )  {|md| system("ruby #{md[0]}") }
watch( 'lib/(.*)\.rb' )      {|md| system("ruby test/test_#{md[1]}.rb") }

which, in addition to running any saved test file as above, will also run a lib file's associated test. This mimics the equivalent autotest behaviour.

It's easy to see why watchr is so flexible, since the whole command is custom. And remember the scripts are pure ruby, so feel free to add methods, Signal#trap calls, etc.

The wiki has more details and examples.

Install

gem install mynyml-watchr --source http://gems.github.com/

See Also

redgreen

Standalone redgreen eye candy for test results, ala autotest.

phocus

Run focused tests when running the whole file/suite is unnecessary.

Links

source

github.com/mynyml/watchr

rdocs

docs.github.com/mynyml/watchr

wiki

wiki.github.com/mynyml/watchr

Something went wrong with that request. Please try again.