Changeset 6324


Ignore:
Timestamp:
02/14/10 21:29:00 (3 years ago)
Author:
OlivierRaginel
Message:

Item8272: perltidy

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/pseudo-install.pl

    r6323 r6324  
    106106sub installModule { 
    107107    my $module = shift; 
    108     $module =~ s#/+$##; #remove trailing slashes 
     108    $module =~ s#/+$##;    #remove trailing slashes 
    109109    print "Processing $module\n"; 
    110110    my $subdir = 'Plugins'; 
     
    166166    my ( $moduleDir, $dir, $file ) = @_; 
    167167    File::Path::mkpath($dir); 
    168     if( -e "$moduleDir/$file" ) { 
     168    if ( -e "$moduleDir/$file" ) { 
    169169        File::Copy::copy( "$moduleDir/$file", $file ) 
    170         || die "Couldn't install $file: $!"; 
     170          || die "Couldn't install $file: $!"; 
    171171    } 
    172172    print "Copied $file\n"; 
     
    191191 
    192192    my $dest = _cleanPath( readlink( $path . $c ), $path ); 
    193     $dest =~ m#/([^/]*)$#; # Remove slashes 
     193    $dest =~ m#/([^/]*)$#;    # Remove slashes 
    194194    unless ( $1 eq $c ) { 
    195195        print STDERR <<HERE; 
     
    235235        elsif (( $c eq 'TWiki' ) 
    236236            or ( $c eq 'Plugins' && $path =~ m#/(Fosw|TW)iki/$# ) ) 
    237         { # Special case 
     237        {    # Special case 
    238238            $path .= "$c/"; 
    239239            print STDERR "mkdir $path\n"; 
     
    256256        } 
    257257    } 
     258 
    258259    # Test special case when source is compressed or uncompressed 
    259260    my $found = -f "$moduleDir/$file"; 
    260     unless( $found ) { 
    261         if( $file =~ /^(.+)(\.(?:un)?compressed|_src)(\..+)$/ && -f "$moduleDir/$1$3" ) { 
    262             symlink( _cleanPath("$moduleDir/$file" ), _cleanPath("$moduleDir/$1$3") ) 
    263             or die "Failed to link $moduleDir/$1$3 to moduleDir/$file: $!"; 
     261    unless ($found) { 
     262        if ( $file =~ /^(.+)(\.(?:un)?compressed|_src)(\..+)$/ 
     263            && -f "$moduleDir/$1$3" ) 
     264        { 
     265            symlink( _cleanPath("$moduleDir/$file"), 
     266                _cleanPath("$moduleDir/$1$3") ) 
     267              or die "Failed to link $moduleDir/$1$3 to moduleDir/$file: $!"; 
    264268            print "Linked $file as $1$3\n"; 
    265269            $found++; 
    266         } elsif ( my ($src, $ext) = $file =~ /^(.+)(\.[^\.]+)$/ ) { 
    267             for my $kind ( qw( .uncompressed .compressed _src ) ) { 
    268                 if( -f "$moduleDir/$src$kind$ext" ) { 
    269                     symlink( _cleanPath("$moduleDir/$src$kind$ext"), _cleanPath("$moduleDir/$file" ) ) 
    270                     or die "Failed to link $moduleDir/$file to $moduleDir/$src$kind$ext: $!"; 
     270        } 
     271        elsif ( my ( $src, $ext ) = $file =~ /^(.+)(\.[^\.]+)$/ ) { 
     272            for my $kind (qw( .uncompressed .compressed _src )) { 
     273                if ( -f "$moduleDir/$src$kind$ext" ) { 
     274                    symlink( 
     275                        _cleanPath("$moduleDir/$src$kind$ext"), 
     276                        _cleanPath("$moduleDir/$file") 
     277                      ) 
     278                      or die 
     279"Failed to link $moduleDir/$file to $moduleDir/$src$kind$ext: $!"; 
    271280                    print "Linked $file as $src$kind$ext\n"; 
    272281                    $found++; 
     
    276285        } 
    277286    } 
    278     unless( $found ) { 
     287    unless ($found) { 
    279288        print STDERR "WARNING: Cannot find source file $moduleDir/#/$file\n"; 
    280289        return; 
     
    288297    # tree so it unlinks the directories, and not the leaf files. 
    289298    # Special case when install created symlink to (un)?compressed version 
    290     if( -l "$moduleDir/$file" ) { 
     299    if ( -l "$moduleDir/$file" ) { 
    291300        unlink "$moduleDir/$file"; 
    292301        print "Unlinked $moduleDir/$file\n"; 
     
    319328    if ( $force || ( !-e $localSiteCfg ) ) { 
    320329        my $grep = 'grep'; 
    321         $grep = 'find' if ($^O eq 'MSWin32');   #let windows play too 
    322             my $localsite = `$grep "Foswiki::cfg" $foswikidir/lib/Foswiki.spec`; 
    323             if ($^O eq 'MSWin32') { 
     330        $grep = 'find' if ( $^O eq 'MSWin32' );    #let windows play too 
     331        my $localsite = `$grep "Foswiki::cfg" $foswikidir/lib/Foswiki.spec`; 
     332        if ( $^O eq 'MSWin32' ) { 
     333 
    324334            #oh wow, windows find is retarded 
    325335            $localsite =~ s|^(-------.*)$||m; 
     336 
    326337            #prefer non-grep SEARCH 
    327             $localsite =~ s|^(.*)SearchAlgorithms::Forking(.*)$|$1SearchAlgorithms::PurePerl$2|m; 
     338            $localsite =~ 
     339s|^(.*)SearchAlgorithms::Forking(.*)$|$1SearchAlgorithms::PurePerl$2|m; 
     340 
    328341            #RscLite 
    329342            $localsite =~ s|^(.*)RcsWrap(.*)$|$1RcsLite$2|m; 
     
    432445 
    433446my @modules; 
    434 for my $arg ( @ARGV ) { 
    435         if ( $arg eq "all" ) { 
    436             foreach my $dir (@extensions_path) { 
    437                 opendir D, $dir or next; 
    438                 push @modules, 
    439                       grep { /(?:Tag|Plugin|Contrib|Skin|AddOn)$/ && -d "$dir/$_" } readdir D; 
     447for my $arg (@ARGV) { 
     448    if ( $arg eq "all" ) { 
     449        foreach my $dir (@extensions_path) { 
     450            opendir D, $dir or next; 
     451            push @modules, 
     452              grep { /(?:Tag|Plugin|Contrib|Skin|AddOn)$/ && -d "$dir/$_" } 
     453              readdir D; 
    440454            closedir D; 
    441455        } 
     
    445459        local $/ = "\n"; 
    446460        @modules = 
    447             map { /(\w+)$/; $1 } 
    448             grep { /^!include/ } <F>; 
     461          map { /(\w+)$/; $1 } 
     462          grep { /^!include/ } <F>; 
    449463        close F; 
    450464        push @modules, 'BuildContrib', 'TestFixturePlugin', 'UnitTestContrib' 
    451             if $arg eq 'developer'; 
     465          if $arg eq 'developer'; 
    452466    } 
    453467    else { 
     
    466480    my $libDir = installModule($module); 
    467481    if ($libDir) { 
    468         push(@installedModules, $module); 
     482        push( @installedModules, $module ); 
    469483        if ( ( !$installing || $autoenable ) && $module =~ /Plugin$/ ) { 
    470484            enablePlugin( $module, $installing, $libDir ); 
     
    473487} 
    474488 
    475 print ' '.(($#installedModules > 0) ? join( ", ", @installedModules ) : 'Nothing'). ' '. ( $installing ? 'i' : 'uni' ). "nstalled\n"; 
     489print ' ' 
     490  . ( ( $#installedModules > 0 ) ? join( ", ", @installedModules ) : 'Nothing' ) 
     491  . ' ' 
     492  . ( $installing ? 'i' : 'uni' ) 
     493  . "nstalled\n"; 
Note: See TracChangeset for help on using the changeset viewer.