Browse files

[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...
1 parent 53087db commit 73e7393a2097fb7c1fc95f3a2877f0894e528043 @moritz moritz committed Aug 7, 2012
Showing with 16 additions and 3 deletions.
  1. +16 −3 htmlify.pl
View
19 htmlify.pl
@@ -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;
@@ -85,6 +85,7 @@ (Bool :$debug)
$footer = footer-html;
+
for (@source) {
my $podname = .key;
my $file = .value;
@@ -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...";
@@ -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);

0 comments on commit 73e7393

Please sign in to comment.