forked from blueblazeassociates/wp-cli-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswitch-version-via-composer.bash
More file actions
37 lines (26 loc) · 1.01 KB
/
switch-version-via-composer.bash
File metadata and controls
37 lines (26 loc) · 1.01 KB
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
37
#!/usr/bin/env bash
# Include settings.
source utils/settings.bash
# Include the link script.
source ${UTILS_DIR}/filesystem.bash
# Capture the absolute paths for some settings.
BIN_DIR_ABSOLUTE=$(realpath_cp $PWD/${BIN_DIR})
VENDOR_DIR_ABSOLUTE=$(realpath_cp $PWD/${VENDOR_DIR})
# Include text variables.
source ${UTILS_DIR}/switch-text.bash
# Process command line arguments.
source ${UTILS_DIR}/args.bash
# Check the installation to make sure we're not clobbering anything.
# Make the user do the clobbering.
source ${UTILS_DIR}/switch-check.bash
# Looks everything is OK.
# Let the user know that something is happening.
echo "$WAITING_TEXT"
# Use composer to install WP-CLI.
rmlink ${BIN_DIR_ABSOLUTE}/wp
composer remove wp-cli/wp-cli wp-cli/wp-cli-bundle --quiet
composer require wp-cli/wp-cli:$1 wp-cli/wp-cli-bundle:$1 --update-no-dev --optimize-autoloader${DO_QUIET_COMPOSER}
# Setup a symlink to WP-CLI.
link ${BIN_DIR_ABSOLUTE}/wp ${VENDOR_DIR_ABSOLUTE}/wp-cli/wp-cli/bin/wp
# Let the user know.
echo "$FINISHED_TEXT"