A phing task for generating output by using Smarty.
This is based on the TexenTask from Apache's Velocity engine. This class was originally proted in order to provide a template compiling system for Torque.
TODO: - Add Path / useClasspath support?
| author |
Hans Lellelid hans@xmpl.org (SmartyTask) |
|---|---|
| author |
Jason van Zyl jvanzyl@apache.org (TexenTask) |
| author |
Robert Burrell Donkin robertdonkin@mac.com |
| version |
$Id: 37522f25dbc54322646f80bb2dd2048d556c3276 $ |
| package |
phing.tasks.ext |
init()
Should throw a BuildException if something goes wrong with the build
This is abstract here, but may not be overloaded by subclasses.
| throws |
|---|
setControlTemplate(string $controlTemplate) : void
string
getControlTemplate() : string
string
setTemplatePath($templatePath) : void
| throws | |
|---|---|
getTemplatePath() : string
string
setOutputDirectory(\PhingFile $outputDirectory) : void
getOutputDirectory() : string
string
setOutputFile($outputFile) : void
getOutputFile() : string
string
setCompilePath(string $compilePath)
string
getCompilePath() : string
string
setForceCompile(boolean $force) : void
boolean
getForceCompile() : boolean
boolean
setConfigPath(string $configPath) : void
string
getConfigPath() : string
string
setLeftDelimiter(string $delim) : void
string
getLeftDelimiter() : string
string
setRightDelimiter(string $delim) : void
string
getRightDelimiter() : string
string
setContextProperties(string $file) : void
string
getContextProperties() : \Properties
initControlContext() : \Smarty
| throws |
the execute method will catch
and rethrow as a |
|---|
\Smartyinitialized (cleared) Smarty context.
main()
Should throw a BuildException if someting goes wrong with the build
This is abstract here. Must be overloaded by real tasks.
populateInitialContext(\Smarty $context) : void
TexenTask places Date().toString() into the
context as $now. Subclasses who want to vary the
objects in the context should override this method.
$generator is not put into the context in this
method.
| throws |
Error while populating context. The {@link execute()} method will catch and rethrow as a
|
|---|
\Smarty
cleanup() : void
| throws |
Problem cleaning up. |
|---|
setOwningTarget(\Target $target)
getOwningTarget() : \Target
getTaskName() : string
stringName of this task
setTaskName(string $name) : string
string
stringA string representing the name of this task for log
getTaskType() : string
stringThe type of this task (XML Tag)
setTaskType($name)
getRegisterSlot(string $slotName)
string
log(string $msg, integer $level = \Project::MSG_INFO)
stringThe message to be logged.
integerThe message's priority at this message should have
setDescription(string $desc)
stringThe text describing the task
getDescription() : string
stringThe text description of the task
getLocation() : \Location
setLocation(\Location $location)
getRuntimeConfigurableWrapper() : \RuntimeConfigurable
setRuntimeConfigurableWrapper(\RuntimeConfigurable $wrapper)
maybeConfigure()
perform()
setProject(\Project $project)
getProject() : \Project
context : \Smarty
| var |
|---|
\Smarty
properties : array
| var |
|---|
array
controlTemplate : string
It may or may not invoke the services of worker templates.
| var |
|---|
string
templatePath : string
| var |
|---|
string
outputDirectory : string
| var |
|---|
string
outputFile : string
| var |
|---|
string
contextProperties : array
These values are not critical, like the template path or output path, but allow a convenient way to set a value that may be specific to a particular generation task.
<
p>
For example, if you are generating scripts to allow
user to automatically create a database, then
you might want the $databaseName
to be placed
in the initial context so that it is available
in a script that might look something like the
following:
#!bin/sh echo y | mysqladmin create $databaseName
The value of $databaseName isn't critical to
output, and you obviously don't want to change
the ant task to simply take a database name.
So initial context values can be set with
properties file.
| var |
|---|
array
compilePath : string
By default it will try ./templates_c, but you may wish to override this.
| var |
|---|
string
forceCompile : boolean
Smarty does check file modification time, but you can set this to be sure that the template will be compiled (of course it will be slower if you do).
| var |
|---|
boolean
configPath : string
This tells Smarty where to look for the config files.
| var |
|---|
string
leftDelimiter : string
| var |
|---|
string
rightDelimiter : string
| var |
|---|
string
description : string
| var |
|---|
string
taskType : string
| var |
|---|
string
taskName : string
| var |
|---|
string
project : \Project