Skip to content
Browse files

the build script and the code should use a timestamped war file

  • Loading branch information...
1 parent 0891294 commit 558fb37f35a7e8696618ec1c47164c5a8749367e @betehess betehess committed Sep 20, 2012
Showing with 14 additions and 7 deletions.
  1. +1 −1 .gitignore
  2. +8 −3 build-css-validator-war.sh
  3. +5 −3 src/main/scala/JettyMain.scala
View
2 .gitignore
@@ -22,4 +22,4 @@ bin
*.egp
RDFValidator
2002
-css-validator.war
+css-validator*.war
View
11 build-css-validator-war.sh
@@ -1,17 +1,20 @@
#!/bin/sh
+# if you change this, don't forget to change the corresponding date in the Scala code!
+date="2012-09-20"
+
## this script probably runs only on a Linux-based machine
## you need CVS, Java and ant to be already installed
-rm -Rf 2002
+rm -Rf 2002 src/main/resources/*
# check out the source
export CVSROOT=":pserver:anonymous@dev.w3.org:/sources/public"
echo
echo "IMPORTANT: enter anonymous as the password for cvs"
echo
cvs login
-cvs get 2002/css-validator
+cvs get -D "$date" 2002/css-validator
# build the WAR file
cd 2002/css-validator
@@ -20,4 +23,6 @@ ant war
# stages the WAR so that it's part of the SBT project
cd ../..
-cp 2002/css-validator/css-validator.war src/main/resources
+echo
+echo "cp 2002/css-validator/css-validator.war src/main/resources/css-validator-$date.war"
+cp 2002/css-validator/css-validator.war src/main/resources/css-validator-$date.war
View
8 src/main/scala/JettyMain.scala
@@ -39,14 +39,16 @@ class CSSValidator(port: Int) {
// first, tries to see if this is running from sbt
// if it's not, we assume we are in the jar and that the war is available there
val warPath: String = {
- val sbtPath = "src/main/resources/css-validator.war"
+ val date = "2012-09-20"
+ val warName = "css-validator-" + date + ".war"
+ val sbtPath = "src/main/resources/" + warName
if (Paths.get(sbtPath).toFile.exists) {
sbtPath
} else {
- val tmpPath = Paths.get(java.lang.System.getProperty("java.io.tmpdir")).resolve("css-validator.war")
+ val tmpPath = Paths.get(java.lang.System.getProperty("java.io.tmpdir")).resolve(warName)
// this extracts the war file and make it available in the tmp directory
if (! tmpPath.toFile.exists) {
- val is: InputStream = getClass().getResourceAsStream("/css-validator.war")
+ val is: InputStream = getClass().getResourceAsStream("/" + warName)
Files.copy(is, tmpPath)
}
tmpPath.toString

0 comments on commit 558fb37

Please sign in to comment.
Something went wrong with that request. Please try again.