Skip to content

Commit

Permalink
Install plugins together
Browse files Browse the repository at this point in the history
  • Loading branch information
connortann committed Feb 14, 2022
1 parent 33108bc commit 35ca911
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,22 @@ $poetry_ config virtualenvs.create ${VIRTUALENVS_CREATE}
$poetry_ config virtualenvs.in-project ${VIRTUALENVS_IN_PROJECT}
$poetry_ config virtualenvs.path ${VIRTUALENVS_PATH}

# Parse plugin array from comma- or whitespace-delimited string
# Parse plugin array from string, handle comma, whitespace or newline delimiters
read -r -d "" -a plugins <<< "$(echo "$POETRY_PLUGINS" | tr "," " ")"
if [ ${#plugins[@]} -gt 0 ]; then

# Ensure poetry version >= 1.2
# Simplistic version comparison, will need to be updated if Poetry 2.X is released
major=${VERSION:0:1}
minor=${VERSION:2:1}
if [ $major -lt 1 ] || [ $minor -lt 2 ]; then
if [ "$major" -lt 1 ] || [ "$minor" -lt 2 ]; then
echo "Use of plugins requires Poetry version >= 1.2"
exit 1
fi

# Install plugins
for plugin in "${plugins[@]}"
do
echo "Installing plugin: $plugin"
$poetry_ plugin add "$plugin" || exit 1
done
echo "Installing plugins: " "${plugins[@]}"
$poetry_ plugin add "${plugins[@]}" || exit 1
fi

config="$($poetry_ config --list)"
Expand Down

0 comments on commit 35ca911

Please sign in to comment.