Permalink
Browse files

Using ant to propigate the version to the build files and --version/-…

…v reads YUITest.version now.
  • Loading branch information...
1 parent 8462b30 commit 8f244501d1e90ecb588f9c416dbde01c2e85b35c @davglass davglass committed Aug 14, 2012
@@ -4,9 +4,10 @@
<property environment="env" />
+ <property file="version.properties" />
<property file="build-core.properties" />
<import file="${builddir}/2.x/bootstrap.xml" description="Default Build Properties and Targets" />
<target name="yuitest_build_subtask" depends="build, minify" />
</project>
-
+
@@ -4,10 +4,11 @@
<property environment="env" />
+ <property file="version.properties" />
<property file="build-node-cli.properties" />
<import file="${builddir}/2.x/bootstrap.xml" description="Default Build Properties and Targets" />
<target name="yuitest_build_subtask" depends="build, minify" />
</project>
-
+
@@ -4,10 +4,11 @@
<property environment="env" />
+ <property file="version.properties" />
<property file="build-node.properties" />
<import file="${builddir}/2.x/bootstrap.xml" description="Default Build Properties and Targets" />
<target name="yuitest_build_subtask" depends="build, minify" />
</project>
-
+
@@ -4,10 +4,11 @@
<property environment="env" />
+ <property file="version.properties" />
<property file="build-rhino-cli.properties" />
<import file="${builddir}/2.x/bootstrap.xml" description="Default Build Properties and Targets" />
<target name="yuitest_build_subtask" depends="build, minify" />
</project>
-
+
@@ -5,6 +5,7 @@
builddir=../../builder/componentbuild
#srcdir=./../../
+
component=yuitest
register.skip=true
component.mainclass = TestRunner
@@ -40,4 +41,4 @@ global.build.base = ${component.jsfiles.base}/../build
#For NPM
component.npm.base = ./npm
-global.build.npm = ${global.build.base}/${component}/npm
+global.build.npm = ${global.build.base}/${component}/npm
View
@@ -3,19 +3,31 @@
<description>Component Build File</description>
<property environment="env" />
+ <property file="version.properties" />
<target name="build" depends="YuiModuleTargets.build">
- <ant antfile="${buildfile.dir}/build-core.xml" target="yuitest_build_subtask" inheritAll="false" />
- <ant antfile="${buildfile.dir}/build-node.xml" target="yuitest_build_subtask" inheritAll="false" />
- <ant antfile="${buildfile.dir}/build-node-cli.xml" target="yuitest_build_subtask" inheritAll="false" />
- <ant antfile="${buildfile.dir}/build-rhino-cli.xml" target="yuitest_build_subtask" inheritAll="false" />
+ <ant antfile="${buildfile.dir}/build-core.xml" target="yuitest_build_subtask" inheritAll="false" />
+ <ant antfile="${buildfile.dir}/build-node.xml" target="yuitest_build_subtask" inheritAll="false" />
+ <ant antfile="${buildfile.dir}/build-node-cli.xml" target="yuitest_build_subtask" inheritAll="false" />
+ <ant antfile="${buildfile.dir}/build-rhino-cli.xml" target="yuitest_build_subtask" inheritAll="false" />
+ <echo>Setting Version</echo>
+ <replace dir="${global.build.base}/yuitest/">
+ <include name="**/*.js"/>
+ <replacefilter token="@VERSION@" value="${version.release}"/>
+ </replace>
</target>
<!-- override to make npm package -->
<target name="npmbuild" depends="all">
<echo>Creating NPM package directory</echo>
<mkdir dir="${global.build.npm}"/>
- <copy file="${component.npm.base}/package.json" tofile="${global.build.npm}/package.json"/>
+ <copy file="${component.npm.base}/package.json" tofile="${global.build.npm}/package.json">
+ <filterchain>
+ <replacetokens>
+ <token key="VERSION" value="${version.release}" />
+ </replacetokens>
+ </filterchain>
+ </copy>
<copy file="${buildfile.dir}/README.md" tofile="${global.build.npm}/README.md"/>
<mkdir dir="${global.build.npm}/lib"/>
<copy file="${global.build.base}/yuitest/yuitest-node.js" tofile="${global.build.npm}/lib/yuitest-node.js"/>
@@ -25,6 +37,11 @@
<filelist dir="${global.build.base}/yuitest/" files="yuitest-node-cli.js" />
</concat>
+ <echo>Setting Version</echo>
+ <replace dir="${global.build.base}/yuitest/">
+ <include name="**/*.js"/>
+ <replacefilter token="@VERSION@" value="${version.release}"/>
+ </replace>
<!-- Unix can't deal with errant \n characters, to double-check here -->
<fixcrlf srcdir="${global.build.npm}" includes="**/*.js" eol="lf"/>
@@ -1,6 +1,6 @@
{
"name": "yuitest",
- "version": "0.7.6",
+ "version": "@VERSION@",
"description": "YUI Test Library on NodeJS",
"author": "Dav Glass <davglass@gmail.com>",
"url": { "web" : "http://yuilibrary.com/projects/yuitest/issues" },
@@ -14,17 +14,7 @@ YUITest.Util.mix(YUITest.CLI, {
},
outputVersion: function() {
- var fs = require('fs'),
- path = require('path'),
- exists = fs.existsSync || path.existsSync,
- pack = path.join(__dirname, 'package.json');
-
- if (exists(pack)) {
- var json = JSON.parse(fs.readFileSync(pack, 'utf8'));
- this.print(json.version + '\n');
- } else {
- this.print('Can not locate package.json file.\n');
- }
+ this.print(YUITest.version + '\n');
},
outputHelp: function(){
@@ -0,0 +1 @@
+version.release=0.7.6

0 comments on commit 8f24450

Please sign in to comment.