Changeset 8022


Ignore:
Timestamp:
07/04/10 11:45:19 (3 years ago)
Author:
CrawfordCurrie
Message:

Item9232: more doccing

Location:
trunk/core
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/bin/configure

    r8021 r8022  
    3232not be consistent with the structure of $Foswiki:cfg, so beware). Each 
    3333leaf node has an associated Type (in the Types subdirectory) that has 
    34 collected model and view behaviours for the basic types. The node tree 
    35 is made up of the classes: 
     34collected model and view behaviours for the basic types. 
     35 
     36Class hierarchy 
    3637  * Foswiki::Configure::Item 
    3738     * Foswiki::Configure::Value - a leaf value 
     
    6061model for these sections. 
    6162 
    62 These are top-level pluggable UI components. All the main screens are 
    63 implemented as UIs, under Foswiki::Configure::UIs. 
     63Class hierarchy 
     64   * Foswiki::Configure::UI 
     65      * Foswiki::Configure::Checker 
     66         * Foswiki::Configure::Checkers::* - see below 
     67      * Foswiki::Configure::UIs::* - components used in building screens 
     68         * Foswiki::Configure::UIs::Item 
     69            * Foswiki::Configure::UIs::Section 
     70               * Foswiki::Configure::UIs::Root 
     71            * Foswiki::Configure::UIs::Value 
    6472 
    6573---+++ Checkers 
     
    7280---+++ Types 
    7381Types provide some UI support in the form of type-specific prompters. 
    74 this is really an abuse of the Model, but it saves creating 
     82This is really an abuse of the Model, but it saves creating 
    7583decorator classes for all the Model types. 
    7684 
     
    7886is visited in depth-first order. 
    7987 
     88Class hierarchy 
     89   * Foswiki::Configure::Type - base 
     90      * Foswiki::Configure::Types::NUMBER - numerical type (perl float values) 
     91         * Foswiki::Configure::Types::OCTAL - octal (permissions) 
     92      * Foswiki::Configure::Types::BOOLEAN - boolean type 
     93         * Foswiki::Configure::Types::LANGUAGE 
     94      * Foswiki::Configure::Types::PERL - perl structure 
     95      * Foswiki::Configure::Types::SELECT - select from a list of values 
     96         * Foswiki::Configure::Types::SELECTCLASS - select a class from a path 
     97      * Foswiki::Configure::Types::STRING - string type 
     98         * Foswiki::Configure::Types::REGEX - regular expression 
     99         * Foswiki::Configure::Types::COMMAND - shell command 
     100         * Foswiki::Configure::Types::PASSWORD - hidden password 
     101         * Foswiki::Configure::Types::PATH - file path (/) 
     102         * Foswiki::Configure::Types::URL - absolute url path (/) 
     103         * Foswiki::Configure::Types::URLPATH - relative url path (/) 
     104      * Foswiki::Configure::Types::UNKNOWN - unknown type 
     105 
     106TODO: 
     107The type classes are the obvious place to attach client-side javascript 
     108validators, thus releasing the server-side checkers to consider the "deeper" 
     109issues. 
    80110 
    81111=cut 
  • trunk/core/lib/Foswiki/Configure/Checker.pm

    r8021 r8022  
    11# See bottom of file for license and copyright information 
     2 
     3=begin TML 
     4 
     5---+ package Foswiki::Configure::Checker; 
     6 
     7Base class of all checkers. Checkers give checking and guessing support 
     8for configuration values. Most of the methods of this class are intended 
     9to be protected i.e. only available to subclasses. 
     10 
     11=cut 
    212 
    313package Foswiki::Configure::Checker; 
     
    1424=begin TML 
    1525 
    16 ---+++ ObjectMethod check($value) -> $html 
     26---++ ObjectMethod check($value) -> $html 
    1727   * $value - Value object for the thing being checked 
    1828 
    1929Entry point for the value check. Overridden by subclasses. 
    2030 
    21 Returns html formatted by $this->ERROR(), WARN(), NOTE(), guessed() or 
    22 hand made _OR_ and empty string to be inserted in the configure UI 
    23  
    24 The checker can either check the sanity of the previously saved value, 
    25 or guess a one if none exists: 
     31Returns html formatted by $this->ERROR(), WARN(), NOTE(), or 
     32hand made _OR_ an empty string. The output of a checker will normally 
     33be included in an HTML table, so don't get too carried away. 
    2634 
    2735=cut 
     
    3341    return ''; 
    3442} 
     43 
     44=begin TML 
     45 
     46---++ PROTECTED ObjectMethod guessed($status) -> $html 
     47 
     48A checker can either check the sanity of the previously saved value, 
     49or guess a one if none exists. If the checker guesses, it should call 
     50=$this->guessed(0)= (passing 1 if the guess was an error). 
     51 
     52=cut 
    3553 
    3654sub guessed { 
     
    5068    } 
    5169} 
     70 
     71=begin TML 
     72 
     73---++ PROTECTED ObjectMethod warnAboutWindowsBackSlashes($path) -> $html 
     74 
     75Generate a warning if the supplied pathname includes windows-style 
     76path separators. 
     77 
     78=cut 
    5279 
    5380sub warnAboutWindowsBackSlashes { 
     
    6087    } 
    6188} 
     89 
     90=begin TML 
     91 
     92---++ PROTECTED ObjectMethod guessMajorDir($cfg, $dir, $silent) -> $html 
     93 
     94Try and guess the path of one of the major directories, by looking relative 
     95to the absolute pathname of the dir where configure is being run. 
     96 
     97=cut 
    6298 
    6399sub guessMajorDir { 
     
    80116 
    81117=begin TML 
    82 ---+++ ObjectMethod checkTreePerms($path, $perms, $filter) -> 'html' 
    83  
    84 Called by a Checker to perform 
    85 a recursive check of the specified path.  The recursive check  
     118 
     119---++ PROTECTED ObjectMethod checkTreePerms($path, $perms, $filter) -> $html 
     120 
     121Perform a recursive check of the specified path.  The recursive check  
    86122is limited to the configured "PathCheckLimit".  This prevents excessive 
    87123delay on installations with large data or pub directories.  The 
     
    203239} 
    204240 
     241=begin TML 
     242 
     243---++ PROTECTED ObjectMethod checkCanCreateFile($path) -> $html 
     244 
     245Check that the given path can be created (or, if it already exists, 
     246can be written). If the existing path is a directory, recursively 
     247check for rw permissions using =checkTreePerms=. 
     248 
     249Returns a message or the empty string if the check passed. 
     250 
     251=cut 
     252 
    205253sub checkCanCreateFile { 
    206254    my ( $this, $name ) = @_; 
     
    235283} 
    236284 
    237 # Since Windows (without Cygwin) makes it hard to capture stderr 
    238 # ('2>&1' works only on Win2000 or higher), and Windows will usually have 
    239 # GNU tools in any case (installed for Foswiki since there's no built-in 
    240 # diff, grep, patch, etc), we only check for these tools on Unix/Linux 
    241 # and Cygwin. 
     285=begin TML 
     286 
     287---++ PROTECTED ObjectMethod checkGnuProgram($prog) -> $html 
     288 
     289Check for the availability of a GNU program. 
     290 
     291Since Windows (without Cygwin) makes it hard to capture stderr 
     292('2>&1' works only on Win2000 or higher), and Windows will usually have 
     293GNU tools in any case (installed for Foswiki since there's no built-in 
     294diff, grep, patch, etc), we only check for these tools on Unix/Linux 
     295and Cygwin. 
     296 
     297=cut 
     298 
    242299sub checkGnuProgram { 
    243300    my ( $this, $prog ) = @_; 
     
    279336} 
    280337 
    281 # Check for a compilable RE 
     338=begin TML 
     339 
     340---++ PROTECTED ObjectMethod checkRE($keys) -> $html 
     341Check that the configuration item identified by the given keys represents 
     342a compilable perl regular expression. 
     343 
     344=cut 
     345 
    282346sub checkRE { 
    283347    my ( $this, $keys ) = @_; 
     
    295359} 
    296360 
    297 sub copytree { 
    298     my ( $this, $from, $to ) = @_; 
    299     my $e = ''; 
    300  
    301     if ( -d $from ) { 
    302         if ( !-e $to ) { 
    303             mkdir($to) || return "Failed to mkdir $to: $!<br />"; 
    304         } 
    305         elsif ( !-d $to ) { 
    306             return "Existing $to is in the way<br />"; 
    307         } 
    308  
    309         my $d; 
    310         return "Failed to copy $from: $!<br />" unless opendir( $d, $from ); 
    311         foreach my $f ( grep { !/^\./ } readdir $d ) { 
    312             $f =~ /(.*)/; 
    313             $f = $1;    # untaint 
    314             $e .= $this->copytree( "$from/$f", "$to/$f" ); 
    315         } 
    316         closedir($d); 
    317     } 
    318  
    319     if ( !$e && !-e $to ) { 
    320         require File::Copy; 
    321         if ( !File::Copy::copy( $from, $to ) ) { 
    322             $e = "Failed to copy $from to $to: $!<br />"; 
    323         } 
    324     } 
    325     return $e; 
    326 } 
    327  
    328361my $rcsverRequired = 5.7; 
     362 
     363=begin TML 
     364 
     365---++ PROTECTED ObjectMethod checkRCSProgram($prog) -> $html 
     366Specific to RCS, this method checks that the given program is available. 
     367Check is only activated when the selected store implementation is RcsWrap. 
     368 
     369=cut 
    329370 
    330371sub checkRCSProgram { 
  • trunk/core/lib/Foswiki/Configure/Checkers/Store/Implementation.pm

    r7681 r8022  
    1818RcsWrap does not work well on Windows, please use RcsLite. 
    1919EOF 
    20     } 
    21      
    22     if ( $Foswiki::cfg{Store}{Implementation} =~ /RcsWrap/ ) { 
    23  
    24         # Check that GNU diff is found in PATH; used by rcsdiff 
    25         $mess .= $this->checkGnuProgram('diff'); 
    26  
    27         # Check all the RCS programs 
    28         $mess .= $this->checkRCSProgram('initBinaryCmd'); 
    29         $mess .= $this->checkRCSProgram('initTextCmd'); 
    30         $mess .= $this->checkRCSProgram('tmpBinaryCmd'); 
    31         $mess .= $this->checkRCSProgram('ciCmd'); 
    32         $mess .= $this->checkRCSProgram('ciDateCmd'); 
    33         $mess .= $this->checkRCSProgram('coCmd'); 
    34         $mess .= $this->checkRCSProgram('histCmd'); 
    35         $mess .= $this->checkRCSProgram('infoCmd'); 
    36         $mess .= $this->checkRCSProgram('histCmd'); 
    37         $mess .= $this->checkRCSProgram('diffCmd'); 
    38         $mess .= $this->checkRCSProgram('lockCmd'); 
    39         $mess .= $this->checkRCSProgram('unlockCmd'); 
    40         $mess .= $this->checkRCSProgram('delRevCmd'); 
    4120    } 
    4221 
  • trunk/core/lib/Foswiki/Configure/Types/URL.pm

    r7452 r8022  
    66use warnings; 
    77 
    8 use Foswiki::Configure::Type (); 
    9 our @ISA = ('Foswiki::Configure::Type'); 
     8use Foswiki::Configure::Types::STRING (); 
     9our @ISA = ('Foswiki::Configure::Types::STRING'); 
    1010 
    1111sub new { 
  • trunk/core/lib/Foswiki/Configure/Types/URLPATH.pm

    r7452 r8022  
    88use Foswiki::Configure::Types::STRING (); 
    99our @ISA = ('Foswiki::Configure::Types::STRING'); 
     10 
     11sub new { 
     12    my $class = shift; 
     13 
     14    return bless( { name => 'URLPATH' }, $class ); 
     15} 
    1016 
    11171; 
Note: See TracChangeset for help on using the changeset viewer.