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 |
| version | $Id: 1fe8b2aa2668db628554e59b3099520c0e1c03e4 $ |
| package | phing.tasks.ext |
| copyright | 2001,2002 THYRELL. All rights reserved |
getCompilePath() : string
stringgetConfigPath() : string
stringgetContextProperties() : \Properties
getControlTemplate() : string
stringgetDescription() : string
| inherited_from | \Task::getDescription() |
|---|
stringThe text description of the taskgetForceCompile() : boolean
booleangetLeftDelimiter() : string
stringgetLocation() : \Location
Used by BuildException to give detailed error messages.
| inherited_from | \Task::getLocation() |
|---|
\LocationThe location object describing the position of this
task within the buildfile.getOutputDirectory() : string
stringgetOutputFile() : string
stringgetProject() : \Project
| inherited_from | \ProjectComponent::getProject() |
|---|---|
| inherited_from | \Task::getProject() |
\ProjectReference to current porject objectgetRightDelimiter() : string
stringgetRuntimeConfigurableWrapper() : \RuntimeConfigurable
| inherited_from | \Task::getRuntimeConfigurableWrapper() |
|---|
\RuntimeConfigurableThe wrapper object used by this taskgetTaskName() : string
| inherited_from | \Task::getTaskName() |
|---|
stringName of this taskgetTaskType() : string
| inherited_from | \Task::getTaskType() |
|---|
stringThe type of this task (XML Tag)getTemplatePath() : string
stringinit()
Should throw a BuildException if something goes wrong with the build
This is abstract here, but may not be overloaded by subclasses.
\BuildException |
|---|
initControlContext() : \Smarty
\Exception |
the execute method will catch
and rethrow as a BuildException |
|---|
\Smartyinitialized (cleared) Smarty context.log(string $msg, integer $level)
| see | \BuildEvent |
|---|---|
| see | \BuildListener |
| inherited_from | \Task::log() |
stringThe message to log
integerThe priority of the message
main()
This method may be called more than once, if the task is invoked more than once. For example, if target1 and target2 both depend on target3, then running phing target1 target2 will run all tasks in target3 twice.
Should throw a BuildException if someting goes wrong with the build
This is abstract here. Must be overloaded by real tasks.
\BuildException |
BuildExceptions are thrown when required attributes are missing. Exceptions thrown by Velocity are rethrown as BuildExceptions. |
|---|
maybeConfigure()
| inherited_from | \Task::maybeConfigure() |
|---|
perform()
| inherited_from | \Task::perform() |
|---|
setCompilePath(string $compilePath)
string
setConfigPath(string $configPath) : void
string
setContextProperties(string $file) : void
string
setControlTemplate(string $controlTemplate) : void
string
setDescription(string $desc)
| inherited_from | \Task::setDescription() |
|---|
stringThe text describing the task
setForceCompile(boolean $force) : void
boolean
setLeftDelimiter(string $delim) : void
string
setLocation(\Location $location)
Called by the parser to set location information.
| inherited_from | \Task::setLocation() |
|---|
setOutputDirectory(\PhingFile $outputDirectory) : void
It will be created if it doesn't exist.
\PhingFile
\Exception |
|---|
setOutputFile($outputFile) : void
setOwningTarget(\Target $target)
setProject(\Project $project)
| inherited_from | \ProjectComponent::setProject() |
|---|---|
| inherited_from | \Task::setProject() |
setRightDelimiter(string $delim) : void
string
setRuntimeConfigurableWrapper(\RuntimeConfigurable $wrapper)
| inherited_from | \Task::setRuntimeConfigurableWrapper() |
|---|
setTaskName(string $name) : string
| inherited_from | \Task::setTaskName() |
|---|
string
stringA string representing the name of this task for logsetTaskType(string $name)
Usually this is the name of the XML tag
| inherited_from | \Task::setTaskType() |
|---|
stringThe type of this task (XML Tag)
setTemplatePath($templatePath) : void
cleanup() : void
getRegisterSlot(string $slotName)
| inherited_from | \Task::getRegisterSlot() |
|---|
string
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.\contextThe context to populate, as retrieved from {@link #initControlContext()}.
\Exception |
Error while populating context. The {@link
#execute()} method will catch and rethrow as a
BuildException. |
|---|
$compilePath : string
By default it will try ./templates_c, but you may wish to override this.
$configPath : string
This tells Smarty where to look for the config files.
$context : \Smarty
$contextProperties : array
This is simply a convenient way to set some values that you wish to make available in the context.
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.
$controlTemplate : string
It may or may not invoke the services of worker templates.
$description : string
| inherited_from | \Task::$$description |
|---|
$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).
$leftDelimiter : string
$outputDirectory : string
$outputFile : string
$project : \Project
| inherited_from | \ProjectComponent::$$project |
|---|---|
| inherited_from | \Task::$$project |
$properties : array
$rightDelimiter : string
$taskName : string
| inherited_from | \Task::$$taskName |
|---|
$taskType : string
| inherited_from | \Task::$$taskType |
|---|
$templatePath : string