Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[htmlify] only write type graph images when necessary
It takes quite a while, and is only necessary once in a while.
The heuristic isn't perfect, which is why you can force the
generation with a command line option.
  • Loading branch information
moritz committed Aug 7, 2012
1 parent 53087db commit 73e7393
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions htmlify.pl
Expand Up @@ -63,7 +63,7 @@
}
}

sub MAIN(Bool :$debug) {
sub MAIN(Bool :$debug, Bool :$typegraph = False) {
$*DEBUG = $debug;
for ('', <type language routine images>) {
mkdir "html/$_" unless "html/$_".IO ~~ :e;
Expand All @@ -85,6 +85,7 @@ (Bool :$debug)
$footer = footer-html;



for (@source) {
my $podname = .key;
my $file = .value;
Expand Down Expand Up @@ -166,7 +167,7 @@ (Bool :$debug)
spurt "html/$what/$podname.html", pod2html($pod, :url(&url-munge), :$footer);
}

write-type-graph-images();
write-type-graph-images(:force($typegraph));
write-search-file();
write-index-file();
say "Writing per-routine files...";
Expand Down Expand Up @@ -240,7 +241,19 @@ (Bool :$debug)
);
}

sub write-type-graph-images() {
sub write-type-graph-images(:$force) {
unless $force {
my $dest = 'html/images/type-graph-Any.svg'.path;
say "cwd: ", cwd;
say 'type-graph.txt'.path.e;
if $dest.e && $dest.modified >= 'type-graph.txt'.path.modified {
say "Not writing type graph images, it seems to be up-to-date";
say "To force writing of type graph images, supply the --typegraph";
say "option at the command line, or delete";
say "file 'html/images/type-graph-Any.svg'";
return;
}
}
print "Writing type graph images to html/images/ ";
for $tg.sorted -> $type {
my $viz = Perl6::TypeGraph::Viz.new-for-type($type);
Expand Down

0 comments on commit 73e7393

Please sign in to comment.