On Thu, Jan 28, 2010 at 7:15 PM, 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 > Here's the documentation for defining tasks that take arguments: http://github.com/jimweirich/rake/blob/cb9fc5d19663108986c92f4608da489a0dfb9875/doc/release_notes/rake-0.8.3.rdoc Since Buildr uses Rake's tasks and command line parser, it will work the same way when you run the buildr command. Assaf > > 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 >
