Improve dependency management and gemspec file for plugins #2295
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current gemspec files generated by "rails plugin new" are not optimal for creating gems. They do not include full meta-information, nor do they include dependencies.
Bundler can now manage dependencies declared in the .gemspec file through the addition of a simple "gemspec" directive in your Gemfile. This allows dependencies to be declared once, and applies to both base and development dependencies. For more information, check out:
http://gembundler.com/rubygems.html
http://yehudakatz.com/2010/12/16/clarifying-the-roles-of-the-gemspec-and-gemfile/
This pull request includes a refactoring of the Gemfile and .gemspec files generated by "rails plugin new". Dependencies are now managed in the .gemspec file where possible. Comments have been added to both files explaining dependency management choices.
In addition, the .gemspec file has been updated to include more meta-information, such as author and email. Defaults have been added that include "TODO", which prevents gems from being built without review. The version has been extracted into a separate file, to be consistent with bundler and svenfuchs/gem-release.
Hopefully, all of these changes will eliminate the need to run a separate tool such as Bundler or Jeweler to create a gem template which then needs to be merged with the output of "rails plugin new". Merging is a messy, error-prone process that leaves you wishing for a cleaner alternative.
These changes were originally proposed in #2282. I'm following the recommendation to submit these changes to master in the form of several atomic commits.