The vagrant-notify plugin replaces the Linux notify-send
command in your Vagrant VM with a Ruby script that forwards notifcations to the host machine. You can
use it to invoke unicornleap when your specs pass. (Or, you know,
whenever).
From the host machine, install vagrant-notify:
$ vagrant plugin install vagrant-notify
The notify-send
utility is not included in OS X. By faking it with a shell script of the same name somewhere
on your $PATH
,you can make it run unicornleap. I put it in my ~/.bin
directory.
#! /bin/bash
unicornleap -s 1.618
Check that ~/.bin
(or wherever you put the script) is on your $PATH
with
$ echo $PATH
If not, add it in your .bashrc.
Add a function to your .bashrc in the guest machine:
function specs() {
if [ -n "$1" ]; then
bundle exec rspec "$1" && notify-send
else
bundle exec rspec && notify-send
fi
}
Now run
$ specs
or
$ specs path/to/spec.rb
Passing specs will invoke notify-send
and call unicornleap on the host machine.