update pod2x for new self-service path
[freeside.git] / bin / pod2x
1 #!/usr/bin/perl
2
3 #use Pod::Text;
4 #$Pod::Text::termcap=1;
5
6 my $site_perl = "./FS";
7 #my $catman = "./catman";
8 #my $catman = "./htdocs/docs/man";
9 #my $html = "./htdocs/docs/man";
10 my $html = "./httemplate/docs/man";
11
12 $|=1;
13
14 die "Can't find $site_perl" unless -d $site_perl;
15 #die "Can't find $catman" unless -d $catman;
16 die "Can't find $html" unless -d $html;
17
18 #make some useless links
19 foreach my $file (
20   glob("$site_perl/bin/freeside-*"),
21 ) {
22   next if $file =~ /\.pod$/;
23   #symlink $file, "$file.pod"; # or die "link $file to $file.pod: $!";
24   system("cp $file $file.pod");
25 }
26
27 foreach my $file (
28   glob("$site_perl/*.pm"),
29   glob("$site_perl/*/*.pm"),
30   glob("$site_perl/*/*/*.pm"),
31   glob("$site_perl/bin/*.pod"),
32   glob("./fs_sesmon/FS-SessionClient/*.pm"),
33   #glob("./fs_signup/FS-SignupClient/*.pm"),
34   glob("./fs_selfservice/FS-SelfService/*.pm"),
35   glob("./fs_selfadmin/FS-MailAdminServer/*.pm"),
36 ) {
37   next if $file =~ /(^|\/)blib\//;
38   #$file =~ /\/([\w\-]+)\.pm$/ or die "oops file $file";
39   my $name;
40   if ( $file =~ /fs_\w+\/FS\-\w+\/(.*)\.pm$/ ) {
41     $name = "FS/$1";
42   } elsif ( $file =~ /$site_perl\/(.*)\.(pm|pod)$/ ) {
43     $name = $1;
44   } else {
45     die "oops file $file";
46   }
47   print "$name\n";
48   my $htmlroot = join('/', map '..',1..(scalar($file =~ tr/\///)-2)) || '.';
49 #  system "pod2text $file >$catman/$name.txt"; 
50   system "pod2html --podroot=$site_perl --podpath=./FS:./FS/UI:.:./bin --norecurse --htmlroot=$htmlroot $file >$html/$name.html";
51   #system "pod2html --podroot=$site_perl --htmlroot=$htmlroot $file >$html/$name.html";
52 #  system "pod2html $file >$html/$name.html";
53 }
54
55 #remove the useless links
56 unlink glob("$site_perl/bin/*.pod");
57