title: upgrade or install a homebrew formula
body: <p>In my CI-setup, i would like to make sure that the newest version of a given formula is installed, regardless of whether it is already installed or not.</p>
  
  <p>i'm currently using something like:</p>
  
  <pre><code>brew update
  brew install FORMULA || (brew upgrade FORMULA &amp;&amp; brew cleanup FORMULA)
  </code></pre>
  
  <p>What are the pitfalls with that approach? Is there a nicer approach to the problem (e.g. by first querying whether FORMULA is already installed, rather than relying on <code>brew install</code> to fail only if FORMULA is installed)?</p>