[Rubygems-developers] The next step toward 0.9.0

Jim Weirich jim at weirichhouse.org
Mon Apr 10 15:03:11 EDT 2006

I've not heard any complaints about the incremental downloading feature, 
so its time to start thinking about what needs to be done for a 0.9.0 

Of the outstanding features, the one I really think that needs to be in 
0.9.0 is something to address the datadir issue.  I think everyone has 
agreed that something needs done, I'm not sure we have agreement on what 
that something is.

So, to get the ball rolling, I'll make a proposal.

If a gem has a directory named 'data', then at installation time the 
contents of that directory will be copied into Config::CONFIG['datadir'] 
(which is configured to be /usr/local/share on my system).

Here's some points to ponder:

(1) This is exactly what setup.rb does today.  This allows one directory 
  structure to be used for either gem or setup.rb usage.  This reaffirms 
are commitment to be setup.rb compatible.

(2) The data directory is easy to find, just use:

     require 'rbconfig'
     DataDir = File.join(Config::CONFIG['datadir'], 'mygemname')

(3) This works without any changes to the gemspec format, which means 
eliminates the problems of integrating new gemspec formats with old 
versions of the gem command.  A big win here.

(4) What happened to versioning the data directory?  Well, good 
question.  The problem is that there isn't a single data dir policy that 
will work for everybody.  Some projects might need data versions in lock 
step with the gem version.  Other projects might choose to version the 
data dir data structures in a separate versioning scheme.

By keeping with the simple solution above, we allow users to implement 
whatever schemes work best for them.  The key is to make sure gems 
doesn't get in the way.

(5) Note that the data directory gets copied directly into the share 
area.  This means that the users should put their data in a subdirectory 
of data tagged with their gem name:  Example:


(5a) Just a side note that if users want data versioning, they can do it 
  themselves with:


(6) What about an uninstall policy?  I am suggesting by default, gems 
will not remove data from the data directory.  But, I'm willing to 
entertain an option on the uninstall command that would also uninstall 
the data.  Comments?

(7) On a related note, if the data already exists in the shared 
directory, should an install copy new files on top of that?  I'm 
thinking yes, but I'm not sure.

Ok, that's enough for now.  Feedback welcome.

-- Jim Weirich       jweirich at one.net      http://onestepback.org
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)

More information about the Rubygems-developers mailing list