Changeset 868


Ignore:
Timestamp:
11/23/08 07:36:19 (3 years ago)
Author:
SvenDowideit
Message:

Item254: add -Autoconf to pseudo-install.pl

File:
1 edited

Legend:

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

    r828 r868  
    5757 from the parent directory of the current checkout. 
    5858 
    59  Usage: pseudo-install.pl -felc [all|default|developer|<module>...] 
     59 Usage: pseudo-install.pl -[feA][l|c|u] [all|default|developer|<module>...] 
    6060    -f[orce] - force an action to complete even if there are warnings 
    6161    -e[nable] - automatically enable installed plugins in LocalSite.cfg 
     
    6969    developer - default + key developer environment 
    7070    <module>... one or more extensions to install 
     71    -[A]utoconf - make a simplistic LocalSite.cfg, using just the defaults in lib/Foswiki.spec 
    7172 
    7273 Example: 
    73     perl pseudo-install.pl -force -enable -link FirstPlugin SomeContrib 
     74    softlink and enable FirstPlugin and SomeContrib 
     75        perl pseudo-install.pl -force -enable -link FirstPlugin SomeContrib 
     76     
     77     
     78    check out a new trunk, create a default LocalSite.cfg, install and enable 
     79    all the plugins for the default distribution (and then run the unit tests) 
     80        svn co http://svn.fosiki.org/trunk 
     81        cd trunk/core 
     82        ./pseudo-install -A developer 
     83        cd test/unit 
     84        ../bin/TestRunner -clean FoswikiSuite.pm 
     85 
    7486EOM 
    7587 
     
    256268} 
    257269 
     270sub Autoconf { 
     271    my( $moduleDir, $dir, $file ) = @_; 
     272     
     273    my $foswikidir = $basedir; 
     274    my $localSiteCfg = $foswikidir.'/lib/LocalSite.cfg'; 
     275    if ($force || (! -e $localSiteCfg)) { 
     276        my $localsite = `grep 'Foswiki::cfg' $foswikidir/lib/Foswiki.spec`; 
     277         
     278        $localsite =~ s|/home/httpd/foswiki|$foswikidir|g; 
     279        # single # seems to denote an important param that needs to be set 
     280        $localsite =~ s|# \$Foswiki|\$Foswiki|g; 
     281         
     282        if (open(LS, '>', $localSiteCfg)) { 
     283            print LS $localsite; 
     284            close(LS); 
     285            print STDERR "wrote simple config to $localSiteCfg\n\n"; 
     286        } else { 
     287            print STDERR "ERROR: failed to write to $localSiteCfg\n\n"; 
     288        } 
     289    } else { 
     290        print "ERROR: won't overwrite $localSiteCfg without -force\n\n"; 
     291    } 
     292} 
     293 
    258294sub enablePlugin { 
    259295    my ($module, $installing, $libDir) = @_; 
     
    293329my $autoenable = 1; 
    294330my $installing = 1; 
     331my $autoconf = 0; 
    295332$install = $CAN_LINK ? \&just_link : \&copy_in; 
    296333 
     
    310347    } elsif ($arg =~ /^-m/) { 
    311348        $autoenable = 1; 
    312     } 
     349    } elsif ($arg =~ /^-A/) { 
     350        $autoconf = 1; 
     351    } 
     352} 
     353 
     354if ($autoconf) { 
     355    Autoconf(); 
     356    exit 1 unless (scalar(@ARGV));    
    313357} 
    314358 
Note: See TracChangeset for help on using the changeset viewer.