- Add these gems to your
Gemfile
:
group :development do
gem 'guard'
gem 'guard-shell'
end
-
Install it by running
bundle install
. -
Create a
Guardfile
containing:
# frozen_string_literal: true
clearing :on
guard :shell do
watch(%r{(?:lib|test)/(.*)\.rb}) { |_m| `bundle exec rake test` }
end
- Create the following entry in a
Makefile
:
.PHONY: guard
guard:
@bundle exec guard
- Run it when doing development:
make guard
- Enjoy auto-executing tests and tasks!