diff options
| author | Alexander Færøy | 2015-01-26 22:09:16 +0100 |
|---|---|---|
| committer | Alexander Færøy | 2015-01-26 22:09:16 +0100 |
| commit | 7a8cbb3a3da2658e7eee3530ee6b78b43ca6cfbc (patch) | |
| tree | bcf04620a18327d954a07cd24c32417355e56652 /_testing | |
| parent | 9115699f7227fcefbaf8f8b4eb4d4eaafe0ede16 (diff) | |
| parent | 3d9bef11e6848670b61e6267211a37b238372923 (diff) | |
| download | scripts.irssi.org-7a8cbb3a3da2658e7eee3530ee6b78b43ca6cfbc.tar.bz2 | |
Merge pull request #115 from ailin-nemui/initial_auto_scripts_yaml
Initial commit for automated scripts.yaml update
Diffstat (limited to '_testing')
| -rw-r--r-- | _testing/README.markdown | 1 | ||||
| -rw-r--r-- | _testing/config.yml | 16 | ||||
| -rwxr-xr-x | _testing/report-test.zsh | 10 | ||||
| -rwxr-xr-x | _testing/travis/autoinstall-perl-prereqs.zsh | 9 | ||||
| -rw-r--r-- | _testing/travis/update-scripts-yaml.pl | 31 |
5 files changed, 57 insertions, 10 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/report-test.zsh b/_testing/report-test.zsh index ffe536a..6c05f46 100755 --- a/_testing/report-test.zsh +++ b/_testing/report-test.zsh @@ -8,9 +8,13 @@ local T= if [[ $MARKDOWN_REPORT == 1 ]] { echo '## Irssi Scripts Test Report' - failmark=:x: - passmark=:white_check_mark: - skipmark=:construction: + # github started to block excess use of emojis + #failmark=:x: + #passmark=:white_check_mark: + #skipmark=:construction: + failmark=✘ + passmark=✔ + skipmark=☡ T="|" } \ else { diff --git a/_testing/travis/autoinstall-perl-prereqs.zsh b/_testing/travis/autoinstall-perl-prereqs.zsh index 11c9824..4e47b37 100755 --- a/_testing/travis/autoinstall-perl-prereqs.zsh +++ b/_testing/travis/autoinstall-perl-prereqs.zsh @@ -4,22 +4,26 @@ local -a modlist modlist=($(scan-perl-prereqs $filelist)) +echo -n ... >&2 -sudo apt-file update >/dev/null 2>&1 +sudo apt-file update local -a ubu_pkgs local -a cpan_mods for mod ($modlist) { mod=${mod%\~*} if [[ $mod != Irssi* && $mod != feature ]] { + echo -n $mod >&2 if { ! perl -M$mod -E1 2>/dev/null } { local -a ubu_pkg ubu_pkg=($(apt-file -l search "/perl5/${mod//:://}.pm")) - if [[ $#ubu_pkg -gt 0 ]] { ubu_pkgs+=($ubu_pkg) } \ + if [[ $#ubu_pkg -gt 0 ]] { ubu_pkgs+=($ubu_pkg); echo -n '(u)' >&2 } \ else { cpan_mods+=($mod) } } + echo -n ' ' >&2 } } +echo >&2 if [[ $#ubu_pkgs -gt 0 ]] { sudo apt-get install -qq $ubu_pkgs } @@ -29,6 +33,7 @@ typeset -A broken_mods broken_tests=($(perl -MYAML::Tiny=LoadFile -e'print "$_ 1 " for @{LoadFile(+shift)->{cpan}{broken_tests}}' _testing/config.yml)) broken_mods=($(perl -MYAML::Tiny=LoadFile -e'print "$_ 1 " for @{LoadFile(+shift)->{cpan}{broken_modules}}' _testing/config.yml)) +echo ... >&2 for mod ($cpan_mods) { if { ! perl -M$mod -E1 2>/dev/null } { local skip_test= 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; |
