Improve dependency management and gemspec file for plugins #2295

Merged
merged 3 commits into from Jul 28, 2011

Conversation

Projects
None yet
2 participants
Contributor

dgeb commented Jul 27, 2011

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.

Owner

spastorino commented Jul 27, 2011

so @dgeb can you change the commits and make a push -f to your repo?

Contributor

dgeb commented Jul 27, 2011

Will do @spastorino - thanks for the code review.

dgeb added some commits Jul 26, 2011

Expanded meta-data in gemspec to include author, email, etc.; Default…
…s include "TODO" to prevent gems from being built without review.
Extracted version from gemspec and placed it in its own file. This is…
… consistent with the approach taken by "bundle gem", and is expected by gems such as svenfuchs/gem-release which can be used to bump / tag versions of gems.
Contributor

dgeb commented Jul 28, 2011

@spastorino - I've updated the commits with all the changes we've discussed.

spastorino added a commit that referenced this pull request Jul 28, 2011

Merge pull request #2295 from dgeb/mo-better-plugins
Improve dependency management and gemspec file for plugins

@spastorino spastorino merged commit 5ab9132 into rails:master Jul 28, 2011

spastorino added a commit that referenced this pull request Jul 28, 2011

Merge pull request #2295 from dgeb/mo-better-plugins
Improve dependency management and gemspec file for plugins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment