Ignore:
Timestamp:
1999-02-02T22:47:47+13:00 (25 years ago)
Author:
rjmcnab
Message:

Made more configurable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/bin/script/gettext.pl

    r117 r130  
    1313use plugin;
    1414use colcfg;
     15use util;
    1516
    1617sub print_usage {
    1718    print STDERR "\n  usage: $0 collection-name\n";
    1819    print STDERR "  options:\n";
     20    print STDERR "   -archivedir directory Where the archives live\n";
    1921    print STDERR "   -index index   The index to output\n\n";
    2022}
     
    2628
    2729    if (!parsargv::parse(\@ARGV,
     30             'archivedir/.*/', \$archivedir,
    2831             'index/.*/section:text', \$index,
    2932             'mode/.*/text', \$mode)) {
     
    3336
    3437    # get and check the collection name
    35     ($collection) = @ARGV;
    36 
    37     if (!defined($collection)) {
     38   if (($collection = &util::use_collection(@ARGV)) eq "") {
    3839    &print_usage();
    3940    die "\n";
     
    4142   
    4243    # get the list of plugins for this collection
    43     @plugins = ("RecPlug", "HTMLPlug", "TXTPlug");
    44     if (-e "$ENV{'GSDLHOME'}/collect/$collection/etc/collect.cfg") {
    45     $collectcfg = &colcfg::read_collect_cfg ("$ENV{'GSDLHOME'}/collect/$collection/etc/collect.cfg");
     44    @plugins = ();
     45    $configfilename = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "etc/collect.cfg");
     46    if (-e $configfilename) {
     47    $collectcfg = &colcfg::read_collect_cfg ($configfilename);
    4648    if (defined $collectcfg->{'plugins'}) {
    4749        @plugins = @{$collectcfg->{'plugins'}};
    4850    }
     51    if (defined $collectcfg->{'archivedir'} && $archivedir eq "") {
     52        $archivedir = $collectcfg->{'archivedir'};
     53    }
     54    } else {
     55    die "Couldn't find the configuration file $configfilename\n";
    4956    }
    50    
     57
     58    # fill in the default archives directories if none
     59    # was supplied, turn all \ into / and remove trailing /
     60    $archivedir = "$ENV{'GSDLCOLLECTDIR'}/archives" if $archivedir eq "";
     61    $archivedir =~ s/[\\\/]+/\//g;
     62    $archivedir =~ s/\/$//;
    5163
    5264    # load all the plugins
     
    6072    # if a buildproc class has been created for this collection, use it
    6173    # otherwise, use the mg buildproc
     74    # if a builder class has been created for this collection, use it
     75    # otherwise, use the mg builder
     76    # load up the document processor for building
     77    # if a buildproc class has been created for this collection, use it
     78    # otherwise, use the mg buildproc
    6279    my ($buildprocdir, $buildproctype);
    63     if (-e "$ENV{'GSDLHOME'}/collect/$collection/perllib/${collection}buildproc.pm") {
    64     $buildprocdir = "$ENV{'GSDLHOME'}/collect/$collection/perllib";
     80    if (-e "$ENV{'GSDLCOLLECTDIR'}/perllib/${collection}buildproc.pm") {
     81    $buildprocdir = "$ENV{'GSDLCOLLECTDIR'}/perllib";
    6582    $buildproctype = "${collection}buildproc";
    6683    } else {
     
    7087    require "$buildprocdir/$buildproctype.pm";
    7188
    72     my $source_dir = "$ENV{'GSDLHOME'}/collect/$collection/archives";
    73     my $build_dir = "$ENV{'GSDLHOME'}/collect/$collection/building";
    74     my $verbosity = 1;
    75 
    7689    eval("\$buildproc = new $buildproctype(\$collection, " .
    77      "\$source_dir, \$build_dir, \$verbosity)");
     90     "\$archivedir, \"\$ENV{'GSDLCOLLECTDIR'}/building\", 1)");
    7891    die "$@" if $@;
    7992
     
    8699
    87100    # process the import directory
    88     &plugin::read ($pluginfo, $source_dir,
     101    &plugin::read ($pluginfo, $archivedir,
    89102           "", {}, $buildproc);
    90103
Note: See TracChangeset for help on using the changeset viewer.