added auto version insertion
authorjkkn <jkkn>
Wed, 17 Oct 2007 09:19:28 +0000 (09:19 +0000)
committerjkkn <jkkn>
Wed, 17 Oct 2007 09:19:28 +0000 (09:19 +0000)
build.sh
chrome.manifest
content/about.xul
install.rdf
tv2developer.xpi [deleted file]
version [new file with mode: 0644]
webroot/.htaccess [new file with mode: 0644]

index e8f17fc1b0bf340631747c751e741af66cefc108..79671e53f4646a2a440c395221a2a40c2661b28e 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -57,37 +57,45 @@ TMP_DIR=build
 #set -x
 
 # remove any left-over files from previous build
-rm $APP_NAME.jar
-rm $APP_NAME.xpi
-rm files
-rm -rf $TMP_DIR
+rm $APP_NAME.jar 2>/dev/null
+rm $APP_NAME.xpi 2>/dev/null
+rm files 2>/dev/null
+rm -rf $TMP_DIR 2>/dev/null
 
-vi install.rdf content/about.xul
+#vi install.rdf content/about.xul
 
 $BEFORE_BUILD
 
+VERSION=`head -1 version`
+
+echo "Build for version $VERSION..."
+
+
 mkdir -pv $TMP_DIR/chrome
+mkdir -pv $TMP_DIR/chrome-tmp
 
 # generate the JAR file, excluding CVS and temporary files
 JAR_FILE=$TMP_DIR/chrome/$APP_NAME.jar
-echo "Generating $JAR_FILE..."
 for CHROME_SUBDIR in $CHROME_PROVIDERS; do
-  find $CHROME_SUBDIR -path '*CVS*' -prune -o -type f -print | grep -v \~ >> files
+  cp -r $CHROME_SUBDIR $TMP_DIR/chrome-tmp/ 
 done
 
-zip -0 -r $JAR_FILE `cat files`
 # The following statement should be used instead if you don't wish to use the JAR file
 #cp --verbose --parents `cat files` $TMP_DIR/chrome
 
 # prepare components and defaults
 echo "Copying various files to $TMP_DIR folder..."
 for DIR in $ROOT_DIRS; do
-  mkdir $TMP_DIR/$DIR
   FILES="`find $DIR -path '*CVS*' -prune -o -type f -print | grep -v \~`"
   echo $FILES >> files
-  cp -v -r $DIR $TMP_DIR
+  cp -r $DIR $TMP_DIR
 done
 
+# Remove CVS dirs
+echo `pwd`
+echo $TMP_DIR
+find $TMP_DIR -path '*CVS*' -type d -print0 | xargs -0 rm -rf
+
 # Copy other files to the root of future XPI.
 for ROOT_FILE in $ROOT_FILES install.rdf chrome.manifest; do
   cp -v $ROOT_FILE $TMP_DIR
@@ -100,6 +108,12 @@ cd $TMP_DIR
 
 if [ -f "chrome.manifest" ]; then
   echo "Preprocessing chrome.manifest..."
+
+  perl -pi -e "s/^(content\s+\S*\s+)(\S*\/)$/\1jar:chrome\/$APP_NAME\.jar!\/\\2/g" chrome.manifest
+  perl -pi -e "s/^(skin|locale)(\s+\S*\s+\S*\s+)(.*\/)$/\1\2jar:chrome\/$APP_NAME\.jar!\/\3/g" chrome.manifest
+
+  cat chrome.manifest
+
   # You think this is scary?
   #s/^(content\s+\S*\s+)(\S*\/)$/\1jar:chrome\/$APP_NAME\.jar!\/\2/
   #s/^(skin|locale)(\s+\S*\s+\S*\s+)(.*\/)$/\1\2jar:chrome\/$APP_NAME\.jar!\/\3/
@@ -111,6 +125,17 @@ if [ -f "chrome.manifest" ]; then
   # (it simply adds jar:chrome/whatever.jar!/ at appropriate positions of chrome.manifest)
 fi
 
+# updating version information - added jkkn
+find . -type f \( -name "*.js" -or -name "*.xul" -or -name "*.rdf" \) | while read y; do
+perl -pi -e "s/\\\$\{VERSION}/$VERSION/g" $y;
+done
+
+echo "Generating $JAR_FILE..."
+cd chrome-tmp
+zip -0 -r ../../$JAR_FILE *
+cd ..
+rm -rf chrome-tmp
+
 # generate the XPI file
 echo "Generating $APP_NAME.xpi..."
 zip -r ../$APP_NAME.xpi *
@@ -128,8 +153,13 @@ fi
 # remove the working files
 rm -rf $TMP_DIR
 
-cp -v tv2developer.xpi /sites/jkkndk/www.jkkn.net/webroot/tv2developer/
-vi /sites/jkkndk/www.jkkn.net/webroot/tv2developer/update.rdf
+WEBPATH=/sites/jkkndk/www.jkkn.net/webroot/tv2developer/
+cp -v tv2developer.xpi $WEBPATH
+cp -R webroot/ $WEBPATH
+find $WEBPATH -path '*CVS*' -type d -print0 | xargs -0 rm -rf
+find $WEBPATH -type f \( -name "*.html" -or -name "*.php" -or -name "*.rdf" \) | while read y; do
+    perl -pi -e "s/\\\${VERSION}/$VERSION/g" $y;
+done
 echo "Done!"
 
 $AFTER_BUILD
index dcd02278a32bda4120959ce04bad35111f76f199..d6e517399d28211f004cba84208831f84d3b91a3 100755 (executable)
@@ -1,6 +1,6 @@
-content        tv2developer    jar:chrome/tv2developer.jar!/content/
-skin   tv2developer    classic/1.0     jar:chrome/tv2developer.jar!/skin/
-locale tv2developer    en-US   jar:chrome/tv2developer.jar!/locale/en-US/
+content        tv2developer    content/
+skin   tv2developer    classic/1.0     skin/
+locale tv2developer    en-US   locale/en-US/
 
 overlay        chrome://browser/content/browser.xul    chrome://tv2developer/content/browser_overlay.xul
 style chrome://global/content/customizeToolbar.xul chrome://tv2developer/skin/tv2developer.css
index e091aa3c9ca87bfb039f388b5bf7e3d434884a99..b47b8f28888774a3f7591a8cdef3ed704371a958 100755 (executable)
@@ -11,7 +11,7 @@
 <groupbox align="center" orient="horizontal">
 <vbox>
   <text value="TV 2 Developer Plugin" style="font-weight: bold; font-size: x-large;"/>
-  <text value="&version; 0.4.14"/>
+  <text value="&version; ${VERSION}"/>
   <separator class="thin"/>
   <text value="&createdBy;" style="font-weight: bold;"/>
   <text value="Kristian Kræmmer Nielsen &lt;jkkn@tv2.dk&gt;" class="url"
index 97a09203f83209382768b47f2e46c1325aa3f76a..e181d32257323ecb5a3df0761b168dc8f3baf46e 100755 (executable)
@@ -6,7 +6,7 @@ xmlns:em="http://www.mozilla.org/2004/em-rdf#">
     
         <em:id>{17AB1CC5-F137-4697-9E48-D8C49AFC3B77}</em:id>
         <em:name>TV 2 Developer Plugin</em:name>
-        <em:version>0.4.14</em:version>
+        <em:version>${VERSION}</em:version>
         <em:description>Adds a menu with tv2.dk development URLs depending on the tv2-page you are visting.</em:description>
         <em:creator>Kristian Kræmmer Nielsen</em:creator>
         <em:homepageURL>http://jkkn.dk/tv2developer/</em:homepageURL>
diff --git a/tv2developer.xpi b/tv2developer.xpi
deleted file mode 100644 (file)
index ccb684e..0000000
Binary files a/tv2developer.xpi and /dev/null differ
diff --git a/version b/version
new file mode 100644 (file)
index 0000000..4ea988f
--- /dev/null
+++ b/version
@@ -0,0 +1 @@
+0.4.15
diff --git a/webroot/.htaccess b/webroot/.htaccess
new file mode 100644 (file)
index 0000000..6134935
--- /dev/null
@@ -0,0 +1 @@
+AddType application/x-xpinstall .xpi