From: Joel VanderWerf Date: 2008-02-26T06:07:38+09:00 Subject: Re: rake task with arguments Jos Backus wrote: > On Tue, Feb 26, 2008 at 05:39:57AM +0900, Reacher wrote: >> All looks well ... until I try to run it: >> >> $ rake foo:bar[123] >> rake: No match > > Try this instead: > > $ rake 'foo:bar[123]' Yuck. FWIW, you can also embed arguments in the task name, which makes the command line cleaner. This is yucky in its own special way. $ cat rakefile foo_task_pat = /^foo(\w+)$/ make_foo_dep_name = proc do |taskname| "foo/#{taskname[foo_task_pat, 1]}" end rule foo_task_pat => make_foo_dep_name do |t| puts "handling rule for #{t.name.inspect}" end directory "foo" file "foo/bar" => "foo" do system "touch foo/bar" end $ rm -rf foo $ rake foobar (in /home/vjoel/ruby/misc/rake/args) handling rule for "foobar" $ ls foo bar -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407