The Ruby programming language allows you to manage #key# project dependencies: also called gems #key# using the gem command. This gem command is very useful for distributing programs and libraries, such as the famous Ruby on Rails.

Gemfile is the core of a file the specifies the source of the packages, the packages, and the versions.

Take a look at the following example:

We have just created a project that only requires one library at version 1.2.

Bundler

Bundler helps us with gem management. It create a Gemfile.lock file that can store more information about our project, such as:

  • platform architecture
  • bundler version
  • gemfile source
  • other information that can help when we need to replicate our environment

We can install it using:

$ gem install bundler

We just need to create our Gemfile (as shown above) and run:

$ bundle install

This command will generate our Gemfile.lock file. Now, we can be sure that our dependencies are present in development, staging, and production.