SemanticScuttle will be distributed as .phar file with the next version. The command line interface uses PEAR's awesome Console_CommandLine package, which needs to be packaged up in the Phar file to make it work out of the box.
I let Phing handle all of the deployment of new versions, and generating the Phar file is handled by Phing, too.
In general, adding files to a .phar is easy, even a bunch of PEAR installed files: Put their absolute locations in a <fileset> tag and you're set.
Unfortunately, this solution has several problems:
- The location of PEAR files may differ from machine to machine.
- The list of files may get really long - Console_CommandLine has 28 .php files. When I start to use HTML_QuickForm2 and need to bundle that, there are 67 more files to list. Manually.
- Package updates may add and remove files, so the list gets out of date easily.
I chose to go the correct way and solve all of the problems by writing a Fileset that takes care of everything. All I have to do is specify the package I want to package up:
<pearPackageFileSet package="Console_CommandLine" id="ccl" /> <pharpackage destfile="myapp.phar"> <fileset refid="ccl"/> </pharpackage>
This bit of Phing build file XML packages up all Console_CommandLine php files into myapp.phar.
I've opened a feature request on the Phing website to get it included in the official distribution and started a discussion to make it easier to integrate custom types in Phing in the future (see the ticket).