Guard: Automatically run Rubocop/RSpec when file modifications

This article describe Guard setup procedure!


Updating Gemfile

Please add some rubygems to ./Gemfile like this:

1
2
3
4
5
group :development do
gem 'guard-rspec', require: false
gem 'guard-rubocop', require: false
gem 'guard-livereload', require: false
end

Setup & Initialize

1
2
3
4
5
# Install added gems
$ bundle install
# Generate configuration
$ bundle exec guard init rspec rubocop livereload

Install Browser extension

You should see “How do I install and use the browser extensions?
and install browser extension to your computer.

LiveReload_Chrome

Execution

After execute the following command, guard run rubocop, rspec, livereload when you changing specific file.

1
$ bundle exec guard

Special Thanks