From: Stefan Lang Date: 2005-03-30T05:10:14+09:00 Subject: Re: Rake newbie needs help On Tuesday 29 March 2005 21:19, DaZoner wrote: > I've read the rake docs online and I've got a very simple rakefile to work. > Now I'd like to make it more complex and I can't figure out how to do it. > Can anyone let me know if what I want to do is possible and how to do it? > > Why doesn't the following rakefile print "Making ..."? > > task :default => [:build] > > task :build do > print "In build\n" > file "newzip.zip" do |t| > print "Making ",t.name,"\n" > end > end > > Also I'd like to give the filetask prereq's saying only do this step if the > file is out of date with *.rb and data/*.dat. Can I do this? Does it look > like this? > > file "zipfile.zip" => ["*.rb","data/*.dat"] do |t| > end > > Thanks for your help. I think you really want this: task :default => ["newzip.zip"] file "newzip.zip" => ["*.rb", "data/*.dat"] do |t| puts "Making #{t.name}" end The "file" function already defines a task for you. You don't need to wrap a task around you "file" definition. When your "build" task was run, it *defined* the "newzip.zip" task. Stefan