Making and publishing your own gems is so incredibly simple. Here is my setp by step process when I want to publish one:
Make a Rubygems account
- first ensure create an ccount on https://rubygems.org/
- initialize your credentials:
curl -u username https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials
Enter host password for user 'username':
chmod 0600 ~/.gem/credentials
Prepare the code
These steps are my typical path, nothing is really mandatory there.
- create a repo at github (or wherever you want)
- create a base gem skeleton
bundle gem mycoolgem
- update the README.md, add some minimal information. The clearest you explain what it does the best chances people will adopt it. Add cypirght information
- create a CHANGELOG.md because when you publish something you need a clear log of your version changes
- enable the tracking on codeclimate, travis, coveralls, gemnasium
- add badges from http://shields.io in the README.md because it helps to qualify the state of the code quickly
- when the gem code don’t need to have access to the version number, I found convenient to just remove the version file and add version in the .gemspec from the changelog file with
spec.version = File.read(File.expand_path('../CHANGELOG.md', __FILE__))[/([0-9]+\.[0-9]+\.[0-9]+)/]
(so then when I version bump there is only one file to edit) - write the code (or copy it from the private app you extract it from)
- add a spec/ or test/ dir and write some tests and try to reach a decent coverage
Release it
- add the date in the changelog for the current version
rake release
- bump the version to the next increment in the changelog (and version file if any)
Overall with the initial bundle command and the final rake task for release, it’s pretty straightforward.