Re: OR: cook feature request
Aryeh Friedman <[email protected]>
| Newsgroups | gmane.comp.version-control.aegis.user |
|---|---|
| Message-ID | <CAGBxaXmUkaEtyx=yA5Qp_vp35MfmEQCwyMWsJkEzzoWV50E-Kg@mail.gmail.com> |
BTW here is the script(s) used to produce that page:
script to make the page and the image:
#!/bin/tcsh
#
# Copyright (C) 2012 Friedman-Nixon-Wong Enterprises, LLC
#
set here=`pwd`
set project=`aesub '$p'`
set change=`aesub '$c'`
set version=`aesub '$v'`
set searchPath=`aesub '$sp'`:/home/aegis/b-common/baseline
set cookBook=$here/`aesub '${s src/build/cook/Howto.cook}'`
set tmp=/tmp/$$
mkdir $tmp
cd $tmp
cook -s -b $cookBook -nl project=$project change=$change
version=$version search_path=$searchPath -pairs>pairs
javac $here/src/scripts/MakeDot.java -d $here/scripts
java -cp $here/scripts MakeDot $here/src/www/doc/pairs.jsp>dot
dot dot -Tsvg>$here/src/www/doc/dot.svg
the referenced java:
// take pairs as generated by cook and convert them to user friendly DOT diagram
import java.io.*;
import java.util.*;
public class MakeDot
{
public static void main(String[] args)
throws Throwable
{
BufferedReader br=new BufferedReader(new FileReader("pairs"));
pw=new PrintWriter(new FileWriter(args[0]));
theMap=new HashMap<String,Integer>();
System.out.println("digraph cook {");
pw.println("<a href=dot.svg><img src=dot.svg></a><br><table>");
while(br.ready()) {
String line=br.readLine();
String[] parts=line.split(" ");
int idx1=map(parts[0]);
int idx2=map(parts[1]);
System.out.println("\t"+idx1+"->"+idx2+";");
}
System.out.println("}");
pw.println("</table>");
pw.close();
}
private static int map(String target)
{
if(theMap.get(target)==null) {
theMap.put(target,idx++);
pw.println("<tr><td>"+(idx-1)+"</td><td>"+target+"</td></tr>");
}
return theMap.get(target);
}
private static Map<String,Integer> theMap;
private static int idx=0;
private static PrintWriter pw;
}
On Tue, Jul 31, 2012 at 4:51 PM, Aryeh Friedman
<[email protected]> wrote:
> oops that is port 8080
>
> On Tue, Jul 31, 2012 at 4:45 PM, Aryeh Friedman
> <[email protected]> wrote:
>> Is it possible to add an option to cook -pairs that would print the
>> pairs out in a form that can be used as direct input for graphviz
>> (filenames are likely to long)... for an example look at
>> http://cloud2.fnwe.net/b-common/doc/pairs.jsp