On Mon, Nov 15, 2010 at 2:27 PM, Peter Donald <[email protected]>wrote:
> On Tue, Nov 16, 2010 at 5:04 AM, Alex Boisvert <[email protected]> > wrote: > > The project method could be overloaded to not only return a project but > also > > define a project if a block is given, e.g., > > > > project :foo # => returns the project named :foo if it exists > > > > project :foo do > > ... # define the project > > end > > > > I feel it would be consistent with many of Rake's task constructors, such > as > > file('/path/to/file') do ... end, so I'm open to the idea of allowing > this > > provided it doesn't break backward compatibility. > > works for me. I would presume that the project named :foo would be > returned from both methods. > yes. > > I've also been entertaining the idea (which we discussed this briefly > with > > Antoine and Jim Weirich at GoGaRuCo) of aliasing Task.enhance to > depends_on, > > accepting either a single task or a list of tasks, > > > > task(:foo).depends_on :bar > > > > task(:foo).depends_on :bar, :baz > > +1 > > > and adding convenience methods such as first, and last: > > > > task(:foo).first do > > # block will be executed before 'enhance' blocks > > end > > > > task(:foo).last do > > # block will be executed after 'enhance' blocks > > end > > Although the functionality seems nice, those method names are not > intuitive to me. I can't think of anything better off the top of my > head. > I was initially thinking about do_first and do_last but though the "do" was redundant with Ruby's do ... end notation. Do you think that's better? alex
