Skip to content

Instantly share code, notes, and snippets.

@MasahiroSakoda
Created January 16, 2014 01:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MasahiroSakoda/8448164 to your computer and use it in GitHub Desktop.
Save MasahiroSakoda/8448164 to your computer and use it in GitHub Desktop.
Guard tutorial

Guard is CLI tool to handle events on filesystem modifications

Getting Started

Installation

install with gemfiile

group :development do
  gem 'guard'
end

If you using Mac, add following code

  gem 'rb-fsevent'

Guardfile

Guardfile is configuration file for handle FileSystem events. To generate Guardfile, execute following command on project root

bundle exec guard init

To surveillance file, use watch method like this (using RSpec plugin)

guard :rspec do
  watch(%r{^spec/.+_spec\.rb$})
end

Plugins

You can find more than 220 plugins in following URL https://rubygems.org/search?query=guard-

  • guard-rspec

    • plugin for run spec test
  • guard-jasmine

    • plugin for run jasmine BDD test
  • guard-rails

    • plugin for rails restarting
  • guard-shell

    • plugin for run shell script
  • guard-coffeescript

    • plugin for run coffee command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment