-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-composer.sh
36 lines (28 loc) · 1.17 KB
/
install-composer.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# This file is designed to be included in other scripts, and assumes you are currently in the pluginade root directory.
# Check if there's composer.json file in the plugin root already, and if its name is different than "pluginade-scripts"
cd $plugindir;
ls;
if ([ -f composer.json ] && [ "$(jq -r '.name' composer.json)" = "pluginade/pluginade-scripts" ]) || [ ! -f composer.json ]; then
# Copy the composer.json file from .pluginade to the plugin directory root.
cp /usr/src/pluginade/pluginade-scripts/composer.json composer.json
fi
# Install pluginade composer dependencies.
if [ ! -d vendor ] || [ -z "$(ls -A "vendor")" ]; then
echo "Running composer install in pluginade root at $DIR..."
composer install
fi
# Loop through each wp-module in the plugin, and install their dependencies.
for DIR in "$plugindir"/wp-modules/*; do
# If this module has a composer.json file.
if [ -f "$DIR/composer.json" ];then
# Go to the directory of this wp-module.
cd "$DIR";
echo "Confirming composer dependencies for $DIR"
if [ ! -d vendor ] || [ -z "$(ls -A "vendor")" ]; then
echo "Running composer install..."
composer install
fi
cd - > /dev/null
fi
done