Multipackage Gems

I have a multipackage project layout:

workspace/
setup.rb
packages/
proj1/
lib/
proj2/
lib/

setup.rb of course was designed to handle this, but how do I create a
gem that includes all the packages? I have created gems for each
subproject, and then created a “metagem” that just lists them as
dependencies, but some endusers aren’t happy with this and want a gem
that actually contains all the subprojects.

Any suggestions for achieving this? Does Gems have any way to handle
this itself? If not, would it behove gems to be updated to support
this?

Thanks,
T.

transfire wrote:

I have a multipackage project layout:
[…]
[Users] want a gem that actually contains all the subprojects.

Any suggestions for achieving this? […]

Your gem spec allows you to enumerate the files you want included in the
gem … what else do you need?

– Jim W.

Your gem spec allows you to enumerate the files you want included in the
gem … what else do you need?

Oh yea! :slight_smile: I was over complicating the situation. Silly me.

Thanks Jim,
T.

Wait a minute! That doesn’t work.

Jim, if I tell it to inlcude ‘packages//lib//*’ then it includes
them but just like that in the gem. It makes no sense. Wouldn’t one
then have to use?

require ‘packages/proj1/lib/proj1/file.rb’

Even using require_paths isn’t helpful b/c I have dozens of
sub-projects. Considering how Gems works I’m pretty sure that would
way too inefficent.

Is there are way to tell it how to put them in the gem?

Thanks,
T.

Well, I got it to work using the require_paths (I assume that’s what
you meant). But I have my misgivings about it. Correct me if I’m wrong,
but Gems uses require_paths and will search every one of the paths for
a match. Is that right?

So in my case I have (note: I use a YAML file to setup the gemspec) :

  require_paths:
  - packages/annotation/lib
  - packages/ansicode/lib
  - packages/association/lib
  - packages/basicobject/lib
  - packages/bbcode/lib
  - packages/binaryreader/lib
  - packages/bitmask/lib
  - packages/classinherit/lib
  - packages/cloneable/lib
  - packages/consoleapp/lib
  - packages/coroutine/lib
  - packages/crypt/lib
  - packages/dictionary/lib
  - packages/enumerablepass/lib
  - packages/expirable/lib
  - packages/floatstring/lib
  - packages/functor/lib
  - packages/heap/lib
  - packages/inheritor/lib
  - packages/interval/lib
  - packages/lisp/lib
  - packages/lrucache/lib
  - packages/mathconstants/lib
  - packages/methodprobe/lib
  - packages/mock/lib
  - packages/multiton/lib
  - packages/nackclass/lib
  - packages/nilcomparable/lib
  - packages/nullclass/lib
  - packages/one/lib
  - packages/openobject/lib
  - packages/paramix/lib
  - packages/pool/lib
  - packages/progressbar/lib
  - packages/reference/lib
  - packages/semaphore/lib
  - packages/stateparser/lib
  - packages/statichash/lib
  - packages/system/lib
  - packages/tagiterator/lib
  - packages/timer/lib
  - packages/tracepoint/lib
  - packages/tuple/lib
  - packages/uninheritable/lib
  - packages/units/lib
  - packages/yamlstruct/lib

Thats a lot of places to have to search every time and can’t be very
efficeint.

But at least it works.

Thanks,
T.

transfire wrote:

Wait a minute! That doesn’t work.

Jim, if I tell it to inlcude ‘packages//lib//*’ then it includes
them but just like that in the gem. It makes no sense. Wouldn’t one
then have to use?

require ‘packages/proj1/lib/proj1/file.rb’

Even using require_paths isn’t helpful b/c I have dozens of
sub-projects. Considering how Gems works I’m pretty sure that would
way too inefficent.

Is there are way to tell it how to put them in the gem?

You tell the gem spec where your library directories are (the default is
just “lib”). RubyGems will make sure they all get added to the load
path at run time.

– Jim W.

On 09/12/05, Trans [email protected] wrote:

way too inefficent.

Is there are way to tell it how to put them in the gem?

No, but there should be. If you look at my Rakefile for PDF::Writer
(especially, but I think most of them), I do a bit of transformation
on the filenames when I package into .tar.gz. I would love to see
the same capabilities added to RubyGems so that I can tell it not only
where to FIND the source files but where to PLACE them in the internal
tarfile. It’s not that difficult.

-austin