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:
- spec.name: This is the gem’s name.
- spec.version: The gem’s version.
- spec.authors: The developer(s) name.
- spec.email: The developer(s) email.
- spec.summary: A short description of the gem.
- spec.description: A longer description of the gem.
- spec.homepage: The domain name of the gem.
- spec.license: The license for the gem.
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