mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-29 18:27:44 +08:00
51 lines
881 B
Bash
51 lines
881 B
Bash
#!/usr/bin/env sh
|
|
set -e
|
|
# execute `composer global require comcast/php-legal-licenses` before run this shell
|
|
|
|
NOW=$(date +%s)
|
|
BASEPATH=$(cd `dirname $0`; cd ../src/; pwd)
|
|
|
|
repos=$(ls "$BASEPATH")
|
|
echo $NOW
|
|
|
|
function generate() {
|
|
if [ -f "composer.json" ]; then
|
|
composer update -q
|
|
php-legal-licenses generate
|
|
fi
|
|
if [ -f "composer.lock" ]; then
|
|
rm -rf ./composer.lock
|
|
fi
|
|
if [ -d "vendor" ]; then
|
|
rm -rf ./vendor
|
|
fi
|
|
if [ -f "licenses.md" ]; then
|
|
git add ./licenses.md
|
|
fi
|
|
}
|
|
|
|
cd ..
|
|
|
|
git checkout master && git checkout -b licenses-generate-"$NOW"
|
|
|
|
echo "Generating main repository";
|
|
generate
|
|
|
|
cd ./src
|
|
|
|
for REPO in $repos
|
|
do
|
|
echo "Generating $REPO";
|
|
cd "./$REPO"
|
|
|
|
generate
|
|
|
|
cd ../
|
|
|
|
done
|
|
|
|
git commit -m "Update licenses.md"
|
|
|
|
TIME=$(echo "$(date +%s) - $NOW" | bc)
|
|
|
|
printf "Execution time: %f seconds" "$TIME" |