RubyGems building system is “cool stuff”. All gems information is stored in a single gemspec file which simplifies gem maintenance. Dependencies can be divided into development (for testing/debugging) and runtime dependencies:

# my_gem.gemspec do |s|
  # ...
  s.add_development_dependency 'bundler'
  s.add_development_dependency 'minitest'
  s.add_runtime_dependency 'rake', '~> 10.0'

To install development dependencies use either one:

$ bundle --with=development
$ gem install --development

It’s considered good practice to declare all dependencies in the gemspec file. Then load them in Gemfile with the gemspec method:

# Gemfile
source ''

Another useful command is:

$ ruby -e "puts (Gem::Specification.instance_methods - Object.instance_methods).sort"

which prints a list of gem methods (including add_runtime_dependency used above).