Changeset 18603 for gsdl/trunk


Ignore:
Timestamp:
2009-03-02T12:58:04+13:00 (15 years ago)
Author:
kjdon
Message:

tidied some of this up a bit

File:
1 edited

Legend:

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

    r18418 r18603  
    154154sub traverse_dir
    155155{
    156     my ($modeldir, $coldir, $gs3) = @_;
     156    my ($modeldir, $coldir) = @_;
    157157    my ($newfile, @filetext);
    158158
     
    177177    foreach my $file (@files)
    178178    {
    179     # don't want macros folder for gs3mode
    180     next if ($gs3mode && $file =~ /^macros$/);
     179    if ($file =~ /^macros$/) {
     180       
     181        # don't want macros folder for gs3mode
     182        next if $gs3mode;
     183    }
     184    if ($file =~ /^import$/) {
     185        # don't want import for group
     186        next if $group;
     187    }
     188   
    181189    my $thisfile = &util::filename_cat ($modeldir, $file);
    182190
    183191    if (-d $thisfile) {
    184192        my $colfiledir = &util::filename_cat ($coldir, $file);
    185         traverse_dir ($thisfile, $colfiledir, $gs3);
     193        traverse_dir ($thisfile, $colfiledir);
    186194
    187195    } else {
     196
     197        next if ($file =~ /~$/);
    188198
    189199        my $destfile = $file;
     
    194204        # collect.cfg, group.cfg and collectionConfig.xml.
    195205        # If it is gs2, copy relevant collect.cfg or group.cfg file; if gs3, copy collectionConfig.xml.
    196 
    197         if ($gs3) {
    198         if ($group) {
    199             &gsprintf(STDERR,"{common.group_not_valid_in_gs3}\n");
    200         }
    201         else {
    202             next if ($file =~ m/(collect|group)\.cfg/);
    203         }
     206       
     207        if ($file =~ /^collect\.cfg$/) {
     208        next if ($gs3mode || $group);
    204209        }
    205         else {
    206         # Greenstone 2
    207         if ($group) {
    208             next if ($file =~ m/collect\.cfg/);
    209 
    210             # If get to here: input file = group.cfg
    211             # => want output file = collect.cfg
    212             $destfile =~ s/group\.cfg/collect\.cfg/;
    213         }
    214         else {
    215             next if ($file =~ m/group\.cfg/);
    216         }
    217 
     210        elsif ($file =~ /^group\.cfg$/) {
     211        next unless $group;
     212        $destfile =~ s/group\.cfg/collect\.cfg/;
    218213        }
    219 
    220 
     214        elsif ($file =~ /^collectionConfig\.xml$/) {
     215        next unless $gs3mode;
     216        }
     217       
    221218        &gsprintf(STDOUT, "{mkcol.doing_replacements}\n", $destfile)
    222219        unless $quiet;
     
    236233        $line =~ s/\*\*title\*\*/$title/g;
    237234        $line =~ s/\*\*about\*\*/$about/g;
    238         if (!$gs3) {
     235        if (!$gs3mode) {
    239236           $line =~ s/\*\*plugins\*\*/$pluginstring/g;
    240237         }
     
    370367    }
    371368
     369    if ($gs3mode && $group) {
     370    &gsprintf(STDERR,"{mkcol.group_not_valid_in_gs3}\n");
     371    die "\n";
     372    }
    372373
    373374    # get the strings to include.
     
    418419    unless $quiet;
    419420
    420     &traverse_dir ($mdir, $cdir, $gs3mode);
     421    &traverse_dir ($mdir, $cdir);
    421422    &gsprintf(STDOUT, "\n{mkcol.success}\n", $cdir)
    422423    unless $quiet;
Note: See TracChangeset for help on using the changeset viewer.