environment-macros 1.1

Summary

JPlate environment macros

Import Summary

Import Definitions
FileDescriptionComment
${jplate.LOCALE_HOME}/environment-macros-messages.xmlImport local specific messages. Import locale specific messages.
common.xmlContains all JPlate common work. Import our macros...
utility-macros.xmlContains all JPlate utility macros. Import our macros...

Macro Definition Summary

Macro Definitions
NameDescriptionURI
assert-dir-existsDetermines if @{dir} exists and if not, fails with @{error-msg}.http://jplate.sourceforge.net/environment
assert-file-existsDetermines if @{file} exists and if not, fails with @{error-msg}.http://jplate.sourceforge.net/environment
auto-propertyDefine setting properties using either environment variables or default values. The property entitled @{property} will not be re-set if it is currently defined (set).http://jplate.sourceforge.net/environment
basenameSame as Ant's stock basename task - however, this allows the property to be reset.http://jplate.sourceforge.net/environment
compute-branchCompute the branch based upon a root dir, @{root}, and full path, @{full-path}. The branch represents the full path minus the root dir. Please note: if @{root} does not exist in @{full-path}, @{property} will be set with an empty value.http://jplate.sourceforge.net/environment
conditional-set-propertyThis will conditionally set a property whether. If @{property} is set it will use @{set} otherwise @{unset}.http://jplate.sourceforge.net/environment
console-inputWill prompt for input if property not set (or if the @{always} attribute is true). If @{always} is true and @{property} is set and @{default} is empty, the value of @{property} becomes the @{default} value. If the attribute @{required} is true and no value is set for @{property}, this macro will cause a fail to be invoked. Please note that if @{default} is set and input is prompted but the user does not enter anything, the value of @{default} will be used to set the property!http://jplate.sourceforge.net/environment
copyThis will copy from @{src} to @{dest-dir}.http://jplate.sourceforge.net/environment
copy-dirThis will copy the contents of a directory from @{src-dir} to @{dest-dir}. Please note: if @{dest-dir} does not exist, it will be created.http://jplate.sourceforge.net/environment
copy-ref-idThis will copy from @{src-ref-id} to @{dest-dir}. Please note: if @{dest-dir} does not exist, it will be created.http://jplate.sourceforge.net/environment
equality-set-propertyThis will set the value of the property entitled @{name} based upon a comparison to the value contained by the property ${property}. If @{property} equals @{value}, @{name} will be set to @{equal}, otherwise it will be set to @{unequal}.http://jplate.sourceforge.net/environment
execute-java-appExecute a java class whose class name is @{class-property}. If this property is not set, the user will be prompted for the class name.http://jplate.sourceforge.net/environment
forThis implements a for loop with starting and ending values for the loop.http://jplate.sourceforge.net/environment
if-dir-existsDetermines if @{dir} exists and will act accordingly.http://jplate.sourceforge.net/environment
if-file-existsDetermines if @{file} exists and will act accordingly.http://jplate.sourceforge.net/environment
load-fileThis will load a file into a property. If @{property} was already set, it will be overridden.http://jplate.sourceforge.net/environment
print-ref-idPrint the contents of @{ref-id} to the console.http://jplate.sourceforge.net/environment
set-propertyThis will set a property whether its set or not.http://jplate.sourceforge.net/environment

Details

Macro Definition Details

assert-dir-exists

Determines if @{dir} exists and if not, fails with @{error-msg}.

Attribute Definitions
NameDescriptionDefault
dirThe name of the directory that should exist.Not Defined
error-msgThe message to display if @{dir} does not exist.${jplate-environment.assert-dir-exists.error-msg}
descriptionInformation about this macro call.Not Defined

assert-file-exists

Determines if @{file} exists and if not, fails with @{error-msg}.

Attribute Definitions
NameDescriptionDefault
fileThe name of the file that should exist.Not Defined
error-msgThe message to display if @{file} does not exist.${jplate-environment.assert-file-exists.error-msg}
descriptionInformation about this macro call.Not Defined

auto-property

Define setting properties using either environment variables or default values. The property entitled @{property} will not be re-set if it is currently defined (set).

Attribute Definitions
NameDescriptionDefault
propertyThe name of the property to set.Not Defined
defaultThe default value to use if the property named, @{property}, is not set.Not Defined
descriptionInformation about this macro call.Not Defined

basename

Same as Ant's stock basename task - however, this allows the property to be reset.

Attribute Definitions
NameDescriptionDefault
fileThe path to take the basename of.Not Defined
propertyThe name of the property to set.Not Defined
suffixThe suffix to remove from the resulting basename (specified either with or without the .).Not Defined
prependInformation to prepend to property's value.Not Defined
appendInformation to append to property's value.Not Defined
descriptionInformation about this macro call.Not Defined

compute-branch

Compute the branch based upon a root dir, @{root}, and full path, @{full-path}. The branch represents the full path minus the root dir. Please note: if @{root} does not exist in @{full-path}, @{property} will be set with an empty value.

Attribute Definitions
NameDescriptionDefault
rootThe root of the path defined in @{full-path}.Not Defined
full-pathThe absolute path for which @{root} is the root of the path and the branch computed is this path minus the root.Not Defined
propertyThe property to set with the branch.Not Defined
descriptionInformation about this macro call.Not Defined

conditional-set-property

This will conditionally set a property whether. If @{property} is set it will use @{set} otherwise @{unset}.

Attribute Definitions
NameDescriptionDefault
nameThe name of the property to set.Not Defined
propertyThe name of the property to examine to see if set.Not Defined
setThe value to use if @{property} is set.Not Defined
unsetThe value to use if @{property} is not set.Not Defined
is-warnableA flag, if true states a warning should be displayed - anything else no warning is outputted.true
warning-msgif set to anything and the property named, name, is set, will echo the value of this param. Please note, the property will still be set.${jplate-environment.conditional-set-property.warning-msg}
descriptionInformation about this macro call.Not Defined

console-input

Will prompt for input if property not set (or if the @{always} attribute is true). If @{always} is true and @{property} is set and @{default} is empty, the value of @{property} becomes the @{default} value. If the attribute @{required} is true and no value is set for @{property}, this macro will cause a fail to be invoked. Please note that if @{default} is set and input is prompted but the user does not enter anything, the value of @{default} will be used to set the property!

Attribute Definitions
NameDescriptionDefault
promptWhen requesting input, the message to display.Not Defined
propertyThe property to set.Not Defined
defaultThe default value to use if upon input, nothing entered.Not Defined
alwaysIf true will prompt for input regardless if property has been set.false
requiredIf true, after input the property must be set or failure will occur.true
error-msgIf @{property} is required and no value set, the error message to display.${jplate-environment.console-input.error-msg}
descriptionInformation about this macro call.Not Defined

copy

This will copy from @{src} to @{dest-dir}.

Attribute Definitions
NameDescriptionDefault
srcThe source to copy from - be it a file, dir or ref id.Not Defined
dest-dirThe directory to copy to.Not Defined
error-msgError message to display if @{src} does not exist or is not a file, dir or ref id.${jplate-environment.copy.error-msg}
descriptionInformation about this macro call.Not Defined

copy-dir

This will copy the contents of a directory from @{src-dir} to @{dest-dir}. Please note: if @{dest-dir} does not exist, it will be created.

Attribute Definitions
NameDescriptionDefault
src-dirThe source dir copy from.Not Defined
dest-dirThe directory to copy to.Not Defined
error-msgError message to display if @{src-dir} does not exist.${jplate-environment.copy-dir-set-property.error-msg}
descriptionInformation about this macro call.Not Defined

copy-ref-id

This will copy from @{src-ref-id} to @{dest-dir}. Please note: if @{dest-dir} does not exist, it will be created.

Attribute Definitions
NameDescriptionDefault
src-ref-idThe source to copy from - be it a file, dir or ref id.Not Defined
dest-dirThe directory to copy to.Not Defined
error-msgError message to display if @{src-ref-id} is not a ref id.${jplate-environment.copy-ref-id.error-msg}
descriptionInformation about this macro call.Not Defined

equality-set-property

This will set the value of the property entitled @{name} based upon a comparison to the value contained by the property ${property}. If @{property} equals @{value}, @{name} will be set to @{equal}, otherwise it will be set to @{unequal}.

Attribute Definitions
NameDescriptionDefault
nameThe name of the property to set.Not Defined
propertyThe name of the property to examine for equality/inequality.Not Defined
valueThe value to compare against @{property}.Not Defined
equalthe value to use if @{property} equals @{value}.Not Defined
unequalThe value to use if @{property} not equal to @{value}.Not Defined
is-warnableA flag, if true states a warning should be displayed - anything else no warning is outputted.true
warning-msgThe message to emit if @{name} is currently set.${jplate-environment.equality-set-property.warning-msg}
descriptionInformation about this macro call.Not Defined

execute-java-app

Execute a java class whose class name is @{class-property}. If this property is not set, the user will be prompted for the class name.

Attribute Definitions
NameDescriptionDefault
class-propertyThe name of the property who has the fully qualified class name to execute.Not Defined
class-path-refThe class path for executing the java app.Not Defined
args-propertyThe name of the property who has the arguments to pass to the class.Not Defined
class-prompt-msgThe message to use if the property defined by class-property name has not been set.${jplate-environment.execute-java-app.class-prompt-msg}
args-prompt-msgThe message to use if the property defined by args-property name has not been set.${jplate-environment.execute-java-app.args-prompt-msg}
descriptionInformation about this macro call.Not Defined

for

This implements a for loop with starting and ending values for the loop.

Attribute Definitions
NameDescriptionDefault
propertyThe name of the property that will contain the current value of the loop.Not Defined
startThe start value of the loop.1
endThe end value of the loopNot Defined
incThe value to increment (or decrement) when looping.1
descriptionInformation about this macro call.Not Defined

if-dir-exists

Determines if @{dir} exists and will act accordingly.

Attribute Definitions
NameDescriptionDefault
dirThe name of the directory to check for existance.Not Defined
descriptionInformation about this macro call.Not Defined

if-file-exists

Determines if @{file} exists and will act accordingly.

Attribute Definitions
NameDescriptionDefault
fileThe name of the file that should exist.Not Defined
descriptionInformation about this macro call.Not Defined

load-file

This will load a file into a property. If @{property} was already set, it will be overridden.

Attribute Definitions
NameDescriptionDefault
src-fileThe location of the file to load and store in @{property}.Not Defined
propertyThe property to hold @{src-file}.Not Defined
descriptionInformation about this macro call.Not Defined

print-ref-id

Print the contents of @{ref-id} to the console.

Attribute Definitions
NameDescriptionDefault
ref-idThe name of the ref id to display.Not Defined
indentString to use for indenting the contents of refid.Not Defined
error-msgWhen printing @{ref-id}, if a directory does not exist and ant raises an error, this value will be displayed instead.${jplate-environment.print-ref-id.error-msg}
descriptionInformation about this macro call.Not Defined

set-property

This will set a property whether its set or not.

Attribute Definitions
NameDescriptionDefault
propertyThe name of the property to set.Not Defined
valueThe value to set the property to set.Not Defined
is-warnableA flag, if true states a warning should be displayed - anything else no warning is outputted.true
warning-msgif set to anything and the property named, property, is set, will echo the value of this param. Please note, the property will still be set.${jplate-environment.set-property.warning-msg}
descriptionInformation about this macro call.Not Defined



PrevUpNext