mardi 5 juillet 2016

Can't disable Guard visual notifications for Rails project

Whenever I run a test in my Rails project, Guard activates one of its many ‘visual notification’ features and changes the background of my tmux status bar (green for passing, red for failing, and just on the lefthand side).

Before:

Original tmux status bar colors

After:

tmux ‘notification’ status bar colors

After a little bit of digging (i.e., finding this previously asked question), I discovered that this was a feature of Guard rather than a bug, so I set out to fix the configuration. According to this official documentation,

The Guardfile DSL is evaluated as plain Ruby, so you can use normal Ruby code in your Guardfile (and your ~/.guard.rb file which is evaluated first if it exists).

and, importantly,

Notifications can also be turned off in the Guardfile, in addition to setting the environment variable GUARD_NOTIFY or using the cli switch -n:

notification :off

NOTE: since notification is more of a user setting, it's best to have each team member set this in their own ~/.guard.rb file (instead of the project Guardfile).

So, I created a one-line ~/.guard.rb and Guardfile in the project root, consisting solely of the line notification :off, but the problem still persists. What else do I have to do to make Guard see its own config file?

Notes

I'm following Michael Hartl's Ruby on Rails Tutorial. This is the Gemfile, as he's specified it. It uses Minitest. No idea if that matters.

Aucun commentaire:

Enregistrer un commentaire