Commons component plugin - Macros - Substitute dates and keys¶
Contents :
- # SUBSTITUTE DATES AND KEYS IN {files} USING {key_value_list} AS {processed_files}
- # SUBSTITUTE DATES AND KEYS IN {files} FOR FILES WHOSE NAMES MATCHING {regex} USING {key_value_list} AS {processed_files}
- # SUBSTITUTE DATES AND KEYS IN {files} FOR FILES WHOSE NAMES NOT MATCHING {regex} USING {key_value_list} AS {processed_files}
# SUBSTITUTE DATES AND KEYS IN {files} USING {key_value_list} AS {processed_files}¶
What ?
This macro allows to replace dates and keys by values in a bundle of files. For more information about the formulas to use in order to replace dates, please check this page.
Underlying instruction :
LOAD {key_value_list} AS placeholder{%%rand2}.file
CONVERT placeholder{%%rand2}.file TO properties(structured) AS placeholder{%%rand3}.properties
LOAD {files} AS __bundle{%%rand1}
CONVERT __bundle{%%rand1} TO file(param.relativedate) USING placeholder{%%rand3}.properties AS __bundle{%%rand2}
CONVERT __bundle{%%rand2} TO file(param) USING placeholder{%%rand3}.properties AS {processed_files}
> Input :
{files}
: The bundle of files where you want to apply the substitution.{key_value_list}
: It can either be a path to a properties file or an inline command with keys and values.
Example of inline command : $(key1=value1 \n key2=value2).
> Output :
{processed_files}
: The bundle of filtered files that have been processed.
Examples :
# SUBSTITUTE DATES AND KEYS IN resources_folder USING resources_folder/file.properties AS result_bundle |
Or
# SUBSTITUTE DATES AND KEYS IN resources_folder USING $(oneKey=oneValue \n anotherKey=anotherValue) AS result_bundle |
For more information please check the following sections : substitute dates macro and substitute keys macro.
# SUBSTITUTE DATES AND KEYS IN {files} FOR FILES WHOSE NAMES MATCHING {regex} USING {key_value_list} AS {processed_files}¶
What ?
This macro allows to replace dates and keys by values in a bundle of files whose names match a selected regular expression. For more information about the formulas to use in order to replace dates, please check this page.
Underlying instruction :
LOAD {key_value_list} AS placeholder{%%rand2}.file
CONVERT placeholder{%%rand2}.file TO properties(structured) AS placeholder{%%rand3}.properties
LOAD {files} AS __bundle{%%rand1}
CONVERT __bundle{%%rand1} TO file(param.relativedate) USING placeholder{%%rand3}.properties,$(squashtest.ta.param.include:{regex}) AS __bundle{%%rand2}
CONVERT __bundle{%%rand2} TO file(param) USING placeholder{%%rand3}.properties,$(squashtest.ta.param.include:{regex}) AS {processed_files}
> Input :
{files}
: The bundle of files where you want to apply the substitution.{regex}
: The regular expression used to filter the files in the bundle.{key_value_list}
: It can either be a path to a properties file or an inline command with keys and values.
Example of inline command : $(key1=value1 \n key2=value2).
> Output :
{processed_files}
: The bundle of filtered files that have been processed.
Examples :
# SUBSTITUTE DATES AND KEYS IN resources_folder FOR FILES WHOSE NAMES MATCHING .xml USING resources_folder/file.properties AS result_bundle |
Or
# SUBSTITUTE DATES AND KEYS IN resources_folder FOR FILES WHOSE NAMES MATCHING .xml USING $(oneKey=oneValue \n anotherKey=anotherValue) AS result_bundle |
For more information please check the following sections : substitute dates macro and substitute keys macro for files whose names are matching the given regular expression.
# SUBSTITUTE DATES AND KEYS IN {files} FOR FILES WHOSE NAMES NOT MATCHING {regex} USING {key_value_list} AS {processed_files}¶
What ?
This macro allows to replace dates and keys by values in a bundle of files whose names are not matching a selected regular expression. For more information about the formulas to use in order to replace dates, please check this page.
Underlying instruction :
LOAD {key_value_list} AS placeholder{%%rand2}.file
CONVERT placeholder{%%rand2}.file TO properties(structured) AS placeholder{%%rand3}.properties
LOAD {files} AS __bundle{%%rand1}
CONVERT __bundle{%%rand1} TO file(param.relativedate) USING placeholder{%%rand3}.properties,$(squashtest.ta.param.exclude:{regex}) AS __bundle{%%rand2}
CONVERT __bundle{%%rand2} TO file(param) USING placeholder{%%rand3}.properties,$(squashtest.ta.param.exclude:{regex}) AS {processed_files}
> Input :
{files}
: The bundle of files where you want to apply the substitution.{regex}
: The regular expression used to filter the files in the bundle.{key_value_list}
: It can either be a path to a properties file or an inline command with keys and values.
Example of inline command : $(key1=value1 \n key2=value2).
> Output :
{processed_files}
: The bundle of filtered files that have been processed.
Examples :
# SUBSTITUTE DATES AND KEYS IN resources_folder FOR FILES WHOSE NAMES NOT MATCHING .txt USING resources_folder/file.properties AS result_bundle |
Or
# SUBSTITUTE DATES AND KEYS IN resources_folder FOR FILES WHOSE NAMES NOT MATCHING .txt USING $(oneKey=oneValue \n anotherKey=anotherValue) AS result_bundle |
For more information please check the following sections : substitute dates macro and substitute keys macro for files whose names are not matching the given regular expression.