There is a new tool out there called ActiveSprites, part of the active_assets gem.
Github: http://bitly.com/eRTwU4
You use a ruby dsl to define your sprites and then do "rake sprites" and the sprites and corresponding stylesheets get generated.
It's rad!
Here's some sample code,
# config/sprites.rb
Rails.application.sprites do
sprite 'sprites/sprite1.png' => 'sprites/sprite1.css' do
_'sprite_images/sprite1/1.png' => 'a.one'
_'sprite_images/sprite1/2.png' => 'span.two'
end
end