diff options
| author | Ailin Nemui | 2014-06-16 04:11:29 +0200 | 
|---|---|---|
| committer | Ailin Nemui | 2014-06-24 18:28:59 +0200 | 
| commit | ca374a4a1acec99b19486549071ef6c9968b749a (patch) | |
| tree | ec4f7f7e66b423c392b5dbb46e424ec56a43247c /_testing/travis/_get_files_arr.zsh | |
| parent | 525b2128888f1e3ca2088a54cc086b102dbfe690 (diff) | |
| download | scripts.irssi.org-ca374a4a1acec99b19486549071ef6c9968b749a.tar.bz2 | |
Add travis testing to Irssi scripts.
Diffstat (limited to '_testing/travis/_get_files_arr.zsh')
| -rw-r--r-- | _testing/travis/_get_files_arr.zsh | 38 | 
1 files changed, 38 insertions, 0 deletions
| diff --git a/_testing/travis/_get_files_arr.zsh b/_testing/travis/_get_files_arr.zsh new file mode 100644 index 0000000..9fb6324 --- /dev/null +++ b/_testing/travis/_get_files_arr.zsh @@ -0,0 +1,38 @@ +filelist=(scripts/*.pl) +if [[ $TRAVIS_PULL_REQUEST != false ]] { +    local -a scriptfiles +    OIFS=$IFS; IFS=$'\n' +    scriptfiles=($(git diff --numstat $TRAVIS_BRANCH|cut -f3|grep '^scripts/.*\.pl')) +    IFS=$OIFS +    if [[ $#scriptfiles -gt 0 ]] { +	filelist=($scriptfiles) +    } +} \ +elif [[ $USE_ARTEFACTS_CACHE = yes ]] { +    local -a cache_allowed +    OIFS=$IFS; IFS=$'\n' +    cache_allowed=(scripts/${^$(grep -v __ARTEFACTS_CI__ old-artefacts/can-use-cache | cut -f2- -d\  )}) +    IFS=$OIFS + +    if [[ $REPORT_STAGE == yes ]] { +        autoload -Uz zargs +        { zargs -r -- old-artefacts/Test/${^cache_allowed:t:r} -- mv -nt Test } 2>/dev/null +        cached_run=($cache_allowed) +    } \ +    else { +        autoload -Uz is-at-least +        if { is-at-least 5.0.0 } { +            filelist=(${filelist:|cache_allowed}) +        } \ +        else { +	    # manually filter the array in zsh4 +            local -a scriptfiles +            for x ($filelist) { +                if [[ $+cache_allowed[(r)$x] -eq 0 ]] { +                    scriptfiles+=($x) +                } +            } +            filelist=($scriptfiles) +        } +    } +} | 
