On Mon, May 18, 2009 at 3:53 PM, Alex Boisvert <[email protected]> wrote:
> Hi Andrew,
>
> To run something before another task, you add a dependency, such as:
>
> task 'before' do
> run_BEFORE_packaging()
> end
>
> task 'package' => 'before'
>
> and to do something after, you can use enhance (as you did) but you'll want
> to use 'tap' to configure the package(:zip) task like this:
>
> package(:zip, :file=>_('target/mypackage.zip')).tap do |zip|
> zip.path('mydeploydir/one').include project('proj:myjar').package(:jar)
> zip.path('mydeploydir/two').include 'mytextfiles/*.txt'
> zip.path('mydeploydir/three').include 'myotherfiles/fromthisdir/*.pdf'
> zip.enhance do
> run_AFTER_packaging()
> end
> end
>
package(:zip, :file=>_('target/mypackage.zip').enhance do |task|
task.enhance do
run_AFTER_packaging()
end
end
>
>
> alex
>
>
> package(:zip, :file=>_('target/mypackage.zip')).enhance do |zip, file|
> >
> > run_BEFORE_packaging()
> >
> > zip.path('mydeploydir/one').include
> > project('proj:myjar').package(:jar)
> > zip.path('mydeploydir/two').include 'mytextfiles/*.txt'
> > zip.path('mydeploydir/three').include
> > 'myotherfiles/fromthisdir/*.pdf'
> >
> > run_AFTER_packaging()
> > end
>
>
> On Mon, May 18, 2009 at 3:38 PM, Andrew Moore <[email protected]
> >wrote:
>
> >
> > Hi, I'm struggling to understand how I can run some ruby code after I
> > package
> > a zip file.
> >
> > Here is a paired down version of my sub-project definition:
> >
> >
> > def 'release' do
> > package(:zip, :file=>_('target/mypackage.zip')).enhance do |zip, file|
> > run_BEFORE_packaging()
> >
> > zip.path('mydeploydir/one').include
> > project('proj:myjar').package(:jar)
> > zip.path('mydeploydir/two').include 'mytextfiles/*.txt'
> > zip.path('mydeploydir/three').include
> > 'myotherfiles/fromthisdir/*.pdf'
> >
> > run_AFTER_packaging()
> > end
> > end
> >
> >
> >
> > I'm not understanding how to invoke my 'run_AFTER_packaging' method after
> > all my various files are included in my zip. My 'run_BEFORE_packaging'
> > method runs, followed by my 'run_AFTER_packaging' method, which is then
> > followed by the actual execution of the package task... (in which all the
> > various files get added to the zip).
> >
> > I'm not very familiar with Ruby or Rake... and I've tried searching
> through
> > all the Buildr and Rake docs and tutorials I can find. I'm assuming there
> > is
> > some sort of basic concept I'm not grasping, the docs and tutorials gloss
> > over something basic or the way of doing this isn't intuitive enough.
> >
> > Any help in showing me what to do to accomplish this, as well as
> > enlightening me on what concept I'm missing is much appreciated.
> >
> > Regards,
> >
> > Andrew
> >
> >
> > --
> > View this message in context:
> >
> http://n2.nabble.com/Running-code-after-a-package-task-has-completed-tp2936195p2936195.html
> > Sent from the Apache Buildr - User mailing list archive at Nabble.com.
> >
> >
>