forked from DistributedClocks/shiviz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docgen.pl
executable file
·33 lines (25 loc) · 884 Bytes
/
docgen.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/perl
use strict;
####################################
# To generate documentation, run:
#
# perl docgen OUTPUT_DIR
####################################
die "\nUsage: perl docgen.pl OUTPUT_DIRECTORY.\n\n" if @ARGV != 1;
my $dest = $ARGV[0] . "/docs";
my $deltempcmd = "rm -r ./jsdoc ./js/README.md > /dev/null 2>&1";
# Unzip JSDoc3. JSDoc3 is zipped to decrease its size and to keep it in one file
if (system("unzip -o jsdoc.zip > /dev/null 2>&1")) {
system($deltempcmd);
die "Unzip failed";
}
# copy doc-index.txt to appropriate location
system("cp doc-index.md ./js/README.md");
# compile using JSDoc3
if (system(" ./jsdoc/node_modules/.bin/jsdoc -r -d " . $dest . " ./js ./js/README.md")) {
system($deltempcmd);
die "Compilation failed";
}
# delete temporary files
system($deltempcmd);
print "Success\nDocumentation written to " . $dest . "\n";