Skip to content

Populating a Fake Website on Windows

Knute Snortum edited this page Dec 2, 2015 · 11 revisions

Overview

In order to test the look of the MutopiaProject website, you will first have to create a fake website on your local machine and then you will have to populate it with all of the web site code and a subset of the archive. This is done with a series of scripts and programs that build the HTML and folders needed.

Prerequisites

You will need:

  • To clone the MutopiaWeb GitHub project to your desktop
  • A Java JDK installed and working on the command line
  • Perl installed and working on the command line
  • Gradle installed, or use MutopiaWeb\mpcore\gradlew.bat
  • A working knowledge of Windows, the command line, and batch files

A side note about PATH

You can edit environment variables, including PATH, with Control Panel -> System and Security -> System, click Advanced system settings -> Environment Variables. I recommend creating "home" variables and adding them to your user PATH, for instance, JAVA_HOME=C:\Program Files\Java\jdk1.8.0_66 and add %JAVA_HOME%\bin to your PATH, usually at the end. This is so when the Java version changes, you only have to change JAVA_HOME and not hunt through your PATH.

Install the Java JDK

  • Go to Oracle's Java download page and click on JDK Download.
  • Install the JDK and JRE runtime.
  • Create or edit JAVA_HOME to point to the base of where Java is installed, for instance C:\Program Files\Java\jdk1.8.0_66.
  • Add %JAVA_HOME%\bin to the end of your user PATH.

Install Gradle

  • Go to the Gradle download page and download the ZIP file.
  • Unzip the download file. I like to put all my non-install programs in a folder called C:\Programs.
  • Create or edit the variable GRADLE_HOME to point to your installation path, for instance, C:\Programs\gradle2.9.
  • Add %GRADLE_HOME%\bin to the end of your user PATH variable.

Install Perl

Download Strawberry Perl and install.

The scripts

Before we populate the data portion of the website you will need compile the Java code that does the publishing work.

The Perl scripts

Build the Perl scripts by following the instructions in src/README. I found that my Perl installation needed the XML::XPath module installed first:

  • At the command prompt, type cpan
  • At the CPAN prompt, type install XML::XPath
  • Type quit

The Java programs

The Java libraries and utilities are now located in a folder called mpcore and their build instructions are in mpcore/README. Note that the default Java build does not move files into their final location so you will have to do that manually.

  • In File Explorer, go to MutopiaWeb\mpcore\Mutopia\build\install\Mutopia
  • Press Ctrl-A or select all folders.
  • Press Ctrl-C to copy
  • Navigate up to the MutopiaWeb folder
  • Press Ctrl-V to paste the folders

A minimal archive

The full MutopiaProject website has almost 2000 published pieces but we only need a minimum of 25 to build a local working website. The MutopiaWeb project only contains the site code and not data so you will have to clone the main site to publish some pieces. Let's assume your clone is in C:\Users\MyName\Mutopia. First, let's set a convenient environment variable to point to that location and your MutopiaWeb location:

setx MUTOPIA_BASE C:\Users\MyName\Mutopia
setx MUTOPIA_WEB C:\Users\MyName\MutopiaWeb

For these variables to be used, you must exit the command prompt and restart it. In addition you want to set your path so the various utilities and scripts can be resolved, so add the following to the end of your user PATH variable:

%MUTOPIA_WEB%\bin;%MUTOPIA_WEB%\UsefulScripts

Clone this wiki locally