Reputation: 170
After combing through Google I know what goes in a gemspec file for my project, but I have no clue as to why we need it, I guess I'm looking for a practical definition.
(Currently working through Learn Ruby the Hard Way by Zed Shaw, this was one of the study questions)
Upvotes: 10
Views: 9203
Reputation: 1975
If you have come through a Python background, you would see gemspec file very similar to setup.py file. Actually, both have the same purpose which is to build, install, and distribute Python packages/Ruby packages (gems).
The simple definition is each programming language has packages and your project relies on it. But, in turn, these packages have come from somewhere and someone. Those who write those packages will have to define gemspec file in order to distribute for other developers or community to use it.
In a nutshell, gemspec file bundles a project into a package.
Note: If you don't want to distribute your project as a package then you don't need gemspec file.
Upvotes: 0
Reputation: 9497
According to the official RubyGems site:
The gemspec defines what’s in the gem, who made it, and the version of the gem. It’s also your interface to RubyGems.org. All of the information you see on a gem page (like jekyll’s) comes from the gemspec.
Once your gemspec
file is sorted out you build it to assemble your gem.
Upvotes: 8