Building the Website

Steven Zeil

Last modified: Jan 26, 2023
Contents:

CoWeM uses Gradle to automate the process of building the website.

Gradle is a build manager for software projects. Although a website may not involve programming in the usual sense, it can certainly be regarded as a software system. If your only experience with with build managers has been the ones built in to a programming IDE or the venerable Unix make utility, you may be surprised at the range of features provided by Gradle. Of particular relevance to CoWeM:

1 Running Gradle

 

The files gradlew , gradlew.bat, and gradlew-gui.bat are scripts that are used to launch the gradle build manager to request building the website. The .bat files are for Windows. The simple gradlew file is used for both Linux and OS/X.

The first time that you run one of these on a given machine, it will download the actual Gradle build manager and install it in your personal account area (Look for a .gradle directory in your user home directory.) It will then proceed to download the latest version of CoWeM and of the various software libraries used by CoWeM. This software is stored in a cache (within the afore-mentioned .gradledirectory). Items in the cache expire periodically (typically after 24 hours), so that Gradle will check at intervals to see if any of that software has been updated.

Gradle can be run in a command-line mode or a GUI mode.

1.1 Windows

To run in command-line mode, open a cmd window, cd to your course root directory, and run

gradlew target

The possible targets are discussed in the next section.

1.2 Linux

To run in command-line mode, open a terminal window, cd to your course root directory, and run

./gradlew target

The possible targets are discussed in the next section.

2 The Gradle Build Targets

The following are the targets that can be supplied to Gradle at the command line or selected from the GUI.

2.1 Building the Website

build
Build the website by processing the document sets. The resulting website can be found in the directory build/website (under the course root directory). You can use your favorite web browser “Open File” command to view any of the HTML files that have been generated.

The build target is the default. If you don’t specify a target at the command line, build is run.

clean
Delete all files that can be reconstructed via the build target. This is done by deleting the entire build directory.

As noted earlier, you can “clean” a project by simply deleting the build directory via normal operating system commands.

2.2 Deploying the Website

“Deploying” a website means to copy it onto the server where it will be hosted. Three options are supported for this. The relevant targets are:

 
deploy
Synchronize the build/website with a directory specified in the course configuration (build.gradle) as deployDestination.

This works only if the destination directory is on the same local file system as the machine on which you are working.

 
deployBySsh
Deploy the build/website to a directory on a remote machine configuration (build.gradle) as sshDeployURL.
  • You may optionally also specify an SSH key for access to that remote machine as sshDeployKey.
  • If no such key is used, this use any ssh key agent you might have running to authenticate on the remote machine.
    • There is currently no option for supplying a simple password. (Coming?)
  • Currently this deployment is done by packing the entire website into a Zip file archive, sending that file to the remote directory, and remotely issuing an unzip command there.

    If the website is large and only a few files have been changed, this can be quite slow.

 
deployByRsync
Synchronize the build/website with a directory on a remote machine configuration (build.gradle) as rsyncDeployURL using the rsync protocol.
  • This can only be done if the machine on which you are running has the rsync command installed.
  • You may optionally also specify an SSH key for access to that remote machine as rsyncDeployKey.
  • If no such key is used, this will still take advantage of any ssh key agent you might have running.
  • The rsync protocol will only transfer files that have been changed since the last deployment. For large files in which only small portions have changed, rsync will try to transfer only the changed portions. This makes rsync ideal for updating websites after only a few things have been changed.

All deployment commands will do a build first, if necessary.

2.3 Packaging the Website

Packaging refers to packing up the entire website into a single file that can later be uploaded to a particular server. All packages are deposited in the build/packages directory.

CoWeM cab build both “fat” and “thin” packages. A fat package contains the entire website. A thin package contains navigation items that link back to a deployed version of the full website elsewhere.

Build options are:

zip
Package the website as a Zip archive.

This can be unpacked in any directory managed by a web server to make the course content available. This includes a Blackboard content collection.

scorm
Package the website as a SCORM 1.2 package that can be imported into Blackboard or most other Learning Management Systems.

Brief instructions on importing a SCORM package into Blackboard is given below.

The SCORM format does not include calendar updates in Blackboard, but calendar entries can be generated and imported as a bbthin target.

2.4 Building a Specific Document Set Directory

If you are working intensively on a single document or document set, you can instruct CoWeM to build or deploy only that one document set, saving some time.

There are several ways to do this:

in Linux or OS/X. In Windows, you would do the same except using “" instead of ”/".

The targets that can be launched for a single document set are:

build
Same as the yop-level build target, but builds only the indicated document set.
deployDoc
Like the top-level deploy, this builds the document set and copies it to the appropriate deployment directory on the same machine.
deployDocBySsh
Like the top-level deployBySsh, this builds the document set and copies it to a remote machine via secure shell.
deployDocByRsync
Like the top-level deployByRsync, this builds the document set and copies it to a remote machine via an rsync command.

3 Integrating CoWeM Content into an LMS

3.1 Linking to CoWeM Content

One of the easiest ways to integrate CoWeM content into an LMS is to simply link to your CoWeM-generated website from your LMS’s. For example, Blackboard and Canvas allow you to put links to external URLs i a course’s navigation panel. In my own courses, I will typically add navigation links to

replacing any similarly-named entries already in the LMS navigation panel.

3.2 LMS Modules and the CoWeM Outline

Both Blackboard and Canvas encourage organizing content into modules. These LMS modules cna display information from the CoWeM outline page via an <iframe> element.

  1. Add the LMS format to the course outline document set.
  2. In the LMS, add modules pages for module overviews (if provided in the outline) and activities, using HTML code similar to this:
    <iframe src="URL-for-course/Directory/outline/outline_LMS.html?reveal=overview1" width="600" height="400"></iframe>
    

    The ?reveal= parameter determines what will be displayed.

    • Use “overview” for the module overview section (if present in the outline) and ’activities" for the activities section.
    • Follow that with the module number $k$, $k = 1, 2, \ldots$.

3.3 Importing a SCORM package

  1. Use the scorm build target, as described above, to produce a package stored in build/packages/scorm.zip

  2. Enter your LMS. Follow its procedure for importing a SCORM package. Blackboard course. Select (or create) a content area, such as the “Outline” area, and enter that area.

  3. from the “BuildContent” menu, select “Content package (SCORM)” and follow the instructions to upload your newly generated scorm.zip file.

  4. There is no “grading” associated with these packages. So choose the following settings in Blackboard (and similar ones for Canvas):

    • Make SCORM Available; yes
    • Number of Attempts: Allow unlimited attempts
    • Track Number of Views: whatever you like
    • Grade SCORM: No Grading
    • Grade SCOS: No