Phing build.xml in SVN and local build

I am developing in windows environment and my production server has linux. My goal was updating production version from my local machine, but run in to problems with windows&ssh.So now my backup plan is just doing it locally on my server and that is ok. This allows me to do it easily via ssh from different workstations.What I am now wondering is my build.xml file, which is included with my project in svn. Do I really need to make initial export just to run my build.xml which then does actual build? Or should I just separate my build.xml fro...Read more

phing loadfile to property does not override previous value

<loadfile property="test-from-file" file="value.txt" /><echo message="test-from-file = ${test-from-file}" /><loadfile property="test-from-file" file="value2.txt" /><echo message="test-from-file = ${test-from-file}" />The second loadfile does not change the value of the test-from-file property.Is there any way to get this working?...Read more

How to force Phing task to respect verbose exec command?

In other words how to display output of currently executed phing task?<target name="backup_db"> <mkdir dir="${dir.sql}"/> <exec command="mysqldump -v -h ${} -u ${db.username} -p${db.password} ${} > ${dir.sql}/${dump.basename}"/></target>This pulls a database dump, as you see I specified -v flag to get verbose output. Command runs successfully however with no output during the dump. Foo > backup_db: BUILD FINISHED Total time: 1 minute 40.81 secondsThe same command called directly in terminal...Read more

Phing build xml file hanging after sudo su to a user but normal command line execution works

Following is a section of my build.xml file -<echo level="warning">Flow 1</echo> <exec command="sudo su auto_deploy" dir="${dir.jenkins_base}/${dir.scratchpad}" /> <echo level="warning">Flow 2</echo>And on running phing while logged in as user auto_deploy or some other user, the output is - [echo] Flow 1Something seems to be wrong with the sudo su command. However, if I simply run sudo su auto_deploy from command line, it works regardless of which user I am currently lo...Read more

Custom Phing task with nested elements

I'm creating a custom phing task and trying to pass data to it via nested xml elements. My task executes fine but errors out when it attempts to "create" a nested element. For example:Portion of xml build file:<mycustomtask> <option name="opt1" value="val1"/></mycustomtask>Portion of task class file:...public function createOption(){ return new Option;}...Portion of Option class file:class Option{ ... public function setName($str){ $this->name = $str; } public function setValue($str){ $this-&...Read more

No output when executing a command on Phing

I have the following build file:<?xml version="1.0" encoding="UTF-8"?><project name="Example" default="test" description="Sample Description"> <target name="test"> <exec command="ls" dir="./" /> </target></project>However the Phing seems to run this command without outputting anything:Buildfile: /path/to/build/file/build.xmlExample > test:BUILD FINISHEDTotal time: 0.2106 secondsHow can I fix this?Note that the phpunit test...Read more

Locating a program in a Phing build file

In a Phing build file, I would like to invoke an external program (lessc in this case), but the program might live in a different location depending on which system the script is run on.This is what I am doing currently. It works, but it smells to me:<property name="lessc" value="/usr/bin/lessc" override="true" /><if> <not> <available file="${lessc}" /> </not> <then> <fail msg="Could not find LESS compiler at ${lessc}." /> </then></if><exec command="${lessc} ..." />I am usin...Read more

Phing - imported build file does not execute

New to phing, I feel dumb but when I import one build file into another. The imported build file does not execute. I must have something wrong (note that $ phing --buildfile imported.xml runs fine). I have tried:<?xml version="1.0" encoding="UTF-8"?><project name="myproject" default="project" basedir="." description="Set up project"> <target name="project"> <echo msg="Deploy" /> </target> <import file="import.xml"/></project>AND<?xml version="1.0" encoding="UTF-8"?><project name...Read more

How to use ssh keys with Phing

When getting phing to use the SCP and SSH tasks, I currently have to enter my SSH password, but would like the tasks to use the key based authentication I have setup.As far as I can see, the SCP and SSH tasks in phing need to be supplied with the public key file, private key file, and the passphrase. Presumably I wouldn't want to hardcode my passphrase in my build file, so how do people use phing and ssh keys so that they don't have to enter the passphrase with every deploy? And do I want to do this? Or would it be better to leave it needing...Read more

Phing property: fallback from environment variable to property file

Is there an elegant way of determining a value for a property?For example, I'd like to allow a property to be read from a file, but also to be grabbed from an environment variable. If the environment variable is present, I'd like to prioritize it over the file's value.Here's what I have (with the example property deploy.destination):<property environment="env" /><if> <isset property="env.DEPLOY_DEST" /> <then> <property name="deploy.destination" refid="env.DEPLOY_DEST"/> </then></if><...Read more

How to return a value from a phing target?

I would like to have a foreach task like this, which iterates over all the files/directories in a directory "A" - <foreach param="dirname" absparam="absname" target="subtask"> <fileset dir="${dir.destination}/${dir.subdir}/"> <type type="file" /> </fileset></foreach>The target "subtask" should check if the counterpart of the file/folder exists in another directory "B" (I am comparing directory A and B basically), and return either of the following if it does not - a of the file.Following is some co...Read more

How to collect output of a custom phing task in a phing property?

BackgroundI started with this open ended question tried this to solve it using phing's native utilities, but got stuck - How to return a value from a phing target?Now I am trying to write a custom Phing task, as per I tried echoing the list of files in this, with an intention to somehow collect the same in a property when the task is called from the build xml - &l...Read more

Simple way to enumerate the files in a fileset in phing

I am new to phing and trying to verify if my build.xml works as expected. I am looking for a convenient way to enumerate the files in a phing fileset.The only thing that I've been able to get working is foreach (like in how to iterate (loop) through directories in phing?). However, it feels way too complex: I have to create a subtask, and phing gets called once for every file, making the outupt list hard to parse visually.Any better alternatives? Thanks!...Read more