Source

shlomi-fish-homepage / Howto.cook

WML_FLAGS = ;

WML_FLAGS = [WML_FLAGS] --passoption\=2,-X -DROOT~.;

/*
 * t2 macros
 */

DEST_BASE = /var/www/html/shlomi/;

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]; */
/*
 * all: $(t2_DIRS_DEST) $(t2_DOCS_DEST)
 */

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/ );
}
clean:
{
	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];
}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.