Manasi Salvi

Difference between a .gemspec file and a gemfile

What are the .gemspec and gemfiles?

Gemfile

When developing an app it is important to declare which version of a gem to use and to declare the dependency of the app on that particular gem - This is specified in the gemfile (for example in a Rails app) so the bundler tool knows exactly where to look for the gem.

.gemspec file

The .gemspec file contains all the necessary information for a Gem. It contains a list of dependencies including information about where to find them.

A break down of what each of these .gemspec attributes is as follows:

There are further gemspec attributes you can use which can be found RubyGems.org. Another resource I found helpful in getting my head around this was Yehuda Katz’s blog post on this topic found here.


comments powered by Disqus