[Rubygems-developers] Design notes for RubyGems 2

Curt Hibbs curt at curthibbs.us
Tue Jun 8 14:15:52 EDT 2004

Chad Fowler wrote:
> On Wed, 9 Jun 2004, Gavin Sinclair wrote:
> # The reality is that RubyGems is pretty simple.  I want an interface to
> # the main thing in the system - the collection of gems - that is also
> # simple.  Tell it want you want and you get it.  Obviously that needs
> # to be codified somewhat.  But the current system is more like
> # low-level scratching than high-level ease.
> #
> Agreed on the simplicity comment.  To me, the interface you're talking
> about looks something like this:
> Gem::Cache.from_installed_gems.each do |gemspec|
>    Gem::DocManager.new(gemspec).generate_rdoc
> end
> There might be some things lacking, but I'd like to see them built based
> on a concrete need for them.

Why not:

  repo = new Repository(LOCALHOST)
  repo.each_installed_gem do |gem|

(Of course, the first two lines could be written as one line.)

A GUI gems browser is going to want to have a navigation tree control that
can enumerate known repositories (local and remote) and the gems within each
repository. Once enumerated and displayed, if the user selects an item in
the GUI tree, it needs to know what that corresponds to.

The GUI browser could maintain its map of associations between list-item-ids
and data that identifies the gem and/or repository. In the absence of Gem
and Repository objects from RubyGems, I would define such objects myself.

But that seems silly when those objects should properly be part of RubyGems.
After all, a GUI browser isn't the only thing that leverage off the ability
to manipulate gems and repositories as objects, RubyGems can leverage this
as well.

With objects, we can maintain arrays, hashes, or whatever of gems objects
(heck, we can make use of the full power of Ruby! :). As I said already,
this would not only make life better for the clients of RubyGem services,
but also for RubyGems internals. Caches, for example, would be simple to
construct as gem and repository objects could be easily serialized to XML or
YAML, or even use a Madeline db.


More information about the Rubygems-developers mailing list