On Monday 14 November 2005 18:17, itsme213 wrote:
> "Jim Weirich" <jim / weirichhouse.org> wrote in message
> news:200510310026.32133.jim / weirichhouse.org...
>
> > On Saturday 29 October 2005 06:27 pm, itsme213 wrote:
> >> Why does rake not recognize "rakefile.rb" as a default rakefile?
> >> I just had
> >> to change the file name to just "rakefile" to get it to work
> >> (which messes
[...]
> It's a bit more peculiar than I thought.
>
> If I am in a directory with
>     rakefile
> then
>     rake
> finds that file just fine.
>
> However, if I am in a directory with
>     rakefile.rb
> then
>     rake
> finds a different (entirely unrelated) rakefile.rb from an entirely
> unrelated directory (not a parent or child dir).
>
> This is Win-XP.
>
> I am confused!

The problem is that rake uses Kernel#load to load the Rakefile.
So the code that loads your "rakefile.rb" resolves to:

    load "rakefile.rb"

Since load searches $LOAD_PATH and the current directory is
usually the last in $LOAD_PATH, it will load a "rakefile.rb"
from another library directory, if it exists.
(So in your case, you have another "rakefile.rb" somewhere
on your $LOAD_PATH, but no "rakefile", thus "rakefile" works
but "rakefile.rb" not.)

The solution for Rake would be to replace the line (in lib/rake.rb)

      load @rakefile

with:

      load File.expand_path(@rakefile)

A temporary solution would be to invoke Rake with the -f option
and an absolute path to the Rakefile.

This works on Linux, bash:

    $ rake -f`pwd`/rakefile.rb

Perhaps you can translate it for Windows.

Regards,
  Stefan