Page 1 of 1

Using External Tools feature to call Zip utility for ditamap

Posted: Wed Mar 16, 2011 4:23 pm
by jspychka
Hello,

Would it be possible to call a command line zip utility via the External Tools menu item, and zip a ditamap and all reference files. If so, what would the syntax be? This is related to my topic5501 post.

Thanks,

John

Re: Using External Tools feature to call Zip utility for ditamap

Posted: Thu Mar 17, 2011 12:37 pm
by Radu
Hi John,

You can either install Apache ANT and invoke a "build.xml" file to pack the DITA Map project or use a free zip utility which has a command line version like:
http://www.7-zip.org/download.html

Regards,
Radu

Re: Using External Tools feature to call Zip utility for ditamap

Posted: Thu Mar 17, 2011 5:27 pm
by jspychka
Hi Radu,

I would like to give the Ant solution a try since I have Ant installed. Would you be able to walk me through the build.xml file config and explain how to invoke it?

Thanks,

John

Re: Using External Tools feature to call Zip utility for ditamap

Posted: Fri Mar 18, 2011 11:05 am
by Radu
Hi John,

So on your disk you can create an ANT build file called build.xml with the following content:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="dist">
<target name="dist">
<dirname property="ditaProjectDir" file="${ditaMap}"/>
<zip basedir="${ditaProjectDir}" destfile="../ditaMapProject.zip"/>
</target>
</project>
Oxygen 12.2 will have support for creating generic ANT transformations but until then you can use the following workaround:

In the DITA Maps Manager view create a new DITA OT ANT transformation scenario for the current DITA Map (of any type).
In the Parameters tab add a new parameter ditaMap with the value ${cf}.
In the Advanced tab set the Custom build file value to point to your custom build.xml.
Run this transformation scenario each time you want to pack your DITA Map project.

Regards,
Radu

Re: Using External Tools feature to call Zip utility for ditamap

Posted: Fri Mar 18, 2011 11:15 pm
by jspychka
Thanks, Radu! I followed your instructions and got it to "generate" easily. One problem though: the whole project stucture is zipped whereas I would only need the ditamap hierarchy with referenced files zipped. I just want to zip the files that are used by the main ditamap. Is it possible to tweak the build.xml file to do this?

John

Re: Using External Tools feature to call Zip utility for ditamap

Posted: Mon Mar 21, 2011 10:04 am
by Radu
Dear John,

It's very hard to find all dependencies for a DITA Map Project (referenced topics, images, etc).
It's impossible to do this directly from the build file but maybe you could create some Java extension and call it from the build file. But it would take a lot of time to account for all references.

Regards,
Radu

Re: Using External Tools feature to call Zip utility for ditamap

Posted: Tue Mar 22, 2011 11:30 pm
by jspychka
Thanks again, Radu!

I just found a DITA packager that does the job very nicely :) It is a utility offered by Suite Solutions: http://www.suite-sol.com/pages/resource ... ility.html. It works perfectly! Well, almost perfectly. It would be nice to call it from Oxygen but not being able to do that is no big deal.

John

Re: Using External Tools feature to call Zip utility for ditamap

Posted: Wed Mar 23, 2011 10:03 am
by Radu
Hi John,

You can configure External Tools in the Oxygen Preferences but the utility you found does not seem to allow creating the ZIP based on parameters sent from the command line.

Regards,
Radu