Nick, you should look at the rule method in Rake. It does what you want.
On Thu, Jan 28, 2010 at 19:15, Nicholas Andrews <[email protected]> wrote: > Hi, > > I want to have several buildr run tasks. My current run task looks like > this: > > task :run => :compile do > Java.java "cc.HelloWorld", "arg1", > :classpath => [ compile.dependencies, compile.target ], > :java_args => ["-server", "-Xmx2048m"] > end > > I thought I could just do: > > task :run_with_blah to run with, say, "cc.ByeByeWorld" instead, but I > get a "don't know what to do with run_with_blah" error when I try to > run `buildr run_with_blah`. > > The other thing I want is to be able to pass parameters to whatever it > is I'm running, instead of having to hard-code it in the build script. > Can you access command line options from the buildfile script, or > does buildr eat them when it interprets it? E.g., > > $ buildr run file1 file2 > > and use file1 and file2 as arguments to the class called in run. This > could work for different main classes as well, where I'd just pass the > class name as an argument like > > $ buildr run HelloWorld arg1 arg2 > > There may be a nicer way to accomplish what I'm doing here, for > instance with a testing framework. I'd welcome any suggestions along > these lines too. > > Cheers, > Nick >
