mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Add DDEV
This commit is contained in:
parent
00cfa973e6
commit
df6e784d29
14 changed files with 369 additions and 0 deletions
42
.ddev/commands/web/orchestrate
Executable file
42
.ddev/commands/web/orchestrate
Executable file
|
@ -0,0 +1,42 @@
|
|||
#!/bin/bash
|
||||
set -x
|
||||
## Description: Set up the development environment
|
||||
## Usage: orchestrate
|
||||
## Example: "ddev orchestrate"
|
||||
|
||||
mkdir -p "${DDEV_DOCROOT}"
|
||||
pushd "${DDEV_DOCROOT}"
|
||||
PLUGIN_FOLDER="${DDEV_DOCROOT}/wp-content/plugins/${PLUGIN_NAME:-$DDEV_PROJECT}"
|
||||
VALID_ARGS=$(getopt -o fp: --long force,plugin: -- "$@")
|
||||
if [[ $? -ne 0 ]]; then
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
eval set -- "$VALID_ARGS"
|
||||
while [ : ]; do
|
||||
case "$1" in
|
||||
-f | --force)
|
||||
echo "Removing WordPress installation"
|
||||
shift
|
||||
export RECREATE_ENV=1;
|
||||
popd
|
||||
find "${DDEV_DOCROOT}" -mindepth 1 ! -regex "^${PLUGIN_FOLDER}\(/.*\)?" -delete
|
||||
pushd "${DDEV_DOCROOT}"
|
||||
;;
|
||||
-p | --plugin)
|
||||
echo "Processing 'plugin' option. Input argument is '$2'"
|
||||
shift 2
|
||||
;;
|
||||
--) shift;
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Execute all fragments from orchestrate.d
|
||||
if [ -d "${0}.d" ]; then
|
||||
for FN in ${0}.d/*.sh ; do
|
||||
echo $FN
|
||||
source "${FN}"
|
||||
done
|
||||
fi
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
if ! wp core download; then
|
||||
echo 'WordPress is already installed.'
|
||||
exit
|
||||
fi
|
6
.ddev/commands/web/orchestrate.d/01_gitignore.sh
Normal file
6
.ddev/commands/web/orchestrate.d/01_gitignore.sh
Normal file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
cat << 'EOF' > ".gitignore"
|
||||
# ignores everything in the docroot (docroot in config.yaml), this path may not be included in the standard .ddev/.gitignore.
|
||||
*
|
||||
EOF
|
22
.ddev/commands/web/orchestrate.d/05_wp_config.sh
Normal file
22
.ddev/commands/web/orchestrate.d/05_wp_config.sh
Normal file
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Create wp-config.php
|
||||
# the PHP snippet avoids some notices during CLI calls
|
||||
# https://make.wordpress.org/cli/handbook/guides/common-issues/#php-notice-undefined-index-on-_server-superglobal
|
||||
printf '
|
||||
if ( defined( "WP_CLI" ) && WP_CLI && ! isset( $_SERVER["HTTP_HOST"] ) ) {
|
||||
$_SERVER["HTTP_HOST"] = "%s";
|
||||
}
|
||||
' "${DDEV_HOSTNAME}" | wp config create \
|
||||
--dbname=db \
|
||||
--dbuser=db \
|
||||
--dbpass=db \
|
||||
--dbhost=db \
|
||||
--force \
|
||||
--extra-php
|
||||
|
||||
wp config set WP_DEBUG true --raw
|
||||
wp config set WP_DEBUG_DISPLAY true --raw
|
||||
wp config set WP_DEBUG_LOG true --raw
|
||||
wp config set WP_SITEURL '(isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] ? "https://" : "http://") . $_SERVER["HTTP_HOST"]' --raw
|
||||
wp config set WP_HOME '(isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] ? "https://" : "http://") . $_SERVER["HTTP_HOST"]' --raw
|
15
.ddev/commands/web/orchestrate.d/10_wp_install.sh
Normal file
15
.ddev/commands/web/orchestrate.d/10_wp_install.sh
Normal file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ ! -z "${RECREATE_ENV}" ]; then
|
||||
echo "Deleting database before creating a new one"
|
||||
wp db clean --yes
|
||||
fi
|
||||
|
||||
wp core install \
|
||||
--title="${WP_TITLE}" \
|
||||
--admin_user="${ADMIN_USER}" \
|
||||
--admin_password="${ADMIN_PASS}" \
|
||||
--url="${DDEV_PRIMARY_URL}" \
|
||||
--admin_email="${ADMIN_EMAIL}" \
|
||||
--skip-email
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
wp plugin is-installed akismet && wp plugin uninstall akismet
|
||||
wp plugin is-installed hello && wp plugin uninstall hello
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
popd
|
||||
|
||||
composer install
|
||||
yarn run build:dev
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
pushd "${DDEV_DOCROOT}"
|
||||
|
||||
wp plugin activate "${PLUGIN_NAME:-$DDEV_PROJECT}"
|
3
.ddev/commands/web/orchestrate.d/50_woocommerce.sh
Normal file
3
.ddev/commands/web/orchestrate.d/50_woocommerce.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
wp plugin install woocommerce --version="${WC_VERSION}" --activate
|
9
.ddev/commands/web/orchestrate.d/60_flush_rewrites.sh
Normal file
9
.ddev/commands/web/orchestrate.d/60_flush_rewrites.sh
Normal file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Needed for generating the .htaccess file
|
||||
echo "apache_modules:
|
||||
- mod_rewrite
|
||||
" > wp-cli.yml
|
||||
|
||||
wp rewrite structure '/%postname%'
|
||||
wp rewrite flush --hard
|
3
.ddev/commands/web/orchestrate.d/70_themes.sh
Normal file
3
.ddev/commands/web/orchestrate.d/70_themes.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
wp theme install storefront --activate
|
Loading…
Add table
Add a link
Reference in a new issue