title: Install gem on demand
body: <p>I would like to install a gem (JSON) on the client side, but only if hasn't been installed already (some 1.9 Ruby distros have JSON bundled).</p>
  
  <p>I couldn't find a clue on how to do that from <code>gem help install</code>. And running <code>gem install json</code> on a Windows system with Ruby 1.9 installed (with JSON bundled) results in </p>
  
  <pre><code>    ERROR:  Error installing json:
      The 'json' native gem requires installed build tools.
  </code></pre>
  
  <p>-- it tries to install it <em>ignoring</em> the fact that the gem is already there.</p>
  
  <p>And I can't do bash tricks like grepping <code>gem list</code> output because the client might be Windows.</p>
  
  <p>So what's the multiplatform way of installing a gem only if it's not present in the system already?</p>