Run commands automatically when files change, for Ruby projects
open sourceMITfree
Guard is a Ruby command line tool that watches the file system and runs rules you write in a Guardfile whenever files or directories change: rerun the tests for the file you saved, reload a server, rebuild assets, and the like. File changes come from the Listen gem, it can show desktop notifications, and more than 300 plugins (guard-rspec, guard-minitest, guard-livereload and others) give it ready-made rules. You add it to a project's Gemfile and start it with bundle exec guard. It's MIT-licensed and maintained in the Guard GitHub organization.
Problems it solves
- rerun my RSpec tests automatically when I save a Ruby file
- restart or reload my Ruby app when its code changes
- watch a folder and run a command whenever a file changes
Features
- run rules from a Guardfile when files change
- 300+ plugins such as guard-rspec and guard-livereload
- desktop notifications for results
- file watching through the Listen gem
- guard-bundler plugin installs or updates the gem bundle when the Gemfile or gemspec changes
- guard-minitest plugin reruns Minitest tests when files change
Alternatives
The same job
These do what Guard does.
- watchexec Executes commands in response to file modifications
- Watchman A file watching service that records changes and triggers actions
- entr Run arbitrary commands when files change
- nodemon Restart your Node.js app automatically when files change
- Air Live reload for Go apps
- bacon Background code checker
