X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fg1a%2Fcomposer-test-scenarios%2Fscripts%2Fdependency-licenses;fp=vendor%2Fg1a%2Fcomposer-test-scenarios%2Fscripts%2Fdependency-licenses;h=35c6552742d6255ef0d33af6fee4f19c552f1c98;hp=0000000000000000000000000000000000000000;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/vendor/g1a/composer-test-scenarios/scripts/dependency-licenses b/vendor/g1a/composer-test-scenarios/scripts/dependency-licenses new file mode 100755 index 000000000..35c655274 --- /dev/null +++ b/vendor/g1a/composer-test-scenarios/scripts/dependency-licenses @@ -0,0 +1,25 @@ +#!/bin/bash + +# +# Append the licenses for this project's dependencies to the end of the LICENSE file, if it exists. +# + +dir='.' +target='./LICENSE' +tmp="$target.tmp" +year="$(date '+%Y')" + +# Update dependency licenses in the LICENSE file, if it exists. +if [[ -f "$target" ]] ; then + sed \ + -e "s/\(^ *Copyright [^0-9]*[0-9][0-9][0-9][0-9]\)\([0-9-]*\)/\1-$year/" \ + -e "s/\(^ *Copyright [^0-9]*$year\)\(-$year\)/\1/" \ + -e '/DEPENDENCY LICENSES:/,$d' "$target" | sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' > "$tmp" + ( + echo + echo "DEPENDENCY LICENSES:" + echo + composer -n --working-dir=$dir licenses --no-dev | sed -e '1,/^ *$/d' + ) >> "$tmp" + mv -f "$tmp" "$target" +fi