A-A-P Script

The purpose of the A-A-P script is to orchestrate building the web pages using asciidoc(1) and publishing (uploading) the web pages using FTP.

The main.aap A-A-P script contains recipes to build the HTML web pages (by running asciidoc(1)) and to publish the web pages (upload to host website using FTP).

The spell checking are archiving recipes can be run if you have the aspell(1) spell checker and tar(1) archive programs installed.

Executing the A-A-P Recipe Executive

The setup wizard installs program icons to execute the main.aap build and publish recipes.

These program icons run A-A-P by executing the aap.bat batch file:

.\bin\python\python.exe ./bin/aap/Exec/aap.py %1 %2 %3 %4 %5 %6 %7 %8 %9
pause

Note that the python.exe and aap.py paths are explicit and are relative to the website development directory.

Here is the main.aap script:

# A-A-P file for managing example AsciiDoc generated website.
#
# Works under FreeBSD, Linux, MS Windows.
#
# IMPORTANT: When running in a Microsoft Windows environment this recipe must
# be located in a path with an assigned drive letter (not a UNC path). If
# necessary use Windows Explorer or the NET USE command to map a network drive.

WEB_NAME = asciidoc-example
VERS = 0.1

# FTP upload destination.
# Edit the following line to match your FTP account login, password,
# host.name and root/upload/directory.
FTP_ROOT = ftp://login:password@host.name//root/upload/directory

# List of web pages.
ROOT =
    index
    webpages
    aap-script
    execution-environment
    installation-wizard
    cdrom-creation
    links
    feedback

ASCIIDOC_FILES = $*(ROOT).txt
HTML_FILES = $*(ROOT).html
WEB_FILES =
    $HTML_FILES
    `glob("*.css")`
    `glob("*.png")`

# Client applications.
@if OSTYPE == 'posix':
    ASCIIDOC = `program_path("asciidoc")`
    TAR = `program_path("tar")`
    ASPELL = `program_path("aspell")`
@elif OSTYPE == 'mswin':
    ASCIIDOC = .\bin\python\python.exe .\bin\asciidoc\asciidoc.py
    TAR =
    ASPELL =
@else:
    :print ERROR: Unsupported operating system $OSTYPE
    :exit

# AsciiDoc options to generate web pages.
ASCIIDOC_OPTS = -b css -f asciidoc.conf -g revision=$VERS

# File translation rules.
:rule %.html : %.txt asciidoc.conf
    @if target == 'index.html':
        # Index has description and keywords meta tags.
        ASCIIDOC_OPTS += -g index-only
    :sys $ASCIIDOC $ASCIIDOC_OPTS $(source[0])

all: build

build: $HTML_FILES

publish: build
    # Upload modified files to public web.
    :attr {publish = $FTP_ROOT/%basename%} $WEB_FILES
    :publish $WEB_FILES

clean:
    :del {f} $HTML_FILES
    :del {f} *.bak          # Remove aspell backups.

spell: $ASCIIDOC_FILES
    # Interactively spell check all files.
    @if _no.ASPELL:
        @for s in source_list:
            :sys {i} $ASPELL check -p $(WEB_NAME)-website.dict $s
    @else:
        :print WARNING: aspell(1) unavailable, skipping spell checking

archive:
    # Make tarball of web project directory in the ~/webs/archive.
    @if _no.TAR:
        ARCHIVE = $(WEB_NAME)-website-$(VERS)
        :sys cd .. && ln -s $WEB_NAME $(ARCHIVE)
        :sys cd .. && tar -czhf ~/webs/archive/$(ARCHIVE).tar.gz \
            --exclude bin $(ARCHIVE)/*
        :sys cd .. && rm -f $(ARCHIVE)
    @else:
        :print WARNING: tar(1) unavailable, skipping archive creation