Gems and Bundler

View saved

Install a gem

Gems are Ruby packages. Try a small utility gem while learning.

gem install colorize

Create a Gemfile

Bundler locks versions for a project.

# Gemfile
source "https://rubygems.org"

gem "colorize"

Install and run with Bundler

From the project folder:

bundle install
bundle exec ruby app.rb

Bundler habits

  • Commit Gemfile and Gemfile.lock
  • Prefer bundle exec so the right gem versions load
  • Do not commit vendored caches unless your team requires it
  • Check rubygems.org for documentation

Comments

One comment per signed-in account. Comments are saved with this page’s URL.