Changeset 14311 for docs/Perl6/Spec
- Timestamp:
- 10/13/06 08:12:43 (2 years ago)
- svk:copy_cache_prev:
- 21165
- Files:
-
- 1 modified
-
docs/Perl6/Spec/update (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
docs/Perl6/Spec/update
r14291 r14311 10 10 11 11 sub 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 32 sub refresh_specs_from_source { 33 my ($BaseURI, $Spec, $naming_rule, $logfile) = @_; 34 my %Spec = %$Spec; 35 12 36 # okay, we are at author side - refresh Synopses 13 37 if (!eval { require LWP; require LWP::Simple; 1 }) { … … 18 42 our $ua; 19 43 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 Block24 05 Rule 06 Subroutine 09 Structure 10 Package25 11 Module 12 Object 13 Overload 17 Concurrency26 22 CPAN 26 Documentation 29 Functions27 );28 44 29 45 local $| = 1; … … 44 60 my $local_revision = -1; 45 61 46 my $logfile = "$FindBin::Bin/.spec-revision"; 47 48 if ( open(my $in, $logfile) ) { 62 if ( defined($logfile) and open(my $in, $logfile) ) { 49 63 chomp($local_revision = <$in>); 50 64 close $in; … … 52 66 53 67 if ($local_revision == $remote_revision) { 54 print "==> No changes .\n";68 print "==> No changes at $BaseURI.\n"; 55 69 return; 56 70 } 57 71 58 print "==> Synchronizing to revision $remote_revision :\n";72 print "==> Synchronizing to revision $remote_revision of $BaseURI:\n"; 59 73 60 74 for my $num (sort keys %Spec) { … … 63 77 use File::Basename; 64 78 my $dir = (dirname(__FILE__) || '.'); 79 my $remote_file = $naming_rule->($num); 65 80 LWP::Simple::mirror( 66 "$BaseURI/ S$num.pod" => "$FindBin::Bin/$file.pod"81 "$BaseURI/$remote_file" => "$FindBin::Bin/$file.pod" 67 82 ); 68 83 } 69 84 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 } 73 90 }
