From: Rich Kilmer Date: 2001-10-30T10:29:09+09:00 Subject: [ruby-talk:23793] Re: RubyGems Status (was: Re: Someinspirations from REBOL) OK...here's an idea for making a Gem a Ruby executable file... What if the file format was a Ruby document like... require "rubygems" #or whatever ;) include Gem unless kind_of? Gem begin_gem "RichsCoolGem" author="Rich Kilmer" version="1.1.3" requires="RyansCoolGem,0.0.2" requires="RobertsCoolGem,2.0.0" signature="...secure hash/signed..." public_key="...public key..." compression="LZO" encoding="BASE64" executable="myFile1.rb" [FILE=>"myFile1.rb", MIME_TYPE=>"text/ruby", VERSION=>"1.1.1"] = <<_FILE ...BASE64 ENCODED, LZO COMPRESSED FILE... _FILE [FILE=>"myFile2.rb", VERSION=>"1.0.2", COMPRESSION=>"ZLIB"] = <<_FILE ...BASE64 ENCODED, ZLIB COMPRESSED FILE... _FILE end_gem the mixin "Gem" would provide these methods module Gem def begin_gem(name) @gem_name = name end def author=(author) @gem_author=author end ...etc...and... def []=(hash, data) @gem_files ||= {} @gem_files[hash[FILE]]=GemFile.new(hash, data) end def end_gem if __FILE__ == $0 && @gem_executable ...run the file @gem_executable end end ...and lots of other nifty methods... end and you could have a GemWrapper class class GemWrapper include Gem def initialize(file) #where file is ???.rbg #eval file contents into GemWrapper instance end end What do you think? -Rich > -----Original Message----- > From: Neil Conway [mailto:nconway@klamath.dyndns.org] > Sent: Monday, October 29, 2001 7:21 PM > To: ruby-talk ML > Subject: [ruby-talk:23786] Re: RubyGems Status (was: Re: > Someinspirations from REBOL) > > > On Mon, 2001-10-29 at 18:56, Robert Feldt wrote: > > I agree. One nice thing with making all gems valid Ruby programs in > > themselves is that people could actually add custom make and install > > procedures etc. while still being valid gems. This way one and the same > > gem can be used both > > > > * As a jar file which need not be unpacked to be by interpreter > > * As a distribution format - just do "ruby --make gem" and it will > > unpack and build extensions etc and then "ruby --install gem" and it > > installs. > > * As an executable Ruby program - Simply "ruby gem" and it > will run (if > > its a runnable gem, otherwise just say no. > > These are all good ideas, IMHO. Another possible usage for a Ruby > archive format is similar to Java's WAR -- a "web application archive". > The WAR contains a complete web app and some special resources, so that > all the admin need to do is copy the .war file into the appropriate > directory on the system and the servlet container takes care of > everything else that is needed to get the web app running. > > In practice, WAR is pretty basic, but I think the general idea is a good > one. I don't have any specific ideas about a WAR-like format for Ruby > (we need a web container first), but I think that making the format > extensible enough to allow for specialized archives like this would be a > good idea. > > Cheers, > > Neil > > -- > Neil Conway > PGP Key ID: DB3C29FC >