I've got round to packaging my latest attempt at an Amazon S3 library for Ruby into a gem. (For those of you unfamiliar with it, S3 is a network storage solution.) It is less complete than my previous effort, but more solid, more elegant, and with a test suite (which uses RSpec - I haven't added RSpec as a gem dependency (you can ignore the tests if you like), but for reference I developed the tests using RSpec 0.5.12). It has big chunks based on the Amazon S3 Ruby sample code, but I've wrapped it up and made it nice and neat. I've also done things like provide a mechanism for streaming files to S3 (the Amazon sample doesn't do this) using customisable chunk sizes (the Net::HTTP library in Ruby uses 1024 byte chunks by default; mine is customisable). There's lots left to do, of course, but I didn't want another Tuesday to go by without a Ruby Tuesday :).
Download the attached file and install it with a:
gem install s33r-0.1.gem
To use it from inside your Ruby script:
If you want to see an example program which uses the library, have a look at bin/s3cli.rb. This is a simple command line client which you can use to post a file to S3 and email a link to the file to someone. Useful for sending big files to people without clogging their email inbox with enormous files. It is also intended as a demonstration of how to use the library. Full instructions are included at the top of the file.
By the way, I've tested this on Linux, but not on Windows or Mac.
Anyone aware of other S3 libraries for Ruby?