From: Peter Pk Date: 2009-01-11T06:08:08+09:00 Subject: Re: Ruby Rake 'advanced' rule arguments Anyway - yes I'm learning ... answered my own question The miracle of subroutines and scope solves the problem and factors out nicely. The below make a rule to copy tarket "[destdir]/file"s from srcdir to destdir ******* def copyRule(destdir, srcdir) if(srcdir =~ /\/\z/) srcdir = $` end if(destdir =~ /\/\z/) # rake doesn't check both, string based directory(destdir) srcdir = $` end directory(destdir) regex = Regexp.new('^' + regexifyPath(destdir) + '\/[^\/]+\z') Rake::Task::create_rule( regex => [ proc { |task_name| task_name =~ /\/[^\/]+\z/ task_name = srcdir + $& } ]) do |t| cp t.source, t.name end end Peter I myself wrote: > Just starting out with Rake and Ruby, and made a little rakefile > (below). -- Posted via http://www.ruby-forum.com/.