tags:

views:

933

answers:

3

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 ?

+1  A: 

Take a look at:

Diego Dias
+2  A: 

You 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.

cwninja
+7  A: 

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:

Jack Chu
`gem build` is provided by RubyGems itself. All the Gemcutter gem (and soon, RubyGems proper) allows you to do is push a RubyGem using the API.http://gemcutter.org/pages/gem_docshttp://gemcutter.org/pages/api_docs
qrush
Thanks, I've edited the response.
Jack Chu