From: Eric Armstrong Date: 2006-06-06T06:22:34+09:00 Subject: Re: Rake questions David Balmain wrote: > I'm by no means a rake expert but since no-one else has answered; > > On 6/3/06, Eric Armstrong wrote: >> 1. Is there some reason to prefer >> sh %{ls -ltr} >> over >> sh "ls -ltr" >> ? > > Perhaps so that you can do this; > > sh %{grep "long long" *} > > without having to escape the double quotes. Just a guess. > Darn good guess, as it turns out. I was just doing something similar using rsync in my Rakefile, and was glad I had encoded %{...} for that very reason. >> 2. My standard csh idiom for creating a log >> file is this: >> ls |& tee test.log >> >> But when I try that in sh, the process >> hangs, and nothing is written. truss >> shows this: >> waitid(P_PID, ...WEXITED|WTRAPPED|WNOWAIT) >> (sleeping...) >> >> Is there a Rakefile idiom for displaying >> execution results and also saving them >> in a file? > > I'd do this; > > def tee(output, file_name) > puts output > File.open(file_name, "a") {|f| f << output } > end > > task :default do > tee `ls`, "out.log" > end > Doh! Of course. Thanks. >> 3. A single quote (') in a comment causes a parse >> error. Is this a known rake bug? If not, >> what's the best way to report it? > > I'm not sure exactly what you mean by this. Are you saying > > # this is a comment with a quote ' > > causes a parse error? Anyway, I'm not sure where to report bugs to > Rake but I'd probably try the devel mailing list; > > http://rubyforge.org/mailman/listinfo/rake-devel > > They should at least point you in the right direction. > Another great tip. Thanks. I was at the Rake site, but missed that pointer somehow.