问题
Whenever developing gems, I don't see any reasons why Gemfile is not directly inspected for dependencies.
Indeed, why use a .gemspec file in order to list them ? Is there a real benefit ?
回答1:
Well that's because the Gemfile isn't a file from Rubygems, but a file from Bundler. So the Rubygem developers would have to extend their used files in order to support Gemfile. Since there already is the .gemspec file, there is no valid reason why they should. (there are enough gems which do well without a Gemfile)
In fact, it is recommended to use this as the only contents of the Gemfile of gems:
source 'https://rubygems.org'
gemspec
It will instruct bundler to use the .gemspec file as the authorative source of gems.
来源:https://stackoverflow.com/questions/11301000/why-use-gemspec-gemfile-when-checking-for-dependencies