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 ?
A Gemfile is a file that is created to describe the gem dependencies required to run a Ruby program. A Gemfile should always be placed in the root of the project directory.
Gemspec is basically the Readme for gems. It tells you about the author, version, summary, description, internal dependencies, execution and everything about the Gem. So now it was easy to use gems as all of them were having their specifications with them.
Pretty much everyone agrees you should check that into git. Including your Gemfile. lock in version control is standard practice if you are writing an application.
A Gemfile describes the gem dependencies required to execute associated Ruby code. Place the Gemfile in the root of the directory containing the associated code. For instance, in a Rails application, place the Gemfile in the same directory as the Rakefile .
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With