Created
March 25, 2015 20:51
-
-
Save jeremyHixon/c29079502507f5f7dece to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set db_user to "user" | |
set db_pass to "password" | |
set db_path to "/usr/local/mysql/bin/mysql" | |
set local_url to "http://localhost/" | |
set wp_url to "https://wordpress.org/" | |
set latest_wp to "latest.tar.gz" | |
set posix_path to POSIX path of (path to sites folder from user domain) as text | |
display dialog "New site folder name (e.g. custom-name):" default answer "wordpress" buttons {"Install", "Cancel"} default button 1 | |
if the button returned of the result is "Cancel" then | |
display dialog "Cancelled" | |
else | |
set folder_name to (text returned of the result) | |
end if | |
set curl_command to "curl " & wp_url & latest_wp & " -o " & posix_path & latest_wp | |
do shell script curl_command | |
set tar_command to "tar -xvzf " & posix_path & latest_wp & " -C " & posix_path | |
do shell script tar_command | |
set delete_command to "rm " & posix_path & latest_wp | |
do shell script delete_command | |
if folder_name is not "wordpress" then | |
set rename_command to "mv " & posix_path & "wordpress " & posix_path & folder_name | |
do shell script rename_command | |
end if | |
set own_command to "chown -R _www " & posix_path & folder_name | |
do shell script own_command with administrator privileges | |
set mod_command to "chmod -R g+w " & posix_path & folder_name | |
do shell script mod_command with administrator privileges | |
set database_command to db_path & " -u " & db_user & " -p" & db_pass & " -e 'create database `" & folder_name & "`;'" | |
do shell script database_command | |
set user_name to short user name of (system info) | |
open location local_url & "~" & user_name & "/" & folder_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment