You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
3.8 KiB
Bash

3.8.0 Release (#230) * Initial Coding Standards & Static Analysis Chanages. * Adds WordPress coding standards configuration. * Adds WordPress/PHP static analysis configuration. * Adds Git hooks to enforce checks and ensure quality on commits. * Adds initial local Docker development environment setup. * Current state of coding standards and analysis fixes. * Near Completion Update of PHP Code Sniffer Compliance Changes. * Fixes all PHP Code Sniffer WordPress Coding Standards Issues. * Updates Code Base to Pass Level 5 Baseline * Ensures PHP Code Sniffs continue to pass. * Fixes all code base issues to pass a level 5 PHP static analysis. * Updates PHPStan configurations to use a level 5 baseline. * Fixes Travis CI Configuration for Static Analysis * Fixes Plugin Pass i18n Checks * Adds i18n check to Travis CI builds. * Adds additional i18n run scripts to package.json. * Internationalization Checking & Fixes * Fixes missing i18n translation in main plugin file. * Adds update POT file. * Enforces i18n checks on commit with GrumPHP. * Adds i18n check step to Travis CI builds. * Gitattributes for export exclusions * Fixes missing loaded settings property assignment. * Adds Support for IDP Settings as Defined Constants - Reads from defined constants on plugin bootstrap. - Disabled plugin settings fields when defined constants are used. - Prevents savings plugin settings that are using defined constants. * Adds Node/NPM Environment Requirements * Fixes GrumPHP Bin Directory Configuration * Updates GrumPHP for Required Features - Bumps Composer package PHP version to 7.3. - Updates GrumPHP configuration to new format. * Plugin Settings Page Updates Using Constants - Ensures that any available defined constants are loaded in place of any database stored settings as an override. * Composer Dependency Updates & Travis CI Caching Fix * Travis CI Build Composer Update Change * NPM Updates & NVM Version Lock * Fixes NPM Package Lock File for Node v12 * Updates NPM Package Dependencies * Updates Changelog & README Files With Relevant Changes * Fixes Localizaion on Error Output * Changes GrumPHP Configuration to Provide a Full PHPCS Report * Fixes Local Dev Setup to Activate Plugin by Default * Adds Contribution Guide and Issue & PR Templates (#222) * Fixes Support GitHub Issue Template (#223) * Fixes space/typo with Wiki link (#224) * Fixes invalid wp-env plugin configuration (#225) * Improve Local Dev Setup by Reducing Setup Commands (#226) * Improve Local Dev Setup by Reducing Setup Commands * Adds Code Owners Configuration for Pull Requests * Fixes Development Dependencies and Setup Scripts (#227) * Dev release/3.8 (#229) * Adds dev Branch to Travis CI Builds * Release Preparation Enhancements & Release Changes Co-authored-by: Jonathan Daggerhart <jonathan@daggerhart.com>
4 years ago
#!/usr/bin/env bash
if [ $# -lt 3 ]; then
echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version] [skip-database-creation]"
exit 1
fi
DB_NAME=$1
DB_USER=$2
DB_PASS=$3
DB_HOST=${4-localhost}
WP_VERSION=${5-latest}
SKIP_DB_CREATE=${6-false}
WP_TESTS_DIR=${WP_TESTS_DIR-${TMPDIR-/tmp}/wordpress-tests-lib}
WP_CORE_DIR=${WP_CORE_DIR-${TMPDIR-/tmp}/wordpress/}
download() {
if [ `which curl` ]; then
curl -s "$1" > "$2";
elif [ `which wget` ]; then
wget -nv -O "$2" "$1"
fi
}
if [[ $WP_VERSION =~ [0-9]+\.[0-9]+(\.[0-9]+)? ]]; then
WP_TESTS_TAG="tags/$WP_VERSION"
elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
WP_TESTS_TAG="trunk"
else
# http serves a single offer, whereas https serves multiple. we only want one
download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json
grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json
LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//')
if [[ -z "$LATEST_VERSION" ]]; then
echo "Latest WordPress version could not be found"
exit 1
fi
WP_TESTS_TAG="tags/$LATEST_VERSION"
fi
set -ex
install_wp() {
if [ -d $WP_CORE_DIR ]; then
return;
fi
mkdir -p $WP_CORE_DIR
if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
mkdir -p /tmp/wordpress-nightly
download https://wordpress.org/nightly-builds/wordpress-latest.zip /tmp/wordpress-nightly/wordpress-nightly.zip
unzip -q /tmp/wordpress-nightly/wordpress-nightly.zip -d /tmp/wordpress-nightly/
mv /tmp/wordpress-nightly/wordpress/* $WP_CORE_DIR
else
if [ $WP_VERSION == 'latest' ]; then
local ARCHIVE_NAME='latest'
else
local ARCHIVE_NAME="wordpress-$WP_VERSION"
fi
download https://wordpress.org/${ARCHIVE_NAME}.tar.gz /tmp/wordpress.tar.gz
tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR
fi
download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php
}
install_test_suite() {
# portable in-place argument for both GNU sed and Mac OSX sed
if [[ $(uname -s) == 'Darwin' ]]; then
local ioption='-i .bak'
else
local ioption='-i'
fi
# set up testing suite if it doesn't yet exist
if [ ! -d $WP_TESTS_DIR ]; then
# set up testing suite
mkdir -p $WP_TESTS_DIR
svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes
svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data
fi
if [ ! -f wp-tests-config.php ]; then
download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php
# remove all forward slashes in the end
WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::")
sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php
sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php
sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php
sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php
sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php
fi
}
install_db() {
if [ ${SKIP_DB_CREATE} = "true" ]; then
return 0
fi
# parse DB_HOST for port or socket references
local PARTS=(${DB_HOST//\:/ })
local DB_HOSTNAME=${PARTS[0]};
local DB_SOCK_OR_PORT=${PARTS[1]};
local EXTRA=""
if ! [ -z $DB_HOSTNAME ] ; then
if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then
EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp"
elif ! [ -z $DB_SOCK_OR_PORT ] ; then
EXTRA=" --socket=$DB_SOCK_OR_PORT"
elif ! [ -z $DB_HOSTNAME ] ; then
EXTRA=" --host=$DB_HOSTNAME --protocol=tcp"
fi
fi
# create database
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
}
install_wp
install_test_suite
install_db