Author: Bram Moolenaar (yes, it's VIMs author)
License: GPL
A-A-P is does everything what make does plus you can use python in it's recipes. Another great thing is that A-A-P uses signatures instead of timestamps to detect changed files.
The examples expect that you are using a UNIX like OS.
I did not invest too much time to write the following recipes, so I'm sure there is much room to improve/enhance them in many ways.
Assuming the following directory structure of the the application "Example":
Example/ (this is the working directory created by MakeAppWorkDir_.py)
Application/
Lib/ (business logic, ...)
Logic/ (presentation logic)
Servlets/ (files delivered by WebKit, a context)
Templates/
To compile new and changed templates living in Templates/ and move them to Servlets/ I use the following recipe:
File main.aap in Example/Application/Servlets/:
TEMPLATES = `glob("../Templates/*.tmpl")` SERVLETS`` `' '.join([os.path.split(tmpl)[1] for tmpl in var2list(aap_sufreplace('.tmpl', '.py', TEMPLATES))])` :rule %.py : ../Templates/%.tmpl :sys cheetah compile $source :move ../Templates/$target . all : $SERVLETS
Since the file is called main.aap, you can compile your templates by simply changing your working directory to Servlets/ and typing "aap" at the command prompt.
First we create a list of source files (TEMPLATES) and a list of target files (SERVLETS) using python commands enclosed with backticks. Since we use the python glob function, we don't have to care about a growing number of template files.
The :rule command teaches A-A-P how to create servlets from cheetah templates. It calls cheetah as an external process, so A-A-P can use its return value to determine the success of the compilation.
File main.aap in Example/Application/Servlets/:
FILES = `glob("Lib/*.py")` `glob("Logic/*.py")` `glob("Servlets/*.py")` compile: :execute Servlets/main.aap dist: compile :attr {publish = scp://user@distserver/path/to/application/%file%} $FILES test: compile :attr {publish = scp://user@testserver/path/to/application/%file%} $FILES
Installing the files on the test server is simply a matter of typing "aap test publish" at the command prompt in the Application/ directory. Modified files will be compiled automatically by executing the A-A-P recipe in Servlets/.
In practice I check more dependencies (for example successful execution of unit test) before the files are copied to a server and I do other things like changing file permissions on the server after the upload.
Quite simple, isn't it?
Its very easy to define dependencies with the make like syntax and python does the rest. A powerful combination in my opinion.
Bram Molenaar wrote on the a-a-p-user mailing list that "A-A-P doesn't stand for something specific".
-- AndiPoisel - 26 Feb 2003