REBOL [ Title: "FTP new topic file and TOC updates" ] ;; [---------------------------------------------------------------------------] ;; [ This is a utility program to send, by ftp, a selected topic file to ] ;; [ the host site, PLUS the other two files that contain the table of ] ;; [ contents. Theoretically, whenever we make a new topic file, we update ] ;; [ the tables of contents, so it is necessary to send them with the new ] ;; [ topic file in all cases. ] ;; [---------------------------------------------------------------------------] ;; [---------------------------------------------------------------------------] ;; [ The following items are the credentials for the web site. ] ;; [ We have determined by trial and error, and with some help from ] ;; [ REBOLers now forgotten, that this is a way to do the ftp when the ] ;; [ user ID contains special characters. In our case, the user ID is ] ;; [ an email address. ] ;; [---------------------------------------------------------------------------] WEBSITE-ADDR: "xxxxxxxxxxxxxxx.com" WEBSITE-USERID: "uuuuuuuuuu@xxxxxxxxxxxxxxx.com WEBSITE-PASSWORD: "pppppppppp" ;; [---------------------------------------------------------------------------] ;; [ These are the data structures that seem to be required to send the ] ;; [ files we want to send. The tenth item in each block is the file ] ;; [ name on the server. For the TOPIC-ADDR block, that item will be ] ;; [ overwritten when we request the file to send. For the others, ] ;; [ we know now the file names, so we will hard code them. ] ;; [---------------------------------------------------------------------------] TOPIC-ADDR: [ scheme: 'ftp host: WEBSITE-ADDR user: WEBSITE-USERID pass: WEBSITE-PASSWORD target: %. ] INDEX-ADDR: [ scheme: 'ftp host: WEBSITE-ADDR user: WEBSITE-USERID pass: WEBSITE-PASSWORD target: %rebol-for-cobol-programmers/rfcp-index.html ] TOC-ADDR: [ scheme: 'ftp host: WEBSITE-ADDR user: WEBSITE-USERID pass: WEBSITE-PASSWORD target: %rebol-for-cobol-programmers/rfcp-write-toc.js ] ;; [---------------------------------------------------------------------------] ;; [ Begin. ] ;; [---------------------------------------------------------------------------] ;; -- We run this script from the level above rebol-for-cobol-programmers ;; -- on our local computer. change-dir %rebol-for-cobol-programmers ;; -- Ask for the name of the file to send. REQUESTED-FILE: request-file/only ;; -- Take apart the name into the final file name plus the path to it. set [PATH-TO-SEND FILE-TO-SEND] split-path REQUESTED-FILE ;; -- Construct the name of the file on the ftp site. TOPIC-ADDR/10: to-file rejoin [ "rebol-for-cobol-programmers/" FILE-TO-SEND ] ;; -- Read the requested file and send it to the ftp site. write/binary TOPIC-ADDR read/binary REQUESTED-FILE ;; -- Send the index and TOC, which have known file names. write/binary INDEX-ADDR read/binary %rfcp-index.html write/binary TOC-ADDR read/binary %rfcp-write-toc.js ;; -- Pop up a reassuring alert box before quitting. alert "Files have been sent"