You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by ni...@apache.org on 2003/10/01 15:44:08 UTC
cvs commit: xml-forrest/src/resources/forrest-shbat/var skinlist2fetch.xsl
nicolaken 2003/10/01 06:44:08
Modified: src/resources/forrest-shbat forrest.build.xml
src/resources/forrest-shbat/var skinlist2fetch.xsl
Log:
Added a possible version to the skin files, to match the forrest one.
Hence while both myskin.fsj and myskin-0.5.fsq are valid skins, the
versioned one will be searched for before the generic one.
Made forrest unpack files placed manually in the skins dir.
Made the download automatic when running forrest if skin not available.
Changed from jar packages to zips (we don't use the manifest).
Revision Changes Path
1.104 +45 -21 xml-forrest/src/resources/forrest-shbat/forrest.build.xml
Index: forrest.build.xml
===================================================================
RCS file: /home/cvs/xml-forrest/src/resources/forrest-shbat/forrest.build.xml,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -r1.103 -r1.104
--- forrest.build.xml 1 Oct 2003 11:36:47 -0000 1.103
+++ forrest.build.xml 1 Oct 2003 13:44:08 -0000 1.104
@@ -246,7 +246,7 @@
</target>
<!-- Sets up properties and filters -->
- <target name="init" depends="init-props, init-skinprops"/>
+ <target name="init" depends="init-props, init-skinprops, init-skins"/>
<!-- ===============================================================
Echo's the settings if requested. [-Dforrest.echo=true]
@@ -1118,27 +1118,52 @@
<target name="package-skin" description="Make a package of an existing skin">
<input message="Which skin do you want to package?"
addproperty="skin-name"/>
- <jar destfile="${forrest.home}/context/skins/${skin-name}.fsj"
+ <zip destfile="${forrest.home}/context/skins/${skin-name}-${version}.fsj"
basedir="${forrest.home}/context/skins/"
includes="${skin-name}/**"/>
</target>
-
+
+
<target name="install-skin"
- depends = "init-props, fetch-skin, unpack-skin"
+ depends = "init-skins"
description="Install the needed skin from the remote repository"/>
- <!-- private targets -->
-
- <target name="unpack-skin"
+ <!-- private -->
+
+ <target name="init-skins" depends="init-props, check-skin, fetch-skin, unpack-skins"/>
+
+ <target name="check-skin">
+ <condition property="skin.unavailable">
+ <and>
+ <not>
+ <available type="dir" file="${forrest.home}/context/skins/${project.skin}"/>
+ </not>
+ <not>
+ <available type="file" file="${forrest.home}/context/skins/${project.skin}.fsj"/>
+ </not>
+ </and>
+ </condition>
+ </target>
+
+ <target name="unpack-skins"
depends="init-props">
- <unjar src="${forrest.home}/context/skins/${project.skin}.fsj"
- dest="${forrest.home}/context/skins/"/>
- <delete file="${forrest.home}/context/skins/${project.skin}.fsj"/>
+ <unzip dest="${forrest.home}/context/skins/">
+ <fileset dir="${forrest.home}/context/skins/">
+ <include name="*.fsj"/>
+ </fileset>
+ </unzip>
+ <delete>
+ <fileset dir="${forrest.home}/context/skins/">
+ <include name="*.fsj"/>
+ </fileset>
+ </delete>
</target>
- <target name="fetch-skins-descriptor">
+ <target name="fetch-skins-descriptor"
+ if = "skin.unavailable">
<get src="http://xml.apache.org/forrest/skins/skins.xml"
- dest="${forrest.home}/context/skins/skins.xml"/>
+ dest="${forrest.home}/context/skins/skins.xml"
+ verbose="true" usetimestamp="true" ignoreerrors="false"/>
</target>
<target name="available-skins"
@@ -1151,18 +1176,17 @@
</target>
<target name="fetch-skin"
- depends="init-props, fetch-skins-descriptor"
- description="Get a skin from the remote repository">
+ if = "skin.unavailable"
+ depends="init-props, fetch-skins-descriptor">
<xslt in="${forrest.home}/context/skins/skins.xml"
out="${project.work-dir}/skinlist2fetchbuild.xml"
- style="${forrest.home}/var/skinlist2fetch.xsl">
- <param name="skin-name" expression="${project.skin}"/>
+ style="${forrest.home}/var/skinlist2fetch.xsl"
+ force="true">
+ <param name="skin-name" expression="${project.skin}"/>
+ <param name="forrest-version" expression="${version}"/>
</xslt>
<ant antfile="${project.work-dir}/skinlist2fetchbuild.xml"/>
</target>
- <target name="install-skin"
- depends = "init-props, fetch-skin, unpack-skin"
- description="Install a skin from the remote repository"/>
-
+
</project>
1.2 +49 -17 xml-forrest/src/resources/forrest-shbat/var/skinlist2fetch.xsl
Index: skinlist2fetch.xsl
===================================================================
RCS file: /home/cvs/xml-forrest/src/resources/forrest-shbat/var/skinlist2fetch.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- skinlist2fetch.xsl 30 Sep 2003 14:50:01 -0000 1.1
+++ skinlist2fetch.xsl 1 Oct 2003 13:44:08 -0000 1.2
@@ -1,21 +1,53 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
- <xsl:param name="skin-name"/>
+ <xsl:output method="xml" indent="yes" />
+
+ <xsl:param name="skin-name" />
+ <xsl:param name="forrest-version" />
- <xsl:template match="skins">
+ <xsl:template match="skins">
<project default="fetchskin">
- <target name="fetchskin">
- <get>
- <xsl:attribute name="src" >http://www.apache.org/~nicolaken/whiteboard/forrestskins/<xsl:value-of select="$skin-name"/>.fsj</xsl:attribute>
- <xsl:attribute name="dest">${forrest.home}/context/skins/<xsl:value-of select="$skin-name"/>.fsj</xsl:attribute>
- </get>
- </target>
- </project>
- </xsl:template>
-
- <xsl:template match="skin">
- <echo><xsl:value-of select="@name"/></echo>
- </xsl:template>
-
-</xsl:stylesheet>
\ No newline at end of file
+
+ <target name="fetchskin" depends="fetch-versioned-skin, fetch-unversioned-skin, final-check"/>
+
+ <target name="fetch-versioned-skin">
+ <echo>Trying to get "<xsl:value-of select="$skin-name" />" skin version
+ <xsl:value-of select="$forrest-version" />...</echo>
+ <get verbose="true" usetimestamp="true" ignoreerrors="true">
+ <xsl:attribute name="src"><xsl:value-of select="skin[@name=$skin-name]/@url" />-<xsl:value-of select="$forrest-version" />.fsj</xsl:attribute>
+ <xsl:attribute name="dest">${forrest.home}/context/skins/<xsl:value-of select="$skin-name" />.fsj</xsl:attribute>
+ </get>
+ </target>
+
+ <target name="fetch-unversioned-skin" unless="versioned-skin.present">
+ <echo>Versioned skin unavailable, trying to get versionless skin...</echo>
+
+ <get verbose="true" usetimestamp="true" ignoreerrors="true">
+ <xsl:attribute name="src"><xsl:value-of select="skin[@name=$skin-name]/@url" /><xsl:value-of select="$skin-name" />.fsj</xsl:attribute>
+ <xsl:attribute name="dest">${forrest.home}/context/skins/<xsl:value-of select="$skin-name" />.fsj</xsl:attribute>
+ </get>
+ </target>
+
+ <target name="final-check">
+ <available property="skin.present">
+ <xsl:attribute name="file">${forrest.home}/context/skins/<xsl:value-of select="$skin-name" />.fsj</xsl:attribute>
+ </available>
+
+ <fail unless="skin.present">
+ Unable to download the
+ "<xsl:value-of select="$skin-name" />" skin from
+ <xsl:value-of select="skin[@name=$skin-name]/@url" />.
+ In case the reason is the network connection, you can try
+ installing the package manually by placing the file in the
+ skins directory.</fail>
+
+ <echo>Skin "<xsl:value-of select="$skin-name" />" correctly installed.</echo>
+ </target>
+ </project>
+ </xsl:template>
+
+ <xsl:template match="skin">
+ </xsl:template>
+
+</xsl:stylesheet>
+