You mean it doesn't get executed at all? Or it doesn't work? You can put
a trace in your after_define block to check if it gets executed.
Also, for your Eclipse tweak you should depend on the :eclipse extension
being run first:
after_define(:fix_eclipse => :eclipse) do |project|
...
puts "Fix eclipse called"
end
alex
On Fri, Oct 8, 2010 at 8:34 AM, Nikos Maris <[email protected]> wrote:
> Now at my buildfile I just require 'tasks/copy_jars_to_lib.rb'
> and 'tasks/fix_eclipse_files.rb''. Although the compile extension is
> executed, the eclipse execution doesn't.
>
> On Fri, Oct 8, 2010 at 5:08 PM, Alex Boisvert <[email protected]
> >wrote:
>
> > Simplest way to add extensions is to drop them into the "tasks"
> directory.
> > That way, they are required automatically. (This is the convention
> over
> > configuration part).
> >
> > Otherwise, you can simply require the extension that the top of your
> > buildfile, whether it's a gem or a file on your filesystem (in source
> > control or not).
> >
> > To create an extension, simply create a module, include the Extension
> > module
> > and mix it in the Project class:
> >
> > # Place this file under tasks directory (e.g. tasks/my_extension.rb)
> > module Buildr
> > module CopyJars
> > include Extension
> >
> > # called for each project
> > after_define(:copy_jars => :compile) do |project|
> > copy_jars_to_lib(project)
> > end
> > end
> >
> > class Project
> > include CopyJars
> > end
> > end
> >
> > And you can do similarly for your Eclipse task.
> >
> > Is that what you had in mind for your refactoring?
> >
> > alex
> >
> > On Fri, Oct 8, 2010 at 2:33 AM, Nikos Maris <[email protected]> wrote:
> >
> > > Newbie question: I would like to extend the default behavior of the
> > compile
> > > task.
> > >
> > > I currently enhance the compile task of all sub-projects with a
> function
> > > that takes a project as an argument in order to access methods like _()
> > and
> > > fields like compile.dependencies :
> > > projects.each do |proj|
> > > proj.compile.enhance do copy_jars_to_lib proj; end
> > > end
> > >
> > > I would like to refactor this code and be able to commit that (e.g.
> > adding
> > > an extension at ~/.buildr is not an option).
> > >
> > > I would like also to refactor the following code:
> > > projects.each do |proj|
> > > task :eclipse do unboundVAR proj; end
> > > end
> > >
> > > thank you for your time,
> > > Nikos
> > >
> >
>