gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] (no subject)


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] (no subject)
Date: Fri, 27 May 2016 09:31:57 +0000 (UTC)

branch: master
commit 01b0e9c9cd84541e705ba8bc77e02ac47effad31
Author: Mohammad Akhlaghi <address@hidden>
Date:   Fri May 27 15:23:45 2016 +0900

    Webpage checkout and temporary dirs on command-line
    
    The `doc/forwebpage' script is in charge of making and preparing the
    webpage files (in particular the book webpages). Until now the temporary
    and final directories were hard-wired into the script, but now they are
    read as two argumens to the script. Also if the temporary directory already
    exits, it will not attempt to completely delete it automatically, it will
    warn the user and abort.
---
 doc/forwebpage |   84 +++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 50 insertions(+), 34 deletions(-)

diff --git a/doc/forwebpage b/doc/forwebpage
index 001132c..6ec4fae 100755
--- a/doc/forwebpage
+++ b/doc/forwebpage
@@ -1,8 +1,17 @@
 #! /bin/bash
 
-# This shell script will first run gendocs.sh on the Texinfo source
-# which creates the standrard GNU webpage style documentation
-# page. Then it does some modifications to the HTMLs produced:
+# Prepare all Gnuastro webpages in a temporary directory, move the updated
+# files to the destination directory (local CVS checkout) and commit the
+# changes to the gnu.org/software/gnuastro webpage. Finally, delete the
+# temporary directory. See below for setting up the CVS checkout for the
+# first time. NOTE: This script is defined to be run in Gnuastro's `doc/'
+# directory. It should not be called from anywhere else.
+#
+#    ./forwebpage /temporary/directory /destination/directory
+#
+# This script will first run gendocs.sh on the Texinfo source which creates
+# the standrard GNU webpage style documentation page. Then it does some
+# modifications to the HTMLs produced:
 #
 # 1. Add a CSS sytlesheet.
 # 2. Add MathJax.
@@ -89,26 +98,32 @@ set -o errexit                  # Stop if a program returns 
false.
 # For the permissions of the output:
 umask 002
 
-# Top CVS (webpage checkout) copy
-TOPWEBCHECKOUT=~/Development/gnuastro-web
+# Set the temporary directory name:
+tmpdir=$1
 
-# Set the temporary output name:
-outdir=~/Development/gnuastro-manual-tmp
+# Top CVS (webpage checkout) copy
+topwebcheckout=$2
 
 # Set the title value
 booktitle="GNU Astronomy Utilities"
 
-# Remove the output directory if it exists (because gendocs.sh will write
-# everything there).
-if [ -d $outdir ]; then rm -rf $outdir; fi
+# If the temporary directory already exists, warn the user and abort.
+# gendocs.sh will write everything there and we want everything there to be
+# freshly created.
+if [ -d $tmpdir ]; then
+    echo; echo "$tmpdir exists!"
+    echo "Please delete it or specify another directory."
+    echo; echo "To delete it you can run: 'rm -rf $tmpdir'"
+    exit 1
+fi
 
 
 
 
 
-# The date that is printed on the manual is generated looking at the
-# modification time of gnuastro.texi, not `../configure' that was used to
-# generate the version number. This can cause confusion, since the version
+# The date that is printed on the manual is generated by looking at the
+# modification time of gnuastro.texi, not `../configure' (which was used to
+# generate the version number). This can cause confusion, since the version
 # number (coming from the commit) will have a different date in the
 # revision history. To avoid this, here we check if the `../configure'
 # modification date is similar to that on 'gnuastro.texi' or not. If it
@@ -146,15 +161,16 @@ fi
 
 
 
-# Generate authors.texi
-make authors.texi
+# This is run to make sure if all the GNU Build System files (like
+# stamp-vti) are up to date.
+make
 
 
 
 
 # Run gendocs.sh to generate all the files:
 ../bootstrapped/build-aux/gendocs.sh --email address@hidden gnuastro \
-   "$booktitle" --html " " -o $outdir -I ../bootstrapped/doc
+   "$booktitle" --html " " -o $tmpdir -I ../bootstrapped/doc
 
 
 
@@ -169,7 +185,7 @@ rm -f gnuastro.aux gnuastro.cp gnuastro.cps gnuastro.fn 
gnuastro.ky \
 
 
 # Copy the two necessary files in the manual directory:
-cp javascript.html style.css $outdir/
+cp javascript.html style.css $tmpdir/
 
 
 
@@ -199,25 +215,25 @@ echo
 htmldatecomment='<!-- Inserted date. This line will be ignored by diff -->'
 echo %%%%% Correcting the HTMLs %%%%%
 # Correct the address of the `(dir)' links on the top pages of both
-# HTML outputs. In the $outdir/gnuastro.html, it is `dir.html#top'
+# HTML outputs. In the $tmpdir/gnuastro.html, it is `dir.html#top'
 # which should be change to index.html. In
-# $outdir/html_node/index.html, it is `../dir/index.html' which
+# $tmpdir/html_node/index.html, it is `../dir/index.html' which
 # should become ../index.html
-cat $outdir/gnuastro.html | sed s/dir\.html\#Top/index.html/g > tmp.txt
-mv tmp.txt $outdir/gnuastro.html
-cat $outdir/html_node/index.html | sed -e 's/\/dir\//\//g' > tmp.txt
-mv tmp.txt $outdir/html_node/index.html
+cat $tmpdir/gnuastro.html | sed s/dir\.html\#Top/index.html/g > tmp.txt
+mv tmp.txt $tmpdir/gnuastro.html
+cat $tmpdir/html_node/index.html | sed -e 's/\/dir\//\//g' > tmp.txt
+mv tmp.txt $tmpdir/html_node/index.html
 
 if [ -f tmp.html ]; then rm tmp.html; fi
 
-for file in $outdir/gnuastro.html $outdir/html_node/*.html
+for file in $tmpdir/gnuastro.html $tmpdir/html_node/*.html
 do
     if grep -q '\\(\|$$' "$file";
     then hasjavascript="yes"
     else hasjavascript="no"
     fi
 
-    if [ "$file" != $outdir/gnuastro.html ] && [ "$file" != 
$outdir/html_node/index.html ];
+    if [ "$file" != $tmpdir/gnuastro.html ] && [ "$file" != 
$tmpdir/html_node/index.html ];
     then addtitle="yes"
     else addtitle="no"
     fi
@@ -226,7 +242,7 @@ do
 
         # Actions that must be done before a given line:
         if [ "$line" = "</head>" ]; then
-            if [ "$file" = $outdir/gnuastro.html ]; then
+            if [ "$file" = $tmpdir/gnuastro.html ]; then
                 cssbase="./"
                 jsbase="../"
             else
@@ -298,8 +314,8 @@ echo %%%%% DONE %%%%%
 
 # Copy the gnuastro-top.html page into index.html (by only if it actually
 # differs from it.
-if ! diff gnuastro-top.html $TOPWEBCHECKOUT/gnuastro/index.html; then
-    cp gnuastro-top.html $TOPWEBCHECKOUT/gnuastro/index.html
+if ! diff gnuastro-top.html $topwebcheckout/gnuastro/index.html; then
+    cp gnuastro-top.html $topwebcheckout/gnuastro/index.html
 fi
 
 
@@ -316,14 +332,14 @@ fi
 # the generated HTML files. This creates a difference even if
 IFS=$OLDIFS
 echo; echo; echo; echo "diff results:"
-for filename in $(find $outdir/ -type f -print)
+for filename in $(find $tmpdir/ -type f -print)
 do
     # realpath is part of GNU Coreutils.
-    relname=$(realpath $filename --relative-to=$outdir)
-    if ! diff $filename $TOPWEBCHECKOUT/gnuastro/manual/$relname \
+    relname=$(realpath $filename --relative-to=$tmpdir)
+    if ! diff $filename $topwebcheckout/gnuastro/manual/$relname \
             -I '<!-- This book documents version'                \
             -I "$htmldatecomment"; then
-        cp $filename $TOPWEBCHECKOUT/gnuastro/manual/$relname;
+        cp $filename $topwebcheckout/gnuastro/manual/$relname;
         echo "$relname:"
         echo " -- Copied to for upload"
     fi
@@ -333,12 +349,12 @@ done
 
 
 # Remove the temporary manual directory, since it isn't needed any more.
-rm -rf $outdir
+rm -rf $tmpdir
 
 
 
 
 # Go into the top CVS directory, and commit the new changes to the GNU
 # server.
-cd $TOPWEBCHECKOUT/gnuastro/
+cd $topwebcheckout/gnuastro/
 cvs commit -m "Update"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]