Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updater rewrite #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 23 additions & 18 deletions updater.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
ITER=1
#!/bin/bash

for plugin in $(composer outdated --direct -m);
composer outdated --direct -m | while read line;
do
Q=`expr $ITER % 2`
if [ $Q -eq 0 ]
then
ITER=$(expr $ITER + 1)
continue # Skip current version number
fi
Q=`expr $ITER % 3`
if [ $Q -eq 0 ]
then
ITER=0
continue # Skip available version number
fi
composer update "$plugin" &&
read -a arr <<< $line
plugin=${arr[0]}

# Check if the line is actually for a package, and not an error.
if ! [[ "$plugin" == *"/"* ]]; then
continue;
fi

# Setup versions
current=${arr[1]}
latest=${arr[3]}

# If no latest version is available, skip it
if [[ -z $latest ]]; then
continue
fi

echo "composer update ${plugin}"
composer require "$plugin" &&
git add composer.lock &&
git commit -m "'update $plugin plugin'";
ITER=$(expr $ITER + 1)
done;
git commit -m "'update ${plugin} [${current} => ${latest}]'";
done;