Is there a way to autoinstall a gem when it is "required" in an .rb file?

say I have:


-----
#!/usr/bin/ruby

require 'rubygems'
require 'HOTP'

puts HOTP.new.calculate_hotp('12345', 1, 6)
-----


Is there a way to make rubygems autoinstall the HOTP gem if it is not 
already installed?