Revision: 1633
Author: sebastien.lelong
Date: Tue Jan 26 08:22:46 2010
Log: automate TOC/front page for jallib tutorials "book"
http://code.google.com/p/jallib/source/detail?r=1633

Modified:
 /trunk/doc/dita/TOPUBLISH
 /trunk/doc/dita/tutorials/Makefile
 /trunk/tools/build/publish.sh

=======================================
--- /trunk/doc/dita/TOPUBLISH   Mon Jan 25 11:09:35 2010
+++ /trunk/doc/dita/TOPUBLISH   Tue Jan 26 08:22:46 2010
@@ -15,34 +15,33 @@
 #
# A special DITA is the "ditamap". From this file a Table Of Content (TOC) is extracted and generated. If # a new line has been added (a new page to publish), then also update ditamap's timestamp so the TOC
-# is generated
+# is generated.

 # ditamap
-tutorials/tutorials.ditamap                                               
japp_config.py                  2010012501
+tutorials/tutorials.ditamap japp_config.py 2010012601
 # DITA xml
-tutorials/license.xml                                                     
japp_config.py                  2010012502
-tutorials/tutorial_adc_intro.xml                                  
japp_config.py                  2010012501
-tutorials/tutorial_basics.xml                                     
japp_config.py                  2010012501
-tutorials/tutorial_blink_a_led.xml                                
japp_config.py                  2010012501
-#tutorials/tutorial_book.xml                                              
japp_config.py                  2010012501
-tutorials/tutorial_changelog.xml                                  
japp_config.py                  2010012501
-tutorials/tutorial_externals.xml                                  
japp_config.py                  2010012501
-tutorials/tutorial_getting_started.xml                    japp_config.py       
           2010012501
-tutorials/tutorial_gp2d02.xml                                     
japp_config.py                  2010012501
-tutorials/tutorial_i2c1.xml                                               
japp_config.py                  2010012501
-tutorials/tutorial_i2c2.xml                                               
japp_config.py                  2010012501
-tutorials/tutorial_i2c3.xml                                               
japp_config.py                  2010012501
-tutorials/tutorial_ICSP.xml                                               
japp_config.py                  2010012501
-tutorials/tutorial_installation.xml                               
japp_config.py                  2010012501
-tutorials/tutorial_lcd.xml                                                
japp_config.py                  2010012501
-tutorials/tutorial_pata_hard_disk.xml                     japp_config.py       
           2010012501
-tutorials/tutorial_peripherals.xml                                
japp_config.py                  2010012501
-tutorials/tutorial_pwm1.xml                                               
japp_config.py                  2010012501
-tutorials/tutorial_pwm2.xml                                               
japp_config.py                  2010012501
-tutorials/tutorial_pwm_intro.xml                                  
japp_config.py                  2010012501
-tutorials/tutorial_sd_card.xml                                    
japp_config.py                  2010012501
-tutorials/tutorial_serial_communication.xml japp_config.py 2010012501
-tutorials/tutorial_serial_port_board.xml                  japp_config.py       
           2010012501
-tutorials/tutorial_spi_introduction.xml                           
japp_config.py                  2010012501
-tutorials/tutorial_spi_sram_23k256.xml                    japp_config.py       
           2010012502
-
+tutorials/license.xml japp_config.py 2010012502 +tutorials/tutorial_adc_intro.xml japp_config.py 2010012501 +tutorials/tutorial_basics.xml japp_config.py 2010012501 +tutorials/tutorial_blink_a_led.xml japp_config.py 2010012501 +tutorials/tutorial_changelog.xml japp_config.py 2010012501 +tutorials/tutorial_externals.xml japp_config.py 2010012501 +tutorials/tutorial_getting_started.xml japp_config.py 2010012501 +tutorials/tutorial_gp2d02.xml japp_config.py 2010012501 +tutorials/tutorial_i2c1.xml japp_config.py 2010012501 +tutorials/tutorial_i2c2.xml japp_config.py 2010012501 +tutorials/tutorial_i2c3.xml japp_config.py 2010012501 +tutorials/tutorial_ICSP.xml japp_config.py 2010012501 +tutorials/tutorial_installation.xml japp_config.py 2010012501 +tutorials/tutorial_lcd.xml japp_config.py 2010012501 +tutorials/tutorial_pata_hard_disk.xml japp_config.py 2010012501 +tutorials/tutorial_peripherals.xml japp_config.py 2010012501 +tutorials/tutorial_pwm1.xml japp_config.py 2010012501 +tutorials/tutorial_pwm2.xml japp_config.py 2010012501 +tutorials/tutorial_pwm_intro.xml japp_config.py 2010012501 +tutorials/tutorial_sd_card.xml japp_config.py 2010012501 +tutorials/tutorial_serial_communication.xml japp_config.py 2010012501 +tutorials/tutorial_serial_port_board.xml japp_config.py 2010012501 +tutorials/tutorial_spi_introduction.xml japp_config.py 2010012501 +tutorials/tutorial_spi_sram_23k256.xml japp_config.py 2010012502
+
=======================================
--- /trunk/doc/dita/tutorials/Makefile  Thu Jan 21 06:57:12 2010
+++ /trunk/doc/dita/tutorials/Makefile  Tue Jan 26 08:22:46 2010
@@ -1,6 +1,7 @@


-VERSION=dev
+VERSION=0.2
+JAPPCONF=japp_config.py

 prepare:
        -rm -fr tmp
@@ -16,10 +17,13 @@
 front: html
        # this page is only dedicated to website, it needs to integrate TOC
        # prepare generated TOC for web publishing
- cd ../../../tools/japp && python htmlizer.py japp_config.py ../../doc/dita/tutorials/tmp/toc.html + cd ../../../tools/japp && python2.5 htmlizer.py ${JAPPCONF} ../../doc/dita/tutorials/tmp/toc.html ant -Dargs.transtype=xhtml -Doutput.dir=`pwd`/tmp -Dargs.input=`pwd`/tutorial_book.xml -Dargs.target=init -f $$DITA_HOME/build.xml dita2xhtml
        # the beauty and magic of sed :)
cat tmp/tutorial_book.html | sed -e '/Table of Content/rtmp/topublish/content' -e "s...@version@#${VERSION}#g" > tmp/tutorial_book.html.toc
        mv tmp/tutorial_book.html.toc tmp/tutorial_book.html
        mv tmp/topublish tmp/topublish.toc
- cd ../../../tools/japp && python htmlizer.py japp_config.py ../../doc/dita/tutorials/tmp/tutorial_book.html + cd ../../../tools/japp && python2.5 htmlizer.py ${JAPPCONF} ../../doc/dita/tutorials/tmp/tutorial_book.html
+
+publish-front: front
+ cd ../../../tools/japp && python2.5 publish.py ${JAPPCONF} ../../doc/dita/tutorials/tmp/topublish
=======================================
--- /trunk/tools/build/publish.sh       Mon Jan 25 11:07:47 2010
+++ /trunk/tools/build/publish.sh       Tue Jan 26 08:22:46 2010
@@ -9,12 +9,19 @@

 start_time=`date +%s`

-export JALLIB_ROOT=`pwd`/../build      # correct when set by buildbot
-##export JALLIB_ROOT=`pwd`/../..       # run manually here
-export JALLIB_DITA=$JALLIB_ROOT
-export JALLIB_TOOLS=`pwd`/../tools
+# when run by buildbot
+export JALLIB_ROOT=`pwd`
+export JALLIB_DITA=$JALLIB_ROOT/doc/dita
+export JALLIB_TOOLS=$JALLIB_ROOT/tools
 export JALLIB_TOPUBLISH=$JALLIB_DITA/TOPUBLISH

+### when run manually
+##export JALLIB_ROOT=`pwd`/../..
+##export JALLIB_DITA=$JALLIB_ROOT/doc/dita
+##export JALLIB_TOOLS=$JALLIB_ROOT/tools
+##export JALLIB_TOPUBLISH=$JALLIB_DITA/TOPUBLISH
+
+
 JALLIB_TMP=$JALLIB_ROOT/tmp
 mkdir -p $JALLIB_TMP

@@ -29,14 +36,17 @@

 # extracting changed lines
 svncmd="svn info $JALLIB_TOPUBLISH"
+echo "$svncmd"
 LANG=C $svncmd
reposrev=`LANG=C $svncmd | grep ^Revision: | sed "s#Revision:##" | sed "s# ##g"`
 lastrev=`cat $JALLIB_LASTREVFILE`
 at_least_one_failed=0
 counter=0
 # replace spaces on the fly to read whole line by whole line...
-echo svn diff -r$lastrev:$reposrev $JALLIB_TOPUBLISH
-for file in `cat <(svn diff -r$lastrev:$reposrev $JALLIB_TOPUBLISH | grep "^+" | grep -v -e "^+#" -e "^+[[:space:]]*$" -e "^+++" | sed "s# \| \t#___#g")`
+svncmd="svn diff -x -b -r$lastrev:$reposrev $JALLIB_TOPUBLISH"
+###svncmd="svn diff -x -b -r$lastrev $JALLIB_TOPUBLISH"
+echo $svncmd
+for file in `cat <($svncmd | grep "^+" | grep -v -e "^+#" -e "^+[[:space:]]*$" -e "^+++" | sed "s# \|\t#___#g")`
 do
    pushd $JALLIB_TOOLS/japp

@@ -45,16 +55,37 @@
    conf=`echo $cmdline | awk '{print $2}'`
    basedita=`basename $dita`
    # let's publish...
-   echo
-   echo Publishing $basedita using $conf configuration
-   echo
-   echo $dita | ./japp.sh $conf
-   # pipe: exit code is from the right side, this is what we want
-   if [ "$?" != "0" ]
+   ismap=`echo $dita | grep -c "\.ditamap\$"`
+   if [ "$ismap" = "0" ]
    then
-         echo "Failed to publish $basedita" >> $JALLIB_TMP/publish.failed
-         at_least_one_failed=1
-         counter=`expr $counter + 1`
+      echo
+      echo Publishing $basedita using $conf configuration
+      echo
+      echo $dita | ./japp.sh $conf
+      # pipe: exit code is from the right side, this is what we want
+      if [ "$?" != "0" ]
+      then
+         echo "Failed to publish $basedita" >> $JALLIB_TMP/publish.failed
+         at_least_one_failed=1
+         counter=`expr $counter + 1`
+      fi
+   else
+      echo
+      echo Publishing ditamap $basedita using $conf configuration
+      echo
+      if ! test -s "$JAPP_DITAMAP_SCRIPT"
+      then
+         echo "Can't find script defined in JAPP_DITAMAP_SCRIPT"
+         exit 255
+      fi
+         # black magic...
+      JAPPCONF=$conf $JAPP_DITAMAP_SCRIPT
+      if [ "$?" != "0" ]
+      then
+ echo "Failed to publish ditamap $basedita" >> $JALLIB_TMP/publish.failed
+         at_least_one_failed=1
+         counter=`expr $counter + 1`
+      fi
    fi

    popd

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to