Source

shlomi-fish-homepage / Howto.cook

Diff from to

Howto.cook

 /*
  * t2 macros
  */
-T2_DOCS = [shell bash find-wmls-t2.sh];
-T2_DEST_BASE = /var/www/html/shlomi/;
-T2_DEST_DIR = t2-homepage;
-T2_DEST = [T2_DEST_BASE][T2_DEST_DIR];
 
+DEST_BASE = /var/www/html/shlomi/;
 
-T2_WML_FLAGS = [WML_FLAGS] -DSERVER\=t2;
-T2_DOCS_DEST = [patsubst t2/%.wml [T2_DEST]/% [T2_DOCS]];
-T2_DIRS = [shell find t2 -type d | grep -v \'/\\.svn\' | grep -v \'^\\.svn\' | tail +2];
-T2_DIRS_DEST = [patsubst t2/% [T2_DEST]/% [T2_DIRS]];
-T2_IMAGES = [shell find t2 -type f -not -name \'*.wml\' -not -name \'.*\' | grep -v \'/\\.svn\' | grep -v \'~$\'];
-T2_IMAGES_DEST = [patsubst t2/% [T2_DEST]/% [T2_IMAGES]];
+myhosts = t2 vipe;
 
+loop host = [myhosts]
+{
+    [host]_DOCS = [shell bash find-wmls-[host].sh];
+    [host]_DEST_DIR = [host]-homepage;
+    [host]_DEST = [DEST_BASE][[host]_DEST_DIR];
+    [host]_WML_FLAGS = [WML_FLAGS] -DSERVER\=[host];
+    [host]_DOCS_DEST = [patsubst [host]/%.wml [[host]_DEST]/% [[host]_DOCS]];
+    
+    [host]_DIRS = [shell find [host] -type d | grep -v \'/\\.svn\' | grep -v \'^\\.svn\' | tail +2];
+    [host]_DIRS_DEST = [patsubst [host]/% [[host]_DEST]/% [[host]_DIRS]];
+    [host]_IMAGES = [shell find [host] -type f -not -name \'*.wml\' -not -name \'.*\' | grep -v \'/\\.svn\' | grep -v \'~$\'];
+    [host]_IMAGES_DEST = [patsubst [host]/% [[host]_DEST]/% [[host]_IMAGES]];
+
+    [host]_TARGETS = [[host]_DIRS_DEST] [[host]_DOCS_DEST] [[host]_DEST]/style.css [[host]_IMAGES_DEST];
+}
+
+/* all : mydebug; */
+
+all : [t2_DIRS_DEST];
+
+/* all: [t2_TARGETS] [vipe_TARGETS]; */
 /*
- * vipe macros
+ * all: $(t2_DIRS_DEST) $(t2_DOCS_DEST)
  */
-VIPE_DOCS = [shell bash find-wmls-vipe.sh];
-VIPE_DEST_BASE = /var/www/html/shlomi/;
-VIPE_DEST_DIR = vipe-homepage;
-VIPE_DEST = [VIPE_DEST_BASE][VIPE_DEST_DIR];
-VIPE_WML_FLAGS = [WML_FLAGS] -DSERVER\=vipe;
-VIPE_DOCS_DEST = [patsubst vipe/%.wml [VIPE_DEST]/% [VIPE_DOCS]];
-VIPE_DIRS = [shell find vipe -type d | grep -v \'/\\.svn\' | grep -v \'^\\.svn\' | tail +2];
-VIPE_DIRS_DEST = [patsubst vipe/% [VIPE_DEST]/% [VIPE_DIRS]];
-VIPE_IMAGES = [shell find vipe -type f -not -name \'*.wml\' -not -name \'.*\' | grep -v \'/\\.svn\' | grep -v \'~$\'];
-VIPE_IMAGES_DEST = [patsubst vipe/% [VIPE_DEST]/% [VIPE_IMAGES]];
 
-T2_TARGETS = [T2_DIRS_DEST] [T2_DOCS_DEST] [T2_DEST]/style.css [T2_IMAGES_DEST];
-
-VIPE_TARGETS = [VIPE_DIRS_DEST] [VIPE_DOCS_DEST] [VIPE_DEST]/style.css [VIPE_IMAGES_DEST];
-
-
-all: [T2_TARGETS] [VIPE_TARGETS];
-/*
- * all: $(T2_DIRS_DEST) $(T2_DOCS_DEST)
- */
-if [not [defined RSYNC]] then
-	RSYNC = rsync --progress --verbose --rsh\=ssh;
+RSYNC = rsync --progress --verbose --rsh\=ssh;
 
 upload: all
 {
-	echo T2_DEST \= [T2_DEST];
-	( cd [T2_DEST] && [RSYNC] -r * shlomif@t2.technion.ac.il\:public_html/ );
-	echo VIPE_DEST \= [VIPE_DEST];
-	( cd [VIPE_DEST] && [RSYNC] -r * shlomif@vipe.technion.ac.il\:public_html/ );
+	echo t2_DEST \= [t2_DEST];
+	( cd [t2_DEST] && [RSYNC] -r * shlomif@t2.technion.ac.il\:public_html/ );
+	echo vipe_DEST \= [vipe_DEST];
+	( cd [vipe_DEST] && [RSYNC] -r * shlomif@vipe.technion.ac.il\:public_html/ );
 }
 clean:
 {
-	rm -fr [T2_DEST]/\*;
-	rm -fr [VIPE_DEST]/\*;
-}
-/*
- * t2 targets
- */
-[T2_DEST]/%0%: t2/%0%.wml template.wml t2/.wmlrc
-	if [in [target] [T2_DOCS_DEST]]
-{
-	( cd t2 && wml [T2_WML_FLAGS] -DFILENAME\=[patsubst [T2_DEST]/% % [patsubst %.wml % [target]]] [patsubst t2/% % [resolve [head [need]]]] > [target] );
-}
-[T2_DEST]/%0%: unchanged
-	if [in [target] [T2_DIRS_DEST]]
-{
-	mkdir -p [target];
-	touch [target];
-}
-[T2_DEST]/%0%: t2/%0%
-	if [in [target] [T2_IMAGES_DEST]]
-{
-	cp -f [resolve [head [need]]] [target];
-}
-[T2_DEST]/style.css: style.css
-{
-	cp -f [resolve [head [need]]] [target];
-}
-/*
- * vipe targets
- */
-[VIPE_DEST]/%0%: vipe/%0%.wml template.wml vipe/.wmlrc
-	if [in [target] [VIPE_DOCS_DEST]]
-{
-	( cd vipe && wml [VIPE_WML_FLAGS] -DFILENAME\=[patsubst [VIPE_DEST]/% % [patsubst %.wml % [target]]] [patsubst vipe/% % [resolve [head [need]]]] > [target] );
-}
-[VIPE_DEST]/%0%: unchanged
-	if [in [target] [VIPE_DIRS_DEST]]
-{
-	mkdir -p [target];
-	touch [target];
-}
-[VIPE_DEST]/%0%: vipe/%0%
-	if [in [target] [VIPE_IMAGES_DEST]]
-{
-	cp -f [resolve [head [need]]] [target];
-}
-[VIPE_DEST]/style.css: style.css
-{
-	cp -f [resolve [head [need]]] [target];
+	rm -fr [t2_DEST]/\*;
+	rm -fr [vipe_DEST]/\*;
 }
 
+loop host = [myhosts]
+{
+    /* Targets Processing */
+
+    [[host]_DEST]/%0%: [host]/%0%.wml template.wml [host]/.wmlrc
+        if [in [target] [[host]_DOCS_DEST]]
+    {
+        ( cd [host] && wml [[host]_WML_FLAGS] -DFILENAME\=[patsubst [[host]_DEST]/% % [patsubst %.wml % [target]]] [patsubst [host]/% % [resolve [head [need]]]] > [target] );
+    }
+    [[host]_DEST]/%0%: unchanged
+        if [in [target] [[host]_DIRS_DEST]]
+    {
+        mkdir -p [target];
+        touch [target];
+    }
+    [[host]_DEST]/%0%: [host]/%0%
+        if [in [target] [[host]_IMAGES_DEST]]
+    {
+        cp -f [resolve [head [need]]] [target];
+    }
+    [[host]_DEST]/style.css: style.css
+    {
+        cp -f [resolve [head [need]]] [target];
+    }
+}
+
+mydebug:
+{
+    echo [t2_DIRS];
+}
+