Installing Xdebug for use with Eclipse or Netbeans on Linux
Using Multi-Byte Character Sets in PHP (Unicode, UTF-8, etc)
Native Linux Space Warfare: Freespace 2
ENUMs, User Preferences, and the MySQL SET Datatype
Nice n' Easy JQuery Image Rotator
Scrollable Tables with Floating Header using CSS

Constructing a Build File for Phing

Tuesday, 31 July 12, 11:47 am
Phing is a build system based on Apache Ant, and serves to automate the process of releasing code for a development project. Before a new version of a PHP project can be released, you may have to undertake certain tasks such as running unit tests and code analysis tools, compiling dependencies (e.g. SASS, templates, language files), changing file permissions, copying files and many more.

The actions to perform are defined in the build file, named build.xml by default, which defines the sequence of commands required for different actions within elements. When you run Phing, you can tell it the action to perform, or leave it to use the default as specified by the default attribute of the root element.

An action may imply other actions to run beforehand, by specifying them as dependencies in the depends attribute of the element.

Compiling SASS Thingumeh-Wotsits

If you store the SCSS files for a project in a particular heirarchy, you will probably want recreate that heirarchy elsewhere (viz in the web accessible area of your site) and compile the SASS to CSS therein.

Here's the Phing shizzle for compiling a single directory of SCSS:
<exec command="sass --update /input/path/to/scss:${buildDir}/output/path/to/css" dir="${buildDir}" />

Repeat a Command on All Directories at a Specific Path

<foreach param="dirname" absparam="absname" target="compile-po-files"> <fileset dir="${buildDir}/svnexport/sites/"> <type type="dir" /> <depth max="2" min="2" /> </fileset> </foreach>   <target name="compile-po-files"> <exec command="msgfmt *.po" dir="${absname}" /> </target>

Please enter your comment in the box below. Comments will be moderated before going live. Thanks for your feedback!

Cancel Post

/xkcd/ Moon Armor Index