On Tue, Jan 25, 2011 at 8:40 AM, Charles Oliver Nutter <[email protected]> wrote: > On Mon, Jan 24, 2011 at 4:01 AM, Tim Cuthbertson <[email protected]> wrote: >> I'm doing a little bit of work on zero install (0install.net), which >> is a dependency manager that can speak a bunch of archive formats >> (.tgz, .deb, .rpm, etc). I'd like to add .gem to that list. >> Internally, it distinguishes formats by their mime type. So you have >> "application/x-bzip-compressed-tar" for a .tar.bz, etc... >> >> So I was wondering if there is an official or agreed-upon mime-type >> for .gem files? I see rubygems serves them up as >> application/octet-stream, but that isn't really enough to tell what it >> is if you don't have the .gem extension. >> >> If not, does anyone have any suggestions? I've no idea how these >> things are agreed upon, but how about I throw "application/x-rubygem" >> out there for starters... >> >> While I'm at it, is there any spec for the format of a .gem file? From >> looking at examples I've come across, I'm pretty sure I can get away >> with `tar x` on the gem and then `tar xz` on the data.tar.gz contained >> inside. Can anyone see a potential problem with that? > > Well the gem format is a tar of a tar-gz-ball and some gzip compressed > stuff. Rather than adding a new "x" mime type, what's wrong with just > tar format?
Because to actually get at the payload of a .gem (i.e the .rb files and associated directories that ruby will actually read), you need to untar the top level .gem file and then untar the second-level gzipped data tar file. For most purposes, the "contents" of a gem are these .rb files, not the two data.tar.gz and metadata.gz files. So it's not the same as just a .tar, because additional processing needs to be done if you want the actual files that make up the gem. Cheers, - Tim. _______________________________________________ Rubygems-developers mailing list http://rubyforge.org/projects/rubygems [email protected] http://rubyforge.org/mailman/listinfo/rubygems-developers
