RubyGems provides two main types of dependencies: runtime and development.
When you specify development dependencies, another developer can run
gem install --dev your_gem
and RubyGems will grab both sets of dependencies (runtime and development).
Typical development dependencies include test frameworks (like rspec
) and build systems
(like rake
).
gemspec
is easy.
Just use add_runtime_dependency
and add_development_dependency
:
Gem::Specification.new do |s| s.name = "hola" s.version = "2.0.0" s.add_runtime_dependency "daemons", ["= 1.1.0"] s.add_development_dependency "bourne", [">= 0"]
Gemfile
we can also specify groups.
Each gem may specify membership in one or more groups.
Any gem that does not specify membership in any group is placed in the
default group.
gem "rspec", :group => :test gem "wirble", :groups => [:development, :test]
then we can run bundle install --without development test
to omit some groups.