Created
December 24, 2013 01:05
-
-
Save scribu/8107318 to your computer and use it in GitHub Desktop.
Set up the package index for WP-CLI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [ -z "$INSTALL_DIR" ]; then | |
INSTALL_DIR=$HOME/.wp-cli | |
fi | |
mkdir -p "$INSTALL_DIR" | |
cd "$INSTALL_DIR" | |
if [ ! -x composer.phar ]; then | |
echo "Installing Composer in $INSTALL_DIR" | |
echo "-------------------" | |
curl -sS https://getcomposer.org/installer | $WP_CLI_PHP | |
if [ $? -gt 0 ]; then | |
exit 1 | |
fi | |
fi | |
if [ ! -f composer.json ]; then | |
echo "Creating composer.json file in $INSTALL_DIR" | |
$COMPOSER init --stability dev --no-interaction | |
$COMPOSER config bin-dir bin | |
$COMPOSER config vendor-dir vendor | |
fi | |
echo "Ensuring the package index is available in composer.json" | |
$COMPOSER config repositories.wp-cli composer http://wp-cli.org/package-index/ | |
if [ ! -f config.yml ]; then | |
echo "Creating config.yml file in $INSTALL_DIR" | |
echo "require:\n - vendor/autoload.php" > config.yml | |
else | |
echo "WARNING: Make sure you have vendor/autoload.php inside config.yml" | |
fi | |
echo "Setup completed." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See https://github.com/wp-cli/wp-cli/wiki/Community-Packages#setting-up-the-package-index