diff options
| author | Ailin Nemui | 2015-01-17 17:49:19 +0100 | 
|---|---|---|
| committer | Ailin Nemui | 2015-01-18 02:21:52 +0100 | 
| commit | a0c44c8634c89038c8cab1ade7802d08ddde0ec6 (patch) | |
| tree | 21e579444958ba8b20eef98dfbc3fb3a1e89a13e /_testing/travis | |
| parent | eead9dfa87de80a205c60f5f7d03f2afbd884e3f (diff) | |
| download | scripts.irssi.org-a0c44c8634c89038c8cab1ade7802d08ddde0ec6.tar.bz2 | |
Extract only required keys from %IRSSI headers
This change will limit the keys in scripts.yaml to a set of explicitly
specified keys, omitting such entries as default_package and changed
Diffstat (limited to '_testing/travis')
| -rw-r--r-- | _testing/travis/update-scripts-yaml.pl | 31 | 
1 files changed, 26 insertions, 5 deletions
| diff --git a/_testing/travis/update-scripts-yaml.pl b/_testing/travis/update-scripts-yaml.pl index d3384a8..5762096 100644 --- a/_testing/travis/update-scripts-yaml.pl +++ b/_testing/travis/update-scripts-yaml.pl @@ -1,5 +1,21 @@  use strict; use warnings;  use YAML::Tiny; +use Scalar::Util; +BEGIN { +    sub YAML::Tiny::_has_internal_string_value { +	!Scalar::Util::looks_like_number($_[0]) +    } +} + +my @config; +if (open my $ef, '<:utf8', '_testing/config.yml') { +    @config = Load(do { local $/; <$ef> }); +} +my @yaml_keys; +if (@config) { +    @yaml_keys = @{ $config[0]{scripts_yaml_keys}//[] }; +} +die "no keys defined in config.yaml\n" unless @yaml_keys;  my @docs;  { open my $ef, '<:utf8', '_data/scripts.yaml' or die $!; @@ -49,15 +65,20 @@ for my $file (<scripts/*.pl>) {  	print "MISSING META FOR $base\n";      }  } -my @newdoc = map { $newmeta{$_} } sort keys %newmeta; +my @newdoc = map { +    my $v = $newmeta{$_}; +    +{ +        map { +            exists $v->{$_} +                ? ($_ => $v->{$_}) +                : () +        } sort @yaml_keys +    } +} sort keys %newmeta;  { open my $ef, '>:utf8', '_data/scripts.yaml' or die $!;    print $ef Dump \@newdoc;  } -my @config; -if (open my $ef, '<:utf8', '_testing/config.yml') { -    @config = Load(do { local $/; <$ef> }); -}  if (@config && @{$config[0]{whitelist}//[]}) {      my $changed;      my @wl; | 
