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.
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
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
(with the caveat that 'first' and 'last' don't compose as well as task
dependencies and should therefore not be overused)
Ideally, these last enhancement should go in Rake but we could stage them in
Buildr first. Thoughts?
alex
On Mon, Nov 15, 2010 at 8:37 AM, Antoine Toulme <[email protected]>wrote:
> project is used too - it's a method returning the current project.
>
> define comes from Rake.
>
> On Mon, Nov 15, 2010 at 01:33, redstun <[email protected]> wrote:
>
> > Why the word 'define' is chosen to create a project?
> >
> > The word 'define' makes me thinking I'm creating a ruby method, rather
> than
> > a project, because it's too close to ruby keyword 'def'. Even if 'def' is
> > not a ruby keyword, 'define' really means define anything, much more than
> > just a project.
> >
> > And I always feel it's natural to define a project with the word
> 'project',
> > rather than the word 'define'. Probably we have 'project' used every
> > elsewhere, such as Ant, Maven, Java IDEs, MS Visual Studios, anything
> else?
> >
> > Although 'define' cannot be dropped, can we just allow the word 'project'
> > be
> > used to create a project by something like method alias?
> >
>