[Rant-cafe] Weird `issue'

Russel Winder russel at russel.org.uk
Sun Dec 31 15:22:04 EST 2006


I have a Rantfile that uses sys globbing to create the source that is
used to create the names in an array of intermediate targets which is
then used in two file rules.  If I do not use sys globbing then no
problem.  If I use the original array instead of the transformed array
everything is fine.  If I dup one of the two prequisites in the file
rules everything is fine.  However, the file:

        #  Files a.text and b.text exist on the filestore.
        
        Target = 'x'
        Target_W = Target + 'w'
        
        #  `Bug' only shows using sys generated lists.
        
        Sources = sys[ '*.text' ]
        #Sources = [ 'a.text' , 'b.text' ]
        
        def name( n ) ; n.sub( 'text' , 'txt' ) end
        
        #  `Bug' requires that the Sources list be transformed.
        
        prerequisites = Sources.map { | s | name( s ) }
        
        #  `Bug' goes away when a dup is used on prerequisites in one of
        the following.
        
        file Target => prerequisites do | t | puts( t.name ,
        t.prerequisites ) end
        file Target_W => prerequisites do | t | puts( t.name ,
        t.prerequisites ) end
        
        Sources.each { | s |
          file name( s ) => s do | t | sys.cp( t.prerequisites ,
        t.name ) end
        }
        
        task :default => [ Target , Target_W ]
        
        task :clean do prerequisites.each { | p | if File.exists?( p )
        then sys.rm( p ) end } end

results in:

|> rant
x
a.txt
b.txt
rant: [ERROR] private method `sub' called for #<Array:0xb7bdd960>
              /home/users/russel/Checkouts/Rant/trunk/lib/rant/rantlib.rb:434:in `expand_path'
              /home/users/russel/Checkouts/Rant/trunk/lib/rant/rantlib.rb:997:in `resolve'
              /home/users/russel/Checkouts/Rant/trunk/lib/rant/import/nodes/default.rb:212:in `each_dep'
              /home/users/russel/Checkouts/Rant/trunk/lib/rant/import/filelist/core.rb:418:in `apply_ary_method'
              /home/users/russel/Checkouts/Rant/trunk/lib/rant/import/filelist/core.rb:221:in `filelist_resolve'
rant: [ERROR] Task `default' fail.
rant aborted!

the question is whether this is a big or a feature.  I am guessing it is
a bug but...

If anyone has any ideas that would be most helpful.

Thanks.
-- 
Russel.
====================================================
Dr Russel Winder                +44 20 7585 2200
41 Buckmaster Road              +44 7770 465 077
London SW11 1EN, UK             russel at russel.org.uk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://rubyforge.org/pipermail/rant-cafe/attachments/20061231/a7700097/attachment.bin 


More information about the Rant-cafe mailing list