I ran into a project that required a running Redis server for the tests and development environment to work. Here’s what I threw into the Guardfile to make sure a Redis server was running during development. It starts a new daemonized redis-server instance with a customizable port number. The executable can be specified in case you need to use a specific installation of Redis.
I’d like to make a real Guard plugin gem out of this but I thought I’d put up what I have since who knows when I’ll get around to that.
Awesome, can’t wait for your guard-redis gem!
You don’t have any persistence with this config. That might be fine for what you’re using redis for. But it wouldn’t be too big of a deal to also toss a few config lines for saving (either aof or a dumpfile) the DB into your tmp dir.
Anyway, this gives me some new ideas for how I ought to be using guard more. 🙂
Please to be forking and improving 🙂
Cool idea. I’ve taken to approaching this by using Foreman to run external processes like Redis because I like the unified color-coded logging, and then I include
bundle exec guard start $([ -n "$GUARDS" ] && echo "-g $GUARDS")at the end of the Procfile.