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

# Daintree - WP install script
#
# A simple bash script to automate installation of WordPress with some settings.
#
# Dependencies:
# 1: WP-CLI
# 2: Bash
# 3: Composer
# 4: WP-CLI DotEnv Command (https://github.com/aaemnnosttv/wp-cli-dotenv-command)
##

# Set up the shell variables for colors
# http://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux
yellow=`tput setaf 3`;
green=`tput setaf 2`;
red=`tput setaf 1`;
clear=`tput sgr0`;

function hr ()
{
	echo ""
	echo "-------------------------------------------------------------------------------"
	echo ""
}

function title {
	echo -n "${green}$1${clear}"
}

function error {
	echo -n "${red}$1${clear}"
}

function question {
	echo
	echo "${yellow}$1${clear}"
}

clear
hr
echo "WordPress Install Script"
hr

#Check composer installed
if [ ! -x "$(command -v composer)" ]; then
  error "Composer is not installed."
	echo
	exit 1
fi

#Check wp-cli installed
if [ ! -x "$(command -v wp)" ]; then
	error "wp-cli is not installed."
	echo
	exit 1
fi

# Check wp-cli dotenv command
target_dir="~/.wp-cli"
if [ ! -d $target_dir ]; then
	error "wp-cli in home directory does not exist."
  echo
	#exit 1
fi

echo
title "Create config file"
echo

#First check if config file exsts... wp dotenv list
wp dotenv init --template=.env.example --interactive --with-salts

question "Have you already created a database? (Y/n) "
read -e response
response=${response:-n}
if [[ $response =~ ^[Nn]$ ]]
then
	echo "You need to create a database first."<commit_msg>Exit if no wp-cli in home.<commit_after>#!/usr/bin/env bash

# Daintree - WP install script
#
# A simple bash script to automate installation of WordPress with some settings.
#
# Dependencies:
# 1: WP-CLI
# 2: Bash
# 3: Composer
# 4: WP-CLI DotEnv Command (https://github.com/aaemnnosttv/wp-cli-dotenv-command)
##

# Set up the shell variables for colors
# http://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux
yellow=`tput setaf 3`;
green=`tput setaf 2`;
red=`tput setaf 1`;
clear=`tput sgr0`;

function hr ()
{
	echo ""
	echo "-------------------------------------------------------------------------------"
	echo ""
}

function title {
	echo -n "${green}$1${clear}"
}

function error {
	echo -n "${red}$1${clear}"
}

function question {
	echo
	echo "${yellow}$1${clear}"
}

clear
hr
echo "WordPress Install Script"
hr

#Check composer installed
if [ ! -x "$(command -v composer)" ]; then
  error "Composer is not installed."
	echo
	exit 1
fi

#Check wp-cli installed
if [ ! -x "$(command -v wp)" ]; then
	error "wp-cli is not installed."
	echo
	exit 1
fi

# Check wp-cli dotenv command
target_dir="~/.wp-cli"
if [ ! -d $target_dir ]; then
	error "wp-cli in home directory does not exist."
  echo
	exit 1
fi

echo
title "Create config file"
echo

#First check if config file exsts... wp dotenv list
wp dotenv init --template=.env.example --interactive --with-salts

question "Have you already created a database? (Y/n) "
read -e response
response=${response:-n}
if [[ $response =~ ^[Nn]$ ]]
then
	echo "You need to create a database first."
{'fraction_non_alphanumeric': 0.18722186904005086, 'fraction_numerical': 0.013350286077558804, 'mean_word_length': 2.9936548223350252, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '2786739', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1056, 'n_words': 360}