Gems and Bundler
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
GemfileandGemfile.lock - Prefer
bundle execso 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.