source: tags/start/gsdl/bin/script/gettext.pl@ 13666

Last change on this file since 13666 was 13666, checked in by (none), 17 years ago

This commit was manufactured by cvs2svn to create tag 'start'.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
Line 
1#!/usr/local/bin/perl5 -w
2
3# This program will output the text for a particular index
4
5BEGIN {
6 die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
7 die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};
8 unshift (@INC, "$ENV{'GSDLHOME'}/lib");
9 unshift (@INC, "$ENV{'GSDLHOME'}/lib/plugins");
10}
11
12use parsargv;
13use plugin;
14use colcfg;
15
16sub print_usage {
17 print STDERR "\n usage: $0 collection-name\n";
18 print STDERR " options:\n";
19 print STDERR " -index index The index to output\n\n";
20}
21
22
23&main ();
24
25sub main {
26
27 if (!parsargv::parse(\@ARGV,
28 'index/.*/section:text', \$index,
29 'mode/.*/text', \$mode)) {
30 &print_usage();
31 die "\n";
32 }
33
34 # get and check the collection name
35 ($collection) = @ARGV;
36
37 if (!defined($collection)) {
38 &print_usage();
39 die "\n";
40 }
41
42 # get the list of plugins for this collection
43 @plugins = ("RecPlug", "HTMLPlug", "TXTPlug");
44 if (-e "$ENV{'GSDLHOME'}/collect/$collection/collect.cfg") {
45 $collectcfg = &colcfg::read_collect_cfg ("$ENV{'GSDLHOME'}/collect/$collection/collect.cfg");
46 if (defined $collectcfg->{'plugins'}) {
47 @plugins = @{$collectcfg->{'plugins'}};
48 }
49 }
50
51
52 # load all the plugins
53 $pluginfo = &plugin::load_plugins ($collection, \@plugins);
54 if (scalar(@$pluginfo) == 0) {
55 print STDERR "No plugins were loaded.\n";
56 die "\n";
57 }
58
59 # load up the document processor for building
60 # if a buildproc class has been created for this collection, use it
61 # otherwise, use the mg buildproc
62 my ($buildprocdir, $buildproctype);
63 if (-e "$ENV{'GSDLHOME'}/collect/$collection/lib/${collection}buildproc.pm") {
64 $buildprocdir = "$ENV{'GSDLHOME'}/collect/$collection/lib";
65 $buildproctype = "${collection}buildproc";
66 } else {
67 $buildprocdir = "$ENV{'GSDLHOME'}/lib";
68 $buildproctype = "mgbuildproc";
69 }
70 require "$buildprocdir/$buildproctype.pm";
71
72 my $source_dir = "$ENV{'GSDLHOME'}/collect/$collection/archives";
73 my $build_dir = "$ENV{'GSDLHOME'}/collect/$collection/building";
74 my $verbosity = 1;
75
76 eval("\$buildproc = new $buildproctype(\$collection, " .
77 "\$source_dir, \$build_dir, \$verbosity)");
78 die "$@" if $@;
79
80 # set up the document processor
81 $buildproc->set_output_handle ('STDOUT');
82 $buildproc->set_mode ($mode);
83 $buildproc->set_index ($index);
84
85 $buildproc->reset();
86
87 # process the import directory
88 &plugin::read ($pluginfo, $source_dir,
89 "", {}, $buildproc);
90
91}
Note: See TracBrowser for help on using the repository browser.