FYI, I've now implemented the suggestion to alias :project to :define. http://issues.apache.org/jira/browse/BUILDR-552<https://issues.apache.org/jira/browse/BUILDR-552>
alex On Tue, Nov 16, 2010 at 7:13 PM, redstun <[email protected]> wrote: > Cool, after reading all the replies, I think it's quite feasible to do so. > > I've experimented locally by making Buildr.project, > Buildr::Project.project, > and Buildr::Project.self.project do what their corresponding define methods > do. and made the define methods merely aliases. And the result is success. > > Could anyone please show me some instructions about how should I test my > patch? I only tested it with some very simple scenarios, not sure if that's > enough. > > Thanks > > On Tue, Nov 16, 2010 at 2: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. > > > > 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? > > > > > > > > > >
