I'd like to write a package for Ruby and make it available as a gem.
What are the tools, steps and pitfalls ?
Are there any good tutorials, screencasts, etc., which helped you learning how to do it ?
views:
933answers:
3You needed not start writing a gem, just write some code, write some tests, use it however you want. Then, once you are happy with it, use gem this to generate the relevant rakefile.
It helps if you stick to the aproaches other gems take (have a lib directory, avoid naming files in ways that could clash with other gems, write some tests if you can, have a readme), but it's not necessary.
Once you have something you wan't to share, put it on github and push it to gemcutter.
Don't over think it, don't use hoe or other overkill tools, have fun, don't to anything I wouldn't do.
If you're going to use GitHub to host the project, Jeweler might be useful. It's a tool for managing rubygem projects and versioning of gems. It has a generator for kickstarting a new gem project too.
Gemcutter is another ruby gem that's mentioned in other responses. It allows you publish your gem on gemcutter.org with simple command line tasks.
There's a video on railscasts.com that explains how to use both these tools here.
If you're not using github or want alternatives:
- mg which adds some rake tasks to help the gem building process and a task to publish to gemcutter.
- gem-this adds a bunch of helpful rake tasks.
Some tutorials/guides:
- How to build a ruby gem and host it on gemcutter - tutorial using echoe and gemcutter
- The Truth About Gemspecs - goes over gemspecs and tips for dealing with them
- Packaging with RubyGems - a quickstart guide for Jeweler
- gem that - James Adam - reviews tools that help build gems (hoe, newgem, echoe, gemhub, jeweler, gem this
- Using Gemcutter's Api from the Commandline -