Created
October 24, 2016 12:14
-
-
Save gargoyle/e9fba82a87978983484a7eb9da23dd3b to your computer and use it in GitHub Desktop.
Split out 3 section version number in Phing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<target name="loadVersion"> | |
<loadfile property="version.full" file="VERSION.txt"/> | |
<php expression="count(explode('.','${version.full}',3))" returnProperty="version.segments"/> | |
<if> | |
<not><equals arg1="${version.segments}" arg2="3" /></not> | |
<then><fail message="Bad version number!"/></then> | |
</if> | |
<php expression="(int)explode('.','${version.full}',3)[0]" returnProperty="version.major"/> | |
<php expression="(int)explode('.','${version.full}',3)[1]" returnProperty="version.minor"/> | |
<php expression="(int)explode('.','${version.full}',3)[2]" returnProperty="version.rev"/> | |
</target> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment