On Saturday 26 March 2005 01:14 am, Phlip wrote:
> Jim Weirich wrote:
> > Hmmm ... where did you have problems? 
>
> Here:
> 'file.exe' => ['file.cpp', 'file.h']
>     `cc file.cpp`
>
> Run the cc line if .cpp or .h changed.
> I went with this:
>
>     if make('file.exe', ['file.cpp', 'file.h']) then
>         `cc file.cpp`
>         end
> make() just reports true if any of its right arguments have a greater file
> mod time than its first argument. The problem with that technique is it
> uses no elaborate blocks or => marks, or Rake.

If that's all you need, go for it.  The original version of Rake was under 100 
lines of code, so obviously plain old Ruby is very close to solving the 
problem without using Rake.

But, your simple example can be rendered in Rake as ...

  file "file.exe" => ['file.cpp', 'file.h'] do
    sh %{cc file.cpp -o file.exe}
  end

-- 
-- Jim Weirich    jim / weirichhouse.org     http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct, 
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)