Bundler makes sure that Ruby can find all of the gems in the
Gemfile (and all of their dependencies).
For another kind of application (such as a Sinatra application/Ruby app), you will need to set up bundler before trying to require any gems. At the top of the first file that your application loads , put the following code:
require "rubygems" require "bundler/setup"
This will automatically discover your
Gemfile, and make all of the gems in your
Gemfile available to Ruby (in technical terms, it puts the gems “on the load path”). You can think of it as an adding some extra powers to
Now that your code is available to Ruby, you can require the gems that you need. For instance, you can
require "nokogiri". If you have a lot of dependencies, you might want to say “require all of the gems in my
Gemfile“. To do this, put the following code immediately following