Sometimes you need to make a script for someone but you are not sure what he has on his machine. Is there everything that your script needs? Not to worry. Bundler has a great function called in line.

It provides a gemfile method and before the script is run it downloads and requires all the necessary gems. A little example:

require 'bundler/inline' #require only what you need

#Start the bundler and in it use the syntax you are already familiar with
gemfile(true) do 
  source '<https://rubygems.org>'
        gem 'nokogiri', '~> 1.6.8.1'
        gem 'ruby-graphviz'
end