tasks/ext/CapsuleTask.php

Show: inherited
Table of Contents

\AssignedVar

Package: phing\tasks\ext

An "inner" class for holding assigned var values.

May be need to expand beyond name/value in the future.

Properties

Propertyprivate  $name= ''
Details
Type
n/a
Propertyprivate  $value= ''
Details
Type
n/a

Methods

methodpublicgetName( ) : void

methodpublicgetValue( ) : void

methodpublicsetName(  $v ) : void

Parameters
Name Type Description
$v
methodpublicsetValue(  $v ) : void

Parameters
Name Type Description
$v

\CapsuleTask

Package: phing\tasks\ext

A phing task for generating output by using Capsule.

This is based on the interface to TexenTask from Apache's Velocity engine.

Parent(s)
\Task < \ProjectComponent
Author
Hans Lellelid  
Version
$Id: CapsuleTask.php 843 2010-09-02 14:39:13Z mrook $  

Properties

Propertyprotectedarray  $assignedVars= 'array()'

Any vars assigned via the build file.

AssignedVar[]
Default valuearray()Details
Type
array
Propertyprotected\Capsule  $context= ''

Capsule "template" engine.

Details
Type
\Capsule
Propertyprotectedarray  $contextProperties= ''

<p> These are properties that are fed into the initial context from a properties file. 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.

Details
Type
array
Propertyprotectedstring  $controlTemplate= ''

This is the control template that governs the output.

It may or may not invoke the services of worker templates.

Details
Type
string
Propertyprotectedstring  $outputDirectory= ''

This is where texen will place all the output that is a product of the generation process.

Details
Type
string
Propertyprotectedstring  $outputFile= ''

This is the file where the generated text will be placed.

Details
Type
string
Propertyprotectedstring  $templatePath= ''

This is where Velocity will look for templates using the file template loader.

Details
Type
string

Methods

methodprotectedcleanup( ) : void

A hook method called at the end of {@link #execute()} which can be overridden to perform any necessary cleanup activities (such as the release of database connections, etc.). By default, does nothing.

Throws
Exception Description
\Exception Problem cleaning up.
methodpubliccreateAssign( ) : void

Creates an "AssignedVar" class.

methodpublicgetContextProperties( ) : \Properties

Get the context properties that will be fed into the initial context be the generating process starts.

Returns
Type Description
\Properties
methodpublicgetControlTemplate( ) : string

Get the control template for the generating process.

Returns
Type Description
string
methodpublicgetDescription( ) : void

methodpublicgetLocation( ) : void

methodpublicgetOutputDirectory( ) : string

Get the output directory.

Returns
Type Description
string
methodpublicgetOutputFile( ) : string

Get the output file for the generation process.

Returns
Type Description
string
methodpublicgetOwningTarget( ) : void

methodpublicgetProject( ) : void

methodprotectedgetRegisterSlot( ) : void

methodpublicgetRuntimeConfigurableWrapper( ) : void

methodpublicgetTaskName( ) : void

methodpublicgetTaskType( ) : void

methodpublicgetTemplatePath( ) : string

Get the path where Velocity will look for templates using the file template loader.

Returns
Type Description
string
methodpublicinit( ) : void

methodpublicinitControlContext( ) : \Smarty

Creates a Smarty object.

Returns
Type Description
\Smarty initialized (cleared) Smarty context.
Throws
Exception Description
\Exception the execute method will catch and rethrow as a BuildException
methodpubliclog( ) : void

methodpublicmain( ) : void

Execute the input script with Velocity

Throws
Exception Description
\BuildException BuildExceptions are thrown when required attributes are missing. Exceptions thrown by Velocity are rethrown as BuildExceptions.
methodpublicmaybeConfigure( ) : void

methodpublicperform( ) : void

methodprotectedpopulateInitialContext( \Capsule $context ) : void

Place useful objects into the initial context.

Parameters
Name Type Description
$context \Capsule

The context to populate, as retrieved from {@link #initControlContext()}.

Throws
Exception Description
\Exception Error while populating context. The {@link #main()} method will catch and rethrow as a BuildException.
methodpublicsetContextProperties( string $file ) : void

Set the context properties that will be fed into the initial context be the generating process starts.

Parameters
Name Type Description
$file string
methodpublicsetControlTemplate( string $controlTemplate ) : void

[REQUIRED] Set the control template for the generating process.

Parameters
Name Type Description
$controlTemplate string
methodpublicsetDescription( ) : void

methodpublicsetLocation( ) : void

methodpublicsetOutputDirectory( \PhingFile $outputDirectory ) : void

[REQUIRED] Set the output directory. It will be created if it doesn't exist.

Parameters
Name Type Description
$outputDirectory \PhingFile
Throws
Exception Description
\Exception
methodpublicsetOutputFile( string $outputFile ) : void

[REQUIRED] Set the output file for the generation process.

Parameters
Name Type Description
$outputFile string

(TODO: change this to File)

methodpublicsetOwningTarget( ) : void

methodpublicsetProject( ) : void

methodpublicsetRuntimeConfigurableWrapper( ) : void

methodpublicsetTaskName( ) : void

methodpublicsetTaskType( ) : void

methodpublicsetTemplatePath(  $templatePath ) : void

[REQUIRED] Set the path where Velocity will look for templates using the file template loader.

Parameters
Name Type Description
$templatePath
Throws
Exception Description
\Exception
Documentation was generated by DocBlox 0.17.1.