Changeset 12367

Show
Ignore:
Timestamp:
08/17/06 13:41:34 (2 years ago)
Author:
agentz
Message:

[docs/Perl6]
* added script Spec/update which can sync the synopses from the svn repos
removed the syn-updating code from Makefile.PL and make Makefile.PL call Spec/update instead
added Spec/update.bat which is a Win32 shortcut for the Spc/update script.

Location:
docs/Perl6
Files:
2 added
1 modified

Legend:

Unmodified
Added
Removed
  • docs/Perl6/Makefile.PL

    r10856 r12367  
    1313makemaker_args( PMLIBDIRS => [ grep { -d } glob("[A-Z]*") ]); 
    1414 
    15 refresh_specs() if -d '../../misc/pX'; 
     15system "$^X Spec/update"; 
    1616 
    1717WritePugs  (5); 
    18  
    19 sub refresh_specs { 
    20     # okay, we are at author side - refresh Synopses 
    21     local $@; 
    22     eval { require LWP; require LWP::Simple; 1 } or return; 
    23  
    24     use vars '$ua'; 
    25     LWP::Simple->import('mirror', '$ua'); 
    26  
    27     my $BaseURI = 'http://svn.perl.org/perl6/doc/trunk/design/syn'; 
    28     my %Spec = qw( 
    29         01 Overview 02 Syntax       03 Operator     04 Block 
    30         05 Rule     06 Subroutine   09 Structure    10 Package 
    31         11 Module   12 Object       13 Overload 
    32     ); 
    33  
    34     my $request = HTTP::Request->new(HEAD => $BaseURI); 
    35     my $response = $ua->request($request); 
    36  
    37     $response->is_success or return; 
    38  
    39     my $etags = $response->header('ETag') or return; 
    40     ($etags =~ /(\d+)/) or return; 
    41  
    42     local $| = 1; 
    43     print "==> Refreshing specs from $BaseURI...\n"; 
    44  
    45     my $remote_revision = $1; 
    46     my $local_revision = -1; 
    47  
    48     if ( open(FH, '.spec-revision') ) { 
    49         chomp($local_revision = <FH>); 
    50         close FH; 
    51     } 
    52  
    53     if ($local_revision == $remote_revision) { 
    54         print "==> No changes.\n"; 
    55         return; 
    56     } 
    57  
    58     print "==> Synchronizing to revision $remote_revision:\n"; 
    59  
    60     for my $num (sort keys %Spec) { 
    61         my $file = $Spec{$num}; 
    62         print "  $num --> Spec/$file\n"; 
    63         use File::Basename; 
    64         my $dir = (dirname(__FILE__) || '.'); 
    65         LWP::Simple::mirror( 
    66             "$BaseURI/S$num.pod" => "$dir/Spec/$file.pod" 
    67         ); 
    68     } 
    69  
    70     open FH, '>', '.spec-revision' or return; 
    71     print FH $remote_revision, "\n"; 
    72     close FH; 
    73 }