Ruby Language Gem Usage Bundler/inline (bundler v1.10 and later)


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 ''
        gem 'nokogiri', '~>'
        gem 'ruby-graphviz'