You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Danny O'Connor <da...@propylon.com> on 2009/07/01 21:04:48 UTC
Override default task
Hi there,
I'm trying to override a biuldr default task and wondering what is the
easiest way.
So for example I want to override the 'upload' task for all projects.
I'm trying this in an Extension
after_define do |project|
Rake::Task['upload'].clear_actions
Rake::Task['upload'].enhance ...
But it doesn't seem to be working, I still get the default upload
behaviour.
Thanks in advance,
Danny.
Re: Override default task
Posted by Danny O'Connor <da...@propylon.com>.
Thanks for your help, I'm running into some behaviour that seems a bit
counter-intuitive.
So if I define my extension like so, trivially just to make the upload
task puts 'hello'
module MyDeployer
include Extension
after_define do |project|
project.task("upload").clear_actions
project.task :upload do
puts "hello"
end
end
end
class Buildr::Project
include MyDeployer
end
I end up with:
<snip>
Deploying packages from skippy_1b
hello
Buildr aborted!
Don't know where to upload, perhaps you forgot to set repositories.release_to
</snip>
However if I take out the 'project.task("upload").clear_actions' I
only then get:
<snip>
Deploying packages from skippy_1b
Buildr aborted!
Don't know where to upload, perhaps you forgot to set repositories.release_to
</snip>
One of the things about just redefining the task as in using
'project.task :upload' is that I'd like to remove the default upload
behaviour. That is I'd like to completely override it rather than
enhance it.
Thanks a lot,
Danny.
Daniel Spiewak writes:
> What if you just do...
>
> after_define do |project|
> project.task :upload do
> ...
> end
> end
>
> Remember that the 'upload' task is defined within each project; it only *
> seems* to be a namespace-global task.
>
> Daniel
>
> On Wed, Jul 1, 2009 at 2:04 PM, Danny O'Connor
> <da...@propylon.com>wrote:
>
> >
> > Hi there,
> >
> > I'm trying to override a biuldr default task and wondering what is the
> > easiest way.
> >
> > So for example I want to override the 'upload' task for all projects.
> >
> > I'm trying this in an Extension
> >
> > after_define do |project|
> > Rake::Task['upload'].clear_actions
> >
> > Rake::Task['upload'].enhance ...
> >
> >
> > But it doesn't seem to be working, I still get the default upload
> > behaviour.
> >
> > Thanks in advance,
> > Danny.
> >
Re: Override default task
Posted by Daniel Spiewak <dj...@gmail.com>.
What if you just do...
after_define do |project|
project.task :upload do
...
end
end
Remember that the 'upload' task is defined within each project; it only *
seems* to be a namespace-global task.
Daniel
On Wed, Jul 1, 2009 at 2:04 PM, Danny O'Connor
<da...@propylon.com>wrote:
>
> Hi there,
>
> I'm trying to override a biuldr default task and wondering what is the
> easiest way.
>
> So for example I want to override the 'upload' task for all projects.
>
> I'm trying this in an Extension
>
> after_define do |project|
> Rake::Task['upload'].clear_actions
>
> Rake::Task['upload'].enhance ...
>
>
> But it doesn't seem to be working, I still get the default upload
> behaviour.
>
> Thanks in advance,
> Danny.
>
Override default task
Posted by Danny O'Connor <da...@propylon.com>.
Sorry forgot to add:
Buildr 1.3.4 (JRuby 1.2.0)
Danny O'Connor writes:
>
> Hi there,
>
> I'm trying to override a biuldr default task and wondering what is the
> easiest way.
>
> So for example I want to override the 'upload' task for all projects.
>
> I'm trying this in an Extension
>
> after_define do |project|
> Rake::Task['upload'].clear_actions
>
> Rake::Task['upload'].enhance ...
>
>
> But it doesn't seem to be working, I still get the default upload
> behaviour.
>
> Thanks in advance,
> Danny.
>