Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prompt for WordPress version #10

Merged
merged 3 commits into from
May 17, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions vvv
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,24 @@ if [[ $action = 'new' || $action = 'make' || $action = 'create' ]]; then
domain="$site.dev"
fi

while [ -z $version ]; do
# Get WordPress version
echo -n "WordPress version to install (leave blank for release version): "
read version
if [ -z $version ]; then
installversion=""
version="(release version)"
else
# Attempt to verify the existence of the version (hacky)
if curl -s http://codex.wordpress.org/Version_$version | grep 'currently no text' > ok; then
cecho "Version $version not found, try again" red
unset version
else
installversion=" --version=$version"
fi
fi
done

# Inform the user of what's about to happen and give them a chance to back out
# =============================================================================
echo -e "\nAbout to perform the following:\n\n* Halt Vagrant (if running)\n* Create directory $site in $path/www\n* Create files vvv-init.sh, wp-cli.yml, and vvv-hosts in directory $site\n* Create file $site.conf in $path/config/nginx-config/sites"
Expand Down Expand Up @@ -202,9 +220,9 @@ if [[ $action = 'new' || $action = 'make' || $action = 'create' ]]; then
"mysql -u root --password=root -e \"CREATE DATABASE IF NOT EXISTS \\\`$db_name\\\`\"\n"\
"mysql -u root --password=root -e \"GRANT ALL PRIVILEGES ON \\\`$db_name\\\`.* TO wp@localhost IDENTIFIED BY 'wp';\"\n\n"\
"if [ ! -d \"htdocs\" ]; then\n"\
"\techo 'Installing WordPress in $site/htdocs...'\n"\
"\techo 'Installing WordPress $version in $site/htdocs...'\n"\
"\tmkdir ./htdocs\ncd ./htdocs\n"\
"\twp core download --allow-root\n"\
"\twp core download --allow-root $installversion\n"
"\twp core config --dbname=\"$db_name\" --dbuser=wp --dbpass=wp --dbhost=\"localhost\" --allow-root\n"\
"\twp core install --url=$domain --title=\"$site - A WordPress Site\" --admin_user=admin --admin_password=password --admin_email=demo@example.com --allow-root\n"\
"\t\tcd -\n"\
Expand Down