You can pass a Guardfile
content or a Guardfile
location progammatically when calling Guard.setup
. Available options are as follow:
:guardfile
- The path to a validGuardfile
.:guardfile_contents
- A string representing the content of a validGuardfile
.
Remember, without any options given, Guard will look for a Guardfile
in your current directory and if it does not find one, it will look for it in your $HOME
directory.
Guard.run_all
can be used to run all Guard plugins. You can pass a scope to it with the :plugins
/ :plugin
or :groups
/ :group
options. Run Guard plugins, e.g. from a Rakefile:
require 'guard'
require 'guard/commander' # needed because of https://github.com/guard/guard/issues/793
# You can omit the call to Guard.setup, Guard.run_all will call Guard.setup
# under the hood if Guard has not been setuped yet
Guard.run_all group: :features
# or with multiple groups
Guard.run_all groups: [:features, :documentation]
Specify a custom Guardfile
path:
require 'guard'
require 'guard/commander' # needed because of https://github.com/guard/guard/issues/793
Guard.setup(guardfile: '/path/to/Guardfile')
Start Guard and with a Guardfile
as a string:
require 'guard'
require 'guard/commander' # needed because of https://github.com/guard/guard/issues/793
guardfile = <<-EOF
guard 'rspec' do
watch(%r{^spec/.+_spec\.rb$})
end
EOF
# You can omit the call to Guard.setup, Guard.start will call Guard.setup
# under the hood if Guard has not been setuped yet
Guard.start(guardfile_contents: guardfile)
Intro
Installation
- System Notifications
- Terminal Colors on Windows
- Add Readline support to Ruby on Mac OS X
- Which Growl library should I use
- Efficient Filesystem Handling
Getting Started
- List of Guard Commands
- Command Line Options for Guard
- List of available Guards
- Guardfile examples
- Run Guard within RubyMine
- Guardfile-DSL / Configuring-Guard
- Configuration Files
- Interacting with Guard
- Guard Signals
Troubleshooting
Advanced use of Guard
Cookbooks
Development
This wiki and the Guard README document contains a lot of information, please take your time and read these instructions carefully.
If you run into any trouble, you may start by understanding how Guard works.
We provide detailed changes for each Guard release.
Be sure to read the CONTRIBUTING guidelines before reporting a new Guard issue or open a pull request.
If you have any questions about the Guard usage or want to share some information with the Guard community, please go to one of the following places:
- Google+ community
- Google group
- StackOverflow
- IRC channel
#guard
(irc.freenode.net) for chatting