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: a9304498ec49251e3b9a2356a93da40f67b3db12 $ |
package |
phing.tasks.ext |
cleanup() : void
throws |
Problem cleaning up. |
---|---|
getCompilePath() : string
string
getConfigPath() : string
string
getContextProperties() : \Properties
getControlTemplate() : string
string
getDescription() : string
string
The text description of the task
getForceCompile() : boolean
boolean
getLeftDelimiter() : string
string
getLocation() : \Location
getOutputDirectory() : string
string
getOutputFile() : string
string
getOwningTarget() : \Target
getProject() : \Project
getRegisterSlot(string $slotName) : \RegisterSlot
getRightDelimiter() : string
string
getRuntimeConfigurableWrapper() : \RuntimeConfigurable
getTaskName() : string
string
Name of this task
getTaskType() : string
string
The type of this task (XML Tag)
getTemplatePath() : string
string
init()
Should throw a BuildException if something goes wrong with the build
This is abstract here, but may not be overloaded by subclasses.
throws | |
---|---|
initControlContext() : \Smarty
throws |
the execute method will catch
|
---|---|
\Smarty
initialized (cleared) Smarty context.
log(string $msg, integer $level = \Project::MSG_INFO) : void
string
The message to be logged.
integer
The message's priority at this message should have
main()
Should throw a BuildException if someting goes wrong with the build
This is abstract here. Must be overloaded by real tasks.
maybeConfigure()
perform()
throws | |
---|---|
setCompilePath(string $compilePath)
string
setConfigPath(string $configPath) : void
string
setContextProperties(string $file) : void
throws |
---|
string
setControlTemplate(string $controlTemplate) : void
string
setDescription(string $desc)
string
The text describing the task
setForceCompile(boolean $force) : void
boolean
setLeftDelimiter(string $delim) : void
string
setLocation(\Location $location)
setOutputDirectory(\PhingFile $outputDirectory) : void
setOutputFile( $outputFile) : void
setOwningTarget(\Target $target)
setProject(\Project $project) : void
setRightDelimiter(string $delim) : void
string
setRuntimeConfigurableWrapper(\RuntimeConfigurable $wrapper)
setTaskName(string $name) : string
string
string
A string representing the name of this task for log
setTaskType( $name)
setTemplatePath( $templatePath) : void
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.
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:
The value of
#!bin/sh
echo y | mysqladmin create $databaseName
$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