buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Boisvert <alex.boisv...@gmail.com>
Subject Re: Correct Use of the 'tap' Method
Date Thu, 23 May 2013 16:19:04 GMT
Actually, the behavior of task ... do is to enhance the task.

For instance, if you have a Rakefile or Buildfile with,

task :foo do
  puts 'foo1'
end

task :foo do
  puts 'foo2'
end

and run rake foo, you'd get:

foo1
foo2



On Thu, May 23, 2013 at 9:10 AM, Adam George <atg103@googlemail.com> wrote:

> Antoine Toulme <antoine@...> writes:
>
> >
> > This is more of a Rake question actually. Rake provides ways for you to
> > define tasks.
> > So when you type task(:compile) do |task| ... you are actually redefining
> > the compile task. That's why it's doing nothing.
> >
> > Rake provides a way to define task dependencies as tasks. Buildr builds
> on
> > this by adding the tap method which lets you add a dependent task
> directly
> > on the compile task. tap inserts the dependency as the first item in the
> > list, so if you tap twice, the second time will execute before the first
> > time.
> >
> > I hope this helps.
> >
>
> Hi Antoine,
>
> Thanks, that does make some sense, and it's useful to know about the
> double-tapping!  However, I am now confused about how the compile task
> worked at all if I was redefining it.
>
> In example 1 (without .tap) the compilation was still working with the
> default behaviour (compiling from src/main/java).  How is this possible if
> the task has been redefined to be something else by my code?
>
> Thanks,
>
> Adam
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message