source: pbconf/devel/website/pbinit @ 2223

Last change on this file since 2223 was 2223, checked in by bruno, 20 months ago

Fix website delivery errors, and some minor spelling errors

  • Property svn:executable set to *
File size: 3.5 KB
Line 
1#!/usr/bin/perl -w
2#
3# Init script for pb's website
4#
5
6# Export documentation to generate what is needed
7use ProjectBuilder::Base;
8use ProjectBuilder::Filter;
9use ProjectBuilder::CMS;
10use ProjectBuilder::VCS;
11use ProjectBuilder::Env;
12use File::Basename;
13use File::Copy;
14use Pod::Man;
15use Pod::Html qw(pod2html);
16use Pod::Text;
17use Data::Dumper;
18
19my @MAN = (
20    "pb-modules/lib/ProjectBuilder/Base.pm",
21    "pb-modules/lib/ProjectBuilder/Conf.pm",
22    "pb-modules/lib/ProjectBuilder/VCS.pm",
23    "pb-modules/lib/ProjectBuilder/Distribution.pm",
24    "pb-modules/lib/ProjectBuilder/Env.pm",
25    "pb-modules/lib/ProjectBuilder/VE.pm",
26    "pb/lib/ProjectBuilder/Changelog.pm",
27    "pb/lib/ProjectBuilder/CMS.pm",
28    "pb/lib/ProjectBuilder/Filter.pm",
29    "pb/bin/pb",
30    "rpmbootstrap/bin/rpmbootstrap",
31    "pb-modules/bin/pbdistrocheck",
32    "pb-modules/bin/pbgetparam",
33    "pb-modules/etc/pb.conf.pod",
34);
35
36my @DOC = (
37    "LabProject-Builder.org.odt", 
38    "LabProject-Builder.org.pdf",
39    "One_Source_for_Multiple_Platforms_Sol_Brief_final.pdf"
40);
41
42pb_temp_init();
43pb_mkdir_p("docs");
44pb_mkdir_p("tmp");
45my $pb;
46$pb->{'pkg'} = "PBPKG";
47$pb->{'ver'} = "PBVER";
48$pb->{'tag'} = "PBTAG";
49$pb->{'rev'} = "PBREV";
50$pb->{'proj'} = "PBPROJ";
51$pb->{'date'} = "PBDATE";
52$pb->{'repo'} = "PBREPO";
53$pb->{'extdir'} = "PBEXTDIR";
54$pb->{'realpkg'} = "PBREALPKG";
55
56# Action needs to be pbinit
57my ($filteredfiles, $supfiles, $defpkgdir, $extpkgdir) = pb_env_init($pb->{'proj'},undef,"pbinit");
58my ($scheme,$uri) = pb_cms_init(undef);
59
60# export doc
61foreach my $f (@DOC) {
62    pb_vcs_export($uri,"$ENV{'PBDIR'}/pb-doc/$f","docs");
63}
64# using pod from files
65foreach my $f (@MAN) {
66    pb_vcs_export($uri,"$ENV{'PBDIR'}/$f","tmp");
67}
68
69# call filter_file here
70my $ptr = pb_get_filters($pb->{'pkg'});
71open(MANHTML,"> docs/pb_man_pages.html") || die "Unable to open docs/pb_man_pages.html";
72print MANHTML " <ul>\n";
73chdir("tmp");
74foreach my $f (<*>) {
75    print MANHTML "     <li>$f</li>\n";
76    print MANHTML "     <ul>\n";
77    pb_log(0,"\nProcessing $f\n");
78    pb_log(0,"==========================\n");
79    pb_filter_file_inplace($ptr,$f,$pb);
80    my $ext = 1;
81    if ($f =~ /\.pod/) {
82        $ext = 5;
83    } elsif ($f =~ /\.pm/) {
84        $ext = 3;
85    }
86    # generate man pages
87    pb_log(0,"Generating man pages\n");
88    my $parser = Pod::Man->new (release => $VERSION, section => $ext);
89    $parser->parse_from_file ("$f", "$f.$ext");
90    # generate html pages
91    pb_log(0,"Generating HTML pages\n");
92    pod2html(
93            "--htmlroot=/docs",
94            "--recurse",
95            "--header",
96            "--title=$f man page",
97            "--backlink",
98            "--infile=$f",
99            "--outfile=../docs/$f.$ext.html");
100    print MANHTML "         <li>A <a href=\"/docs/$f.$ext.html\" target=\"_blank\">HTML</a></li>\n";
101    # generate text pages
102    pb_log(0,"Generating text pages\n");
103    $parser = Pod::Text->new (sentence => 0, width => 78);
104    $parser->parse_from_file ("$f","../docs/$f.$ext.txt");
105    print MANHTML "         <li>A <a href=\"/docs/$f.$ext.txt\" target=\"_blank\">Text</a></li>\n";
106    # generate ps pages
107    #system("groff -Tps -mandoc $f.$ext > ../docs/$f.$ext.ps");
108    # Use noredir here because is doesn't redirect to the right place without
109    pb_system("groff -Tps -mandoc $f.$ext > ../docs/$f.$ext.ps","Generating Postscript pages","noredir");
110    print MANHTML "         <li>A <a href=\"/docs/$f.$ext.ps\" target=\"_blank\">PostScript</a></li>\n";
111    # generate pdf pages
112    pb_system("ps2pdf ../docs/$f.$ext.ps","Generating PDF pages");
113    move("$f.$ext.pdf","../docs/$f.$ext.pdf");
114    print MANHTML "         <li>A <a href=\"/docs/$f.$ext.pdf\" target=\"_blank\">PDF</a></li>\n";
115    print MANHTML "     </ul>\n";
116}
117print MANHTML " </ul>\n";
118close(MANHTML);
119chdir("..");
120pb_rm_rf("tmp");
Note: See TracBrowser for help on using the repository browser.