0

How can I create a Phing build script that will handle deployments, and migrate a project from it's current version to the latest version?

Assuming that I have broken my deployment down into incremental version updates. Let's say my live server is running version 1, and I want to deploy version 3

The build script should update version 1 to version 2 and then from version 2 to version 3.

So the build script could look something like this.

<project name="deploy">
      <target name="version1">
           <if_version_is_0>
               ..do update
           </if_version_is_0>
      </target>
      <target name="version2" depends="version1">
           <if_version_is_1>
               ..do update
           </if_version_is_1>
      </target>
      <target name="version3" depends="version2">
           <if_version_is_2>
               ..do update
           </if_version_is_2>
      </target>

      <target name="build" depends="version3"/>
</project>

My problem is with the line

<if_version_is_##>

How can I make a condition based upon the current version of the project?

I did find the VersionTask in the documentation, but it handles version number increasing. I need to read the current version into a property or something like that. How can that be done?

Reactgular
  • 52,335
  • 19
  • 158
  • 208

1 Answers1

0

I think this feature might do what I want.

http://www.phing.info/docs/guide/stable/chapters/appendixes/AppendixB-CoreTasks.html#LoadFileTask

<loadfile property="version" file="version.txt"/>

That will let me get the current version as a property, which I can then use as a condition to perform the update.

Reactgular
  • 52,335
  • 19
  • 158
  • 208
  • hah. I've already answer this before. http://stackoverflow.com/questions/1836665/phing-call-a-command-get-its-output-into-a-property – Reactgular Dec 21 '12 at 00:46