How to write a gem with rake?

I have a project based on rails. I want to generate gem file by rake and automatically upload to rubyforge. How can I do that?

Go grab hoe

http://blog.zenspider.com/archives/2006/10/hoe_112_released.html

http://rubyforge.org/projects/seattlerb/

Jason