[Rubygems-developers] Idea: more detailed file and rdoc specification

Jim Weirich jweirich at one.net
Sat Dec 6 09:01:20 EST 2003

Gavin Sinclair wrote:
> Folks,
> I was halfway towards implementing this idea when I thought it would
> be good to raise it for discussion.  Take a look at the (invalid)
> specification below.  The things to notice are in their own paragraph.

Looks good.  I added a couple of notes ...

>     s.files = Gem::Specification::Files.new do |gf|
>       gf.lib = FileList["lib/**/*.rb"]
>       gf.bin = FileList["bin/*"]
>       gf.doc = FileList[%w{README README.1st ChangeLog HISTORY}]
>     end

Notice that you are assigning Rake defined FileLists to the 
gf.lib/bin/doc attributes.  Unless you are filtering that under the 
covers, this puts a reference to a FileList into the spec object and 
when it will YAML-ized with that reference.  That means whoever loads 
that YAML file will need to have Rake loaded.

*I* don't mind tying Rake closer to RubyGems, but I want that to be a 
conscious decision.  If we want to avoid that dependency, we could ...

(a) use "to_a", example ...

       gf.bin = FileList["lib/**/*.rb"].to_a

(b) bury "to_a" into the attribute writer ...

       class Files
          def bin=(filelist)
            @bin = filelist.to_a

(c) something else

One other small note ...

>     s.rdocspec = Gem::Specification::RDocSpec.new do |rs|
>       rs.files = s.files.lib + "README"

I would not expect that to work.  Perhaps ...

         rs.files = s.files.lib = ["README"]

would be better.

Well, that's my two - 1/2 cents.

-- 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