rebol [ Title: "Build COMLib website" File: %build-comlib-website.r Date: 3-Jan-2009 Version: 1.0.8 Progress: 0.6 Status: "Working, tested on View 2.7.6.4.2 on Kubuntu Linux." Needs: [] Author: "Anton Rolls" Language: "English" Purpose: {Create the COMLib zipped distribution files, html documentation, and html index file} Usage: {} History: [ 1.0.0 [13-Dec-2005 {First version, testing on View 1.3.2.3.1} "Anton"] 1.0.1 [26-Jun-2006 {changed from using Robert's make-doc-pro1.09 -> Carl Sassenrath's makedoc2.5.6, then stopped using it, split off content to template-index.html and generating the html myself} "Anton"] 1.0.2 [27-Jun-2006 {abstracted the templating system a bit and added a second page template} "Anton"] 1.0.3 [28-Jun-2006 {now there is a single source for the list of distro-files (in this script)} "Anton"] 1.0.4 [30-Jun-2006 {removed some old discarded code from Notes} "Anton"] 1.0.5 [06-Jul-2006 {added ado.r and whales.xls to files} "Anton"] 1.0.6 [10-Jul-2006 {added notes.txt, future.txt and history.txt to files} "Anton"] 1.0.7 [14-Jul-2006 {added outlook-calendar.r outlook-contacts.r to files} "Anton"] 1.0.8 [3-Jan-2009 {Modified 7z command-line for linux.} "Anton"] ] ToDo: { - this script should be run twice before uploading, because the distro archives and the html files reflect each other. (even then they might not be 100% accurate...) - upload all distro-files and the distro archives automatically ? - go away and finish that batch-upload script - unhardcode the 7-zip directory location - get ideas from util/site-build.r ? } Notes: { This script needs the GPL archiver 7Zip. You must download and install 7zip to get automated creation of the zips. http://www.7-zip.org/7z.html (and currently you must change the hard-coded path in command-line to your install location.) http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=makedoc2.r } ] ; Create distros in zip archives ;eg ;COMLib-anton-full-20060627.zip ;COMLib-anton-med-20060627.zip ;COMLib-anton-min-20060627.zip distro-archives: [ %zips/COMLib-anton-full- "Full distribution including docs, source and demo code." %zips/COMLib-anton-med- "Medium distribution without source." %zips/COMLib-anton-min- "Minimum distribution containing just comlib.r and com2rebol.dll" ] distro-files: [ min %com2rebol.dll "Needed by COMLib.r" min %COMLib.r "DO this from Rebol." med %simple-start-comlib.r "The simplest, open/close COMLib script" med %test-comlib.r "My script for testing bugs and new features." ;"Shows how to use COMLib.r" med %demos/ado.r "ActiveX Data Objects read and manipulate data from a data source." med %demos/excel.r "Create an Excel spreadsheet with data and a chart" med %demos/IEpopup.r "Pop up a minimal Internet Explorer window to show some HTML" med %demos/IEPrint.r "Print from Internet Explorer" med %demos/MSScriptControl.r "MSScriptControl (adapted from scriptctl.c)" med %demos/outlook-calendar.r "Extract data from Outlook Calendar" med %demos/outlook-contacts.r "Print full name of each contact in Outlook's contact list." ; These not working yet ;med %demos/WMI.r "Demonstrates using Windows Management Instrumentation(WMI)." ;med %demos/WMI_HOTFIXES.r "Enumerate Instaled HotFixes" med %demos/speech.r "Microsoft Agent and SAPI provide text-to-speech" med %demos/whales.xls "used by ado.r" med %demos/word-formatted-table.r "Add a formatted table to a Word document." med %demos/word-formatted-text.r "Add formatted text to a Word document" med %demos/word-open.doc "opened by word-open-save.r" med %demos/word-open-save.r "Save a Word document." med %demos/word-picture.r "Add an image file to a Word document." med %demos/word-print.r "Print from Word" med %demos/word-save-html.r "Create a Word document and have Word save it as HTML." full %docs/files-template.html "used by build-comlib-website.r" full %docs/build-comlib-website.r "builds this website" med %docs/COMLib-overview-diagram.r "Generates the COMLib-overview-diagram.png" med %docs/convert-ben-to-anton.txt "Migrating from Ben's COMLib distribution -> COMLib-anton" med %docs/future.txt "Future plans / to-do list" med %docs/history.txt "History / changelog" full %docs/index-template.html "used by build-comlib-website.r" med %docs/notes.txt "Anton's notes and miscellany" full %source/com2rebol.c "C source for com2rebol.dll" full %source/com2rebol.h "C header for com2rebol.dll" full %source/disphelper.c "DispHelper source, needed by com2rebol" full %source/disphelper.h "DispHelper source, needed by com2rebol" ] script-time: now form-date-tight: func [dt][rejoin [dt/year either dt/month < 10 ["0"][""] dt/month either dt/day < 10 ["0"][""] dt/day]] foreach distro [min med full][ archive-name: join %zips/COMLib-anton- [distro "-" form-date-tight script-time %.zip] ; prepare files for this distro files: copy [] foreach [distro-size file description] distro-files [ if find select [min [min] med [min med] full [min med full]] distro distro-size [append files file] ] ;new-line/all files on ;print [distro archive-name mold files] ; Use 7-zip D:\Programs\7-Zip\7z.exe a -tzip archive_name file_names... @listfile... ; a = Add files to archive ; u = Update files to archive ; -t{Type}: Set type of archive, eg: -tzip creates a zip file (7z is default) ; @listfile is a file containing newline-separated filenames ; Prepare list-file to pass to 7z.exe to create zip (in case a list-file is needed) ;list-file: join %create-zip- [distro %.bat] ;save list-file files ;probe rejoin ["D:\Programs\7-Zip\7z.exe a -tzip " archive-name "@" list-file] ;command-line: rejoin ["D:\Programs\7-Zip\7z.exe a -tzip " archive-name] ;<--- hard-coded 7-zip directory location; WinXP command-line: rejoin ["7z a -tzip " archive-name] ;<--- hard-coded 7-zip directory location; Linux foreach file files [repend command-line [" " to-local-file file]] ;?? command-line change-dir %../ ; we are in docs/, so change to parent temporarily call/console/wait command-line change-dir %docs/ ] ; Create diagram image file save/png %../COMLib-overview-diagram.png do %COMLib-overview-diagram.r ; Create and view html foreach page reduce [ [ output-file %../index.html template %index-template.html title "COMLib-anton" ] [ output-file %../files.html template %files-template.html title "COMLib-anton files" ] ][ html: read page/template foreach [key value] compose [ (page/title) ; (page/subtitle) "" "" "" ; this key should be before the [filelist] key so it gets processed first "" ; this key should also be before the [filelist] key so it gets processed first "" (now) ][ key-pos: head html while [ all [ key-pos: find key-pos key content-pos: find/match key-pos key content-end: find content-pos key-end: find/match content-end ] ][ case [ find key "[image]" [ file: to-file copy/part content-pos content-end remove/part key-pos key-end insert key-pos rejoin [ {
| } {} file | ]][[ ; is a file {} {} file | any [attempt [version? join %../ file] ""] | size? join %../ file | modified? join %../ file | any [description ""] | ]]