Forum: Ruby Multipackage Gems

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
45196398e9685000d195ec626d477f0e?d=identicon&s=25 transfire (Guest)
on 2005-12-09 16:00
(Received via mailing list)
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.
10d4acbfdaccb4eee687a428ca00a5d8?d=identicon&s=25 Jim Weirich (weirich)
on 2005-12-09 18:22
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 Weirich
45196398e9685000d195ec626d477f0e?d=identicon&s=25 transfire (Guest)
on 2005-12-09 19:56
(Received via mailing list)
> Your gem spec allows you to enumerate the files you want included in the
> gem ... what else do you need?

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

Thanks Jim,
T.
45196398e9685000d195ec626d477f0e?d=identicon&s=25 transfire (Guest)
on 2005-12-09 21:20
(Received via mailing list)
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.
10d4acbfdaccb4eee687a428ca00a5d8?d=identicon&s=25 Jim Weirich (weirich)
on 2005-12-09 21:42
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 Weirich
45196398e9685000d195ec626d477f0e?d=identicon&s=25 transfire (Guest)
on 2005-12-09 23:10
(Received via mailing list)
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.
31ab75f7ddda241830659630746cdd3a?d=identicon&s=25 halostatue (Guest)
on 2005-12-10 00:48
(Received via mailing list)
On 09/12/05, Trans <transfire@gmail.com> 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
This topic is locked and can not be replied to.