I've tried most of the solutions here and they are outdated. I had to combine some ideas from here with my own work. As a result I've created a script to help me do the heavy lifting which you can find here
Usage:
brewv.sh formula_name desired_version