Changeset 14311 for docs/Perl6/Spec

Show
Ignore:
Timestamp:
10/13/06 08:12:43 (2 years ago)
Author:
malon
svk:copy_cache_prev:
21165
Message:

[Spec/update, smokeserv/refresh-smoked-synopses.pl]
* Properly handle the specs that need to be updated from the Pugs repository

and not from the svn.perl.org spec repository.
Lanny++ for noticing weirdness with S29.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • docs/Perl6/Spec/update

    r14291 r14311  
    1010 
    1111sub refresh_specs { 
     12    my $BaseURI = 'http://svn.perl.org/perl6/doc/trunk/design/syn'; 
     13    my %Spec = qw( 
     14        01 Overview 02 Syntax       03 Operator     04 Block 
     15        05 Rule     06 Subroutine   09 Structure    10 Package 
     16        11 Module   12 Object       13 Overload 
     17    ); 
     18    my $naming_rule = sub { "S$_[0].pod" }; 
     19    my $logfile = "$FindBin::Bin/.spec-revision"; 
     20    refresh_specs_from_source($BaseURI, \%Spec, $naming_rule, $logfile); 
     21 
     22    my $PugsBaseURI = 'http://svn.openfoundry.org/pugs/docs/Perl6/Spec'; 
     23    my %SpecInPugs = qw( 
     24        17 Concurrency 22 CPAN      26 Documentation  29 Functions 
     25    ); 
     26    $naming_rule = sub { "$SpecInPugs{$_[0]}.pod" }; 
     27    $logfile = "$FindBin::Bin/.pugs-spec-revision"; 
     28    refresh_specs_from_source($PugsBaseURI, \%SpecInPugs, $naming_rule, 
     29                              $logfile); 
     30} 
     31 
     32sub refresh_specs_from_source { 
     33    my ($BaseURI, $Spec, $naming_rule, $logfile) = @_; 
     34    my %Spec = %$Spec; 
     35 
    1236    # okay, we are at author side - refresh Synopses 
    1337    if (!eval { require LWP; require LWP::Simple; 1 }) { 
     
    1842    our $ua; 
    1943    LWP::Simple->import('$ua'); 
    20  
    21     my $BaseURI = 'http://svn.perl.org/perl6/doc/trunk/design/syn'; 
    22     my %Spec = qw( 
    23         01 Overview 02 Syntax        03 Operator    04 Block 
    24         05 Rule     06 Subroutine    09 Structure   10 Package 
    25         11 Module   12 Object        13 Overload    17 Concurrency 
    26         22 CPAN     26 Documentation 29 Functions 
    27     ); 
    2844 
    2945    local $| = 1; 
     
    4460    my $local_revision = -1; 
    4561 
    46     my $logfile = "$FindBin::Bin/.spec-revision"; 
    47  
    48     if ( open(my $in, $logfile) ) { 
     62    if ( defined($logfile) and open(my $in, $logfile) ) { 
    4963        chomp($local_revision = <$in>); 
    5064        close $in; 
     
    5266 
    5367    if ($local_revision == $remote_revision) { 
    54         print "==> No changes.\n"; 
     68        print "==> No changes at $BaseURI.\n"; 
    5569        return; 
    5670    } 
    5771 
    58     print "==> Synchronizing to revision $remote_revision:\n"; 
     72    print "==> Synchronizing to revision $remote_revision of $BaseURI:\n"; 
    5973 
    6074    for my $num (sort keys %Spec) { 
     
    6377        use File::Basename; 
    6478        my $dir = (dirname(__FILE__) || '.'); 
     79        my $remote_file = $naming_rule->($num); 
    6580        LWP::Simple::mirror( 
    66             "$BaseURI/S$num.pod" => "$FindBin::Bin/$file.pod" 
     81            "$BaseURI/$remote_file" => "$FindBin::Bin/$file.pod" 
    6782        ); 
    6883    } 
    6984 
    70     open my $out, "> $logfile" or return; 
    71     print $out $remote_revision, "\n"; 
    72     close $out; 
     85    if(defined($logfile)) { 
     86        open my $out, "> $logfile" or return; 
     87        print $out $remote_revision, "\n"; 
     88        close $out; 
     89    } 
    7390}