Never mind.  This was already done much better in 
http://leo.zwiki.org/CreateShadows

On Oct 25, 2:39 am, thyrsus <[EMAIL PROTECTED]> wrote:
> I'm heavily investigating the use of puppet as a way to manage my
> machines, and I've found a need to explore its source code.  It's
> mostly written in ruby; I made some trivial additions in branch
> thyrsus1 so that the language would be recognized (comments introduced
> by the character #, the file extension is .rb)  A brief survey shows
> 1496 source files in 311 directories to collect.  A bit tedious to
> pull into leo one at a time.  The following horribly crude and
> unpolished perl dealt with that; I provide it only as a proof-of-
> concept.  It's list of defects begins with:
>
> * hardcoded time used for gnx
> * hardcoded leo user used for gnx
> * hardcoded start directory is current directory
> * sends leo file to STDOUT, and you'd better not redirect it to the
> current directory, or the leo file will attempt to include itself
> (which is ugly and useless but amusingly not fatal due to the nature
> of @shadow files)
> * no XML escaping of file names
>
> #! /usr/bin/perl -w
>
> use strict;
> use DirHandle;
> my ($user,$daterep,$indexprefix,$nodenum,%tnodes);
> $user="sps";
> $daterep="20081024163901";
> $indexprefix=$user.".".$daterep.".";
> $nodenum=1;
> print <<EOHEADER;
> <?xml version="1.0" encoding="utf-8"?>
> <?xml-stylesheet ekr_test?>
> <leo_file>
> <leo_header file_format="2" tnodes="0" max_tnode_index="0"
> clone_windows="0"/>
> <globals body_outline_ratio="0.4">
>         <global_window_position top="20" left="20" height="600"
> width="1169"/>
>         <global_log_window_position top="0" left="0" height="0"
> width="0"/>
> </globals>
> <preferences/>
> <find_panel_settings/>
> <vnodes>
> EOHEADER
>
> sub processdir {
>     my ($dirname,$dir,$d,$i);
>     $dirname = shift;
>     $dir = new DirHandle($dirname);
>     if (defined $dir) {
>         while (defined($d=$dir->read)) {
>             print STDERR "processing $d\n";
>             next if (substr($d,0,1) eq '.');
>             $i=$indexprefix.$nodenum++;
>             if (-d "$dirname/$d") {
>                 # directory name should be xml escaped in real version
>                 $tnodes{$i}='@path '.$d;
>                 print '<v t="'.$i.'"><vh>'.$d."</vh>\n";
>                 &processdir("$dirname/$d");
>                 print "</v>\n";
>             } else {
>                 print '<v t="'.$i.'"><vh>@shadow '.$d."</vh></v>\n";
>                 $tnodes{$i}='';
>             }
>         }
>     } else {
>         die "Problem opening $dirname: $!";
>     }
>
> }
>
> &processdir(".");
> print "</vnodes>\n<tnodes>\n";
> foreach (sort keys %tnodes) {
>   print '<t tx="'.$_.'">'.$tnodes{$_}."\n</t>\n";}
>
> print "</tnodes>\n</leo_file>\n";
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to