RE: [tigerstripe-dev] Can I run global rules conditionally? |
I think Duncan missed a step out in his explanation… What you would need to do is create a template for each file from
your copy rule, and make a Template rule for each of the files that you change
in this way (instead of one global rule). It effectively would be a template rule with “plain text” in
side. Richard From:
tigerstripe-dev-bounces@xxxxxxxxxxx [mailto:tigerstripe-dev-bounces@xxxxxxxxxxx]
On Behalf Of Zhang, Jin-Zhai (TSG-BAS-China-SH) Hi Richard, Hi Duncan Thanks again for your help. The copy rule trully copies things. If we copy a VM template, the
script in it will not run. The template rule + supressing empty file work in some cases. best regards, Jinzhai From: Zhang, Jin-Zhai (TSG-BAS-China-SH) Hi Richard, Hi Duncan, Thanks for your suggestions! I'll try and back to you. best regards, Jinzhai 张 晋寨 (ZHANG Jinzhai) Next
Generation OSS and Services From: tigerstripe-dev-bounces@xxxxxxxxxxx
[mailto:tigerstripe-dev-bounces@xxxxxxxxxxx] On Behalf Of Duncan Keysell
(dkeysell) There is a workaround to the copy rule limitation: by copying
the contents of the file you were copying to a velocity template and
adding the condition at the top of the template. Then the template
contents will be copied to the output file you specify depending on whether the
condition is satisfied. Duncan From: tigerstripe-dev-bounces@xxxxxxxxxxx
[mailto:tigerstripe-dev-bounces@xxxxxxxxxxx] On Behalf Of Richard Craddock
(rcraddoc) Hi Jinzhai, There is no way to trigger a global rule conditionally at
present. For template rules, you can mimic this behavior: a) Add a
condition at the top of the template prior to generating any output. In this
condition you could for example, check the size of the $sessions collection. b) This
would then create an empty file if the condition is not met, so you can then
clear up empty files in the rule definition using the “Suppress Empty Files”
check box. c) NOTE
: This would potentially overwrite existing files, but I don’t think that is
what you are trying to avoid here. I don’t know of any way of getting round the copy rule
limitation though. Hope this helps, Richard From:
tigerstripe-dev-bounces@xxxxxxxxxxx
[mailto:tigerstripe-dev-bounces@xxxxxxxxxxx] On Behalf Of Zhang,
Jin-Zhai (TSG-BAS-China-SH) Hi team, Would please help me in following question: the question is: can I run global rules conditionally? I'm
working with Tigerstripe workbench 0.5.0.x - Global Rules - File/Directory Copy Rule: For example, , I want to generate web servcies definitions
(XSD and WSDL) from tigerstripe models. Now given a model, IF the model is
relevant with notification, THEN I will copy existing WS-notification XSD/WSDL
files to target folder; ELSE IF the model is not relevant with
notification, THEN nothing will be copied. - Global Rules - Global Template Rule: The case is: I have one VM template in my tigerstripe generator,
when I run the generator agaist a model, the VM should
run only IF the model meets some global condition (e.g. the
model contains at least one SessionFacade). best regards, Jinzhai ZHANG
Jinzhai |