I highly suggest to use Python for hooks, we have an example script there. Both bash and Ruby are a bit problematic (shell scripting is usually a bit limited, jgrep does not work well with Ruby SCL and you need to reinstall it after upgrade manually).