<commit_before>#!/usr/bin/env bash

#
# This file is part of the fabschurt/wp-tweaks package.
#
# (c) 2014-2015 <NAME> <<EMAIL>>
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
#
# @author    <NAME> <<EMAIL>>
# @license   MIT
# @copyright 2014-2015 <NAME>
#

# Stop execution on first error
set -e

# Initial and final blank lines
echo
trap 'echo' EXIT

# Check that the working directory is the root of the project
if [[ ! -f './composer.json' ]]; then
  echo 'No `composer.json` file found. You must `cd` into the root of your project before running this script.'
  exit 1
fi

# Check that WP-CLI is installed
wp_cli_path='./vendor/bin/wp'
if [[ ! -f $wp_cli_path ]]; then
  echo 'Missing `wp-cli` executable. Have you run `composer install` yet?'
  exit 1
fi

# Echo everything to STDOUT
set -x

# Reset the test database
php -r "require_once './vendor/autoload.php'; require_once '/tmp/wordpress-tests-lib/includes/bootstrap.php';"

# Insert test data
test_user_id=$($wp_cli_path user create john_locke <EMAIL> --user_pass=password --role=editor --porcelain)
test_post_id=$($wp_cli_path post create --post_title="Don't tell me what I can't do" --post_content='4 8 15 16 23 42' --post_author=${test_user_id} --post_status='publish' --porcelain)

# Clean exit
exit 0<commit_msg>Add plugin installation step<commit_after>#!/usr/bin/env bash

#
# This file is part of the fabschurt/wp-tweaks package.
#
# (c) 2014-2015 <NAME> <<EMAIL>>
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
#
# @author    <NAME> <<EMAIL>>
# @license   MIT
# @copyright 2014-2015 <NAME>
#

# Stop execution on first error
set -e

# Initial and final blank lines
echo
trap 'echo' EXIT

# Check that the working directory is the root of the project
if [[ ! -f './composer.json' ]]; then
  echo 'No `composer.json` file found. You must `cd` into the root of your project before running this script.'
  exit 1
fi

# Check that WP-CLI is installed
wp_cli_path='./vendor/bin/wp'
if [[ ! -f $wp_cli_path ]]; then
  echo 'Missing `wp-cli` executable. Have you run `composer install` yet?'
  exit 1
fi

# Echo everything to STDOUT
set -x

# Install the plugin in the test installation
archive_path='/tmp/wordpress/wp-tweaks.zip'
git archive --verbose --format=zip -0 > $archive_path HEAD
$wp_cli_path plugin install $archive_path --activate

# Reset the test database
php -r "require_once './vendor/autoload.php'; require_once '/tmp/wordpress-tests-lib/includes/bootstrap.php';"

# Insert test data
test_user_id=$($wp_cli_path user create john_locke <EMAIL> --user_pass=password --role=editor --porcelain)
test_post_id=$($wp_cli_path post create --post_title="Don't tell me what I can't do" --post_content='4 8 15 16 23 42' --post_author=${test_user_id} --post_status='publish' --porcelain)

# Clean exit
exit 0
{'fraction_non_alphanumeric': 0.12227520435967303, 'fraction_numerical': 0.020095367847411442, 'mean_word_length': 4.12565445026178, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '952887', 'n_tokens_mistral': 1034, 'n_tokens_neox': 967, 'n_words': 354}