Guard::Redis
Redis guard manages your development Redis server, and will
automatically restart if necessary.
The code for this gem was taken from this blog post by
Avdi Grimm. It
refers to this Gist, and I searched around
for an existing repo quite a bit before packing it up here. All credit goes
to Avdi for the source and all fault goes to me for configuration or packaging
issues.
Install
Make sure you have Guard installed before
continuing.
Install the gem:
$ gem install guard-redis
Add it to your Gemfile. You should really only need it in development and test
environments; this gem is not meant to manage production server instances of
Redis.
gem 'guard-redis'
Add the guard definition to your Guardfile by running:
$ guard init redis
Options
The main purpose of Guard::Redis is to ensure that redis-server is running while
you're coding and testing. It can optionally monitor a set of files and reload
the process (useful if you're frequently changing code that affects the
configuration of Redis).
It takes several options related to its configuration.
List of available options
:executable => "/path/to/redis-server/executable"
:port => 9999
:pidfile => "/var/pid/redis.pid"
:reload_on_change => false
:capture_logging => true
:logfile => "log/redis_#{port}.log"
:shutdown_retries => 3
:shutdown_wait => 5
Pidfile location must be writable
Starting with version 2.0.0, the pidfile location you specify or the default
location (/tmp/redis.pid
) if you don't specify must be writable or
guard-redis will fail to start.
If you specify a pidfile location via the configuration and the directory path
doesn't exist, guard-redis will attempt to create it. If it cannot write to that
directory, you will see an error and redis will fail to start.
Contributors
Thanks so much to all who have contributed!