Rake complains about missing "default" task

Hi,

I got an example rakefile from the webpage http://jasonseifer.com/2010/04/06/rake-tutorial which displays "Published: April 6, 2010 at 4:25 AM"

Below are my results from testing that rakefile in a Command window on WinXP-Pro/SP3 running Rails 2.3.5, where Rake complained "Don't know how to build task 'default'". How do I get it to run as I intend?

Thanks in Advance, Richard

=== Command Window === K:\Temp>dir Volume in drive K is K02-100G_NT Volume Serial Number is B00C-F65F

Directory of K:\Temp

07/09/2010 05:25 PM <DIR> . 07/09/2010 05:25 PM <DIR> .. 07/09/2010 05:01 PM 15 file_in.txt 07/09/2010 05:21 PM 103 rakefile                2 File(s) 118 bytes                2 Dir(s) 56,653,742,080 bytes free

K:\Temp>type rakefile directory "tmp"

  file "hello.tmp" => "tmp" do     sh "echo 'Hello' >> 'tmp/hello.tmp'"   end

K:\Temp>rake (in K:/Temp) rake aborted! Don't know how to build task 'default'

(See full trace by running task with --trace)

K:\Temp>

I got an example rakefile from the webpage http://jasonseifer.com/2010/04/06/rake-tutorial which displays "Published: April 6, 2010 at 4:25 AM"

Below are my results from testing that rakefile in a Command window on WinXP-Pro/SP3 running Rails 2.3.5, where Rake complained "Don't know how to build task 'default'". How do I get it to run as I intend?

K:\Temp>type rakefile

s/b Rakefile, though possibly case doesn't matter on Windows -- you can confirm or disprove that, but in any case,

K:\Temp>rake

that's not how it's invoked in the tutorial you cite. Look again.

(in K:/Temp) rake aborted! Don't know how to build task 'default'

Or add a default task :slight_smile:

A glance at the Rake rdoc should help, eh? :slight_smile:

OK,

I got took one of the first examples of the website I cited before,

>http://jasonseifer.com/2010/04/06/rake-tutorial

and found that it didn't work "in any directory" as advertised.

I did three things: 1 Upgraded the example so that it would work "in any directory" (I suspect it would work in the root dir.) 2. Added command[echoing code 3. Remove spurious quotes from the argument of the echo command.

Comments in the Rakefile below spell out all the details if you're interested. Thanks for nudging me forward.

Best wishes, Richard

Rakefile

It does indeed work "in any directory" for me, but that's on OS X; maybe this is a Windows-specific issue?

ripple:~$ cd Downloads ripple:~/Downloads$ cat Rakefile directory "tmp"

file "hello.tmp" => "tmp" do   sh "echo 'Hello' >> 'tmp/hello.tmp'" end ripple:~/Downloads$ ls tmp ls: tmp: No such file or directory ripple:~/Downloads$ rake hello.tmp (in /Users/hassan/Downloads) mkdir -p tmp echo 'Hello' >> 'tmp/hello.tmp' ripple:~/Downloads$ ls tmp/hello.tmp -rw-r--r-- 1 hassan staff 6 Jul 11 10:59 tmp/hello.tmp ripple:~/Downloads$ cat tmp/hello.tmp Hello ripple:~/Downloads$

FWIW,

maybe this is a Windows-specific issue?

Good question. I copied the Tempfile to C:\ Ran my version, which added the working dir. to tmp.txt Ran fine.

Ran original version -- same problem. So my speculation was wrong. Maybe that's because Windows has no real root. There's just the \ address in a partition. I've got about a half-dozen partitions, plus similar symbols for some devices

It looks to me like the author does run on U*ix, because his next example is: [jason@brick:~/src]$ rake ready_for_the_day.

There also a typo for this example: He claims the output from this command includes the line: Made 5 cups of coffee. Shakes are gone.

In fact, it's only 2 cups. His next example: [jason@brick:~/src]$ rake COFFEE_CUPS=5 make_coffee produces the 5 cup.

I'm just amused be the problem the author faced in trying to produce a perfect tutorial. I know that feeling all too well. And I am truly grateful for the author publication of his tutorial. It's leading me through the nuances of Rake.

And thanks to you for helping me in my quest for a "black belt" in Rake-ism :slight_smile:

Best wishes, Richard