On May 31, 2006, at 4:03 PM, transfire / gmail.com wrote: > I've been working on a task library, on the surface similiar to Rake, > but generalized for use on a per module level --hence usable anywhere > in one's code. The basic principle of the library is that a TASK IS A > METHOD WITH DEPENDENCIES. > > But there's a problem with using a notion like that of Rake's. Since > the dependencies are designated by a list of task names there is no > way > to pass parameters to those dependencies and hence tasks can't have > parameters at all. Eg. > > task :t1 => [ :t2 ] do > ... > end > > task :t2 do |x| > ... > end > > Clearly it doesn't work for task t2 to have the parameter x since t1 > can't pass a parameter using just a symbol list, [:t2]. > > Since my premise is that tasks are just methods with dependencies I am > considering an alternative notation. > > def t1 > t2( 'yes' ) > ... > end > > def t1(a) > ... > end > > task :t1, :t2 > This may be the Lisp I just ate talking but... task :t1 => [ [:t2, arg1, arg2, argetc], [ :t3 ] ] do ... end task :t2 do |a1, a2, *aetc| ... end You can even do is_a? Symbol (I know, not ducktype-y enough) and not have to use a nested-array for tasks with no args e.g. task :t7 => [ :t1, :t3, [:t4, "one", "two"], :t6 ] do ... end