Brad Phelan wrote: > All, > > I am making a patch to the rake source and running the tests to verify > that all is ok. Without my changes the tests pass. With my changes I get > a weird error. > > 42) Error: > test_name_lookup_with_implicit_file_tasks(TestTaskManager): > NoMethodError: undefined method `+@' for > "/home/phelan/ruby/rake/trunk/trunk/test/data":String > ./lib/rake.rb:682:in `rel_to_root' > > Obviously there is no method "+@" in my code. Has anybody seen this > before? The offending line of code > is > > r = File.dirname(r) > > looks harmless to me. I've also replaced it with > > r = r > > and I get the same result. > > > The patch is below and if anybody can replicate this problem and > understand it it would be great. No need to try and debug my more > general code as that is probably not correct yet anyway. That is why I > am trying to run the tests. > > Regards > > Brad > > $ svn diff -x -w lib/rake.rb > Index: lib/rake.rb > =================================================================== > --- lib/rake.rb (revision 609) > +++ lib/rake.rb (working copy) > @@ -667,12 +667,40 @@ > # ---------------------------------------------------------------- > # Task class methods. > # > + # Task class methods. > + # > class << self > # Apply the scope to the task name according to the rules for > this kind > # of task. File based tasks ignore the scope when creating the name. > + def rel_to_root(*paths) > + r = Application.root.to_s > + paths.collect do |p| > + p = p.to_s > + n = 0 > + while p.index(r) != 0 > + n++ > Sorry. My fault. Been programming too much C.
n++ is not valid Ruby and gets interpreted in a strange way. Changed the line to n+= and all is well -- Brad http://xtargets.com _______________________________________________ Rake-devel mailing list [email protected] http://rubyforge.org/mailman/listinfo/rake-devel
