X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/c377932312e66606baa8918275dc3bf2814ada53..04887011d4e8c4e4394fd95479972e636d7c48d7:/script/misc/update-wiki-pages diff --git a/script/misc/update-wiki-pages b/script/misc/update-wiki-pages old mode 100644 new mode 100755 index f5f0ccb5e..7cd40e59e --- a/script/misc/update-wiki-pages +++ b/script/misc/update-wiki-pages @@ -1,4 +1,5 @@ #!/usr/bin/env perl +use 5.010; use strict; use warnings; @@ -25,6 +26,10 @@ update-wiki-pages - Scrape the wiki for key/value wiki description pages perl script/misc/update-wiki-pages config/wiki_pages.yml +Or with prove(1): + + prove -e 'perl script/misc/update-wiki-pages' config/wiki_pages.yml + =cut # Get the command-line options @@ -37,7 +42,10 @@ Getopt::Long::Parser->new( # On --help help() if $help; -help() unless $ARGV[0]; +my $out_file = $ARGV[0]; +$out_file //= 'config/wiki_pages.yml'; + +help() unless -f $out_file; # Get a API interface my $mw = MediaWiki::API->new(); @@ -68,7 +76,7 @@ for my $lang ('', map { "${_}:" } qw[ Pt Fi De It HU Cz Fr RU Pl ]) { ok(1, "Got a total of $count{$_} ${_}s") for qw[ key value ]; # Dump to .yml file -open my $out, ">", $ARGV[0] or die "Can't open file '$ARGV[0]' supplied on the command line"; +open my $out, ">", $out_file or die "Can't open file '$out_file' supplied on the command line"; say $out "# THIS FILE IS AUTOGENERATED WITH THE script/misc/update-wiki-pages"; say $out "# PROGRAM DO NOT MANUALLY EDIT IT"; say $out "";