Reputation: 3594
Cant figure out where rails gem must specify its dependencies? In Gemfile on in gemspec? The generated Gemfile has these description:
# Declare your gem's dependencies in malibu.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec
# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.
But I still can understand. Can you help me? My thanks
Upvotes: 4
Views: 634
Reputation: 7434
If you are developing a new gem, then you'll want to declare all of your production-ready gems in the .gemspec using add_dependency
.
As for the Gemfile itself, as the comment states, it is used for adding dependencies which are still in development (i.e. not released). For example, if you want to use the latest edge version of Rails, you'd have to specify that dependency with the git
or github
option (e.g. gem "rails", github: "rails/rails"
). These options are only available in the Gemfile, not the .gemspec.
In general you want to always put your dependencies in the .gemspec and only use the Gemfile if you need to.
Upvotes: 5