diff options
Diffstat (limited to '_testing')
| -rw-r--r-- | _testing/README.markdown | 1 | ||||
| -rw-r--r-- | _testing/config.yml | 16 | ||||
| -rw-r--r-- | _testing/travis/update-scripts-yaml.pl | 31 |
3 files changed, 43 insertions, 5 deletions
diff --git a/_testing/README.markdown b/_testing/README.markdown index 0a5b751..7e2f8f1 100644 --- a/_testing/README.markdown +++ b/_testing/README.markdown @@ -42,3 +42,4 @@ The following keys are recognised in config.yml: * broken_modules: - modules to never auto-install, for example because they hang Travis * whitelist: - list of scripts that are allowed to fail +* scripts_yaml_keys: - list of keys to copy from irssi header to scripts.dmp diff --git a/_testing/config.yml b/_testing/config.yml index e5118c4..75998e5 100644 --- a/_testing/config.yml +++ b/_testing/config.yml @@ -1,4 +1,20 @@ --- +scripts_yaml_keys: + # required + - filename + - version + - authors + - contact + - name + - description + - license + # optional + - url + - commands + - note + - modules + # explicit + - modified additional_system_deps: - libconfig-simple-perl - libyaml-perl 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; |
