Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
#
# Wordpress spoon.me file
# https://github.com/spoonapps/spoonme/tree/master/wordpress/stable/spoon.me
#
# Created with Spoon CMD version 1.4.1171.0
#
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
###################################
# Meta tags
###################################
meta title="Wordpress"
meta name="wordpress"
meta namespace="wordpress"
###################################
# Pull dependency images
###################################
layer apache/apache,php/php,mysql/mysql
using gnu/wget,fart/fart,7-zip/7-zip,python/python:3.4.1
###################################
# Download and install
###################################
# Set working directory
cmd mkdir c:\Workspace
workdir c:\Workspace
# Download
cmd wget --no-check-certificate --no-verbose -O latest.zip http://wordpress.org/latest.zip
# Extract
cmd 7z.exe x latest.zip -oC:\
# Get version number
batch
echo import re >> getVersion.py
echo f = open('c:\\wordpress\\readme.html', 'r') >> getVersion.py
echo version = ''.join(re.findall('Version (\d+\.\d+\.*\d*)', f.read())[0]) >> getVersion.py
echo print(version) >> getVersion.py
cmd python getVersion.py
var version = last
workdir C:\
###################################
# Initialize WordPress
###################################
# Configure WordPress
cmd "copy" C:\wordpress\wp-config-sample.php C:\wordpress\wp-config.php
workdir C:\wordpress
batch cmd
fart.exe --ignore-case C:\wordpress\wp-config.php "define('DB_NAME', 'database_name_here');" "define('DB_NAME', 'wordpress');"
fart.exe --ignore-case C:\wordpress\wp-config.php "define('DB_USER', 'username_here');" "define('DB_USER', 'root');"
fart.exe --ignore-case C:\wordpress\wp-config.php "define('DB_PASSWORD', 'password_here');" "define('DB_PASSWORD', '');"
ver > nul
###################################
# Initialize Apache
###################################
# Configure Apache
workdir C:\apache\apache2\conf
batch cmd
echo. >> httpd.conf
REM Enable PHP
echo LoadModule php5_module "C:/php/php5apache2_4.dll">> httpd.conf
echo AddHandler application/x-httpd-php .php>> httpd.conf
echo PHPIniDir "C:/php">> httpd.conf
fart.exe --ignore-case httpd.conf "DirectoryIndex " "DirectoryIndex index.php "
REM Set document root to WordPress directory
fart.exe --ignore-case httpd.conf "${SRVROOT}/htdocs" "C:/wordpress"
REM Enable mod rewrite for pretty links
fart.exe --ignore-case httpd.conf "#LoadModule rewrite_module modules/mod_rewrite.so" "LoadModule rewrite_module modules/mod_rewrite.so"
fart.exe --ignore-case httpd.conf " Options Indexes FollowSymLinks" " Options All"
fart.exe --ignore-case httpd.conf " AllowOverride None" " AllowOverride All"
ver > nul
###################################
# Initialize PHP
###################################
# Configure PHP
workdir C:\php
batch cmd
REM Uncomment required extension
fart.exe --ignore-case php.ini ";extension=php_mysql.dll" "extension=php_mysql.dll" & ver > nul
###################################
# Initialize MySQL
###################################
workdir C:\mysql\bin
batch cmd
echo Creating database instruction file
echo CREATE DATABASE wordpress;> spn_cmd.txt
REM ### LOOP #######################################
REM Attempt to create the database 5 times, quit if all fail
REM On slow machines, mysqld may not start fast enough to succeed on the first try
:createDB
REM increment count
set /A spn_temp_count=%spn_temp_count%+1
echo Using database instruction file to configure mysql, attempt #%spn_temp_count%
REM sleep for 5 seconds
ping -n 6 127.0.0.1 > nul
REM pass database instruction file to mysql.exe
mysql -u root < spn_cmd.txt
REM if this fails more than 5 times, then fail the setup
IF %spn_temp_count% GEQ 6 GOTO fail
REM if this succeeds, no need to retry
IF %ERRORLEVEL% EQU 0 GOTO succeed
REM retry
goto createDB
REM ################################################
REM issue exit code on failure
:fail
echo MySQL setup failed.
exit /b 1
REM clean up and shutdown on success
:succeed
echo MySQL setup succeeded.
del spn_cmd.txt
REM mysqladmin.exe -u root shutdown
###################################
# Environment Variables
###################################
# No variables needed
###################################
# Clean up
###################################
cmd rmdir c:\Workspace /s /q
cmd rmdir c:\wget /s /q
cmd rmdir c:\python34 /s /q
###################################
# Version
###################################
meta tag=version
###################################
# Startup File
###################################
setworkdir C:\wordpress
startup file ("cmd","/k echo Visit http://localhost:8080 to configure WordPress, if you haven't already.")