Re: Intercepting #set
Thanks, Nathan, yes, thats useful, this way I get all variables used, at least. Unfortunately I don't find a way to intercept something like #set($var="whatever"). So I assume I will have to parse the vm file manually searching for #set occurrences? Kind regards Paul Wellner Bou On Thu, Nov 5, 2015 at 8:57 PM, Nathan Bubna wrote: > You could configure a NullSetEventHandler to catch when the RHS is null. > But i'm afraid the #set directive is deeply embedded, without a lot of > hooks, much like #if. But perhaps one of the other available EventHandler > interfaces can help? > > > https://velocity.apache.org/engine/releases/velocity-1.7/apidocs/org/apache/velocity/app/event/EventHandler.html > > http://velocity.apache.org/engine/devel/developer-guide.html#Configuring_Event_Handlers > > On Thu, Nov 5, 2015 at 2:27 AM, Paul Wellner Bou > wrote: > > > Hello, > > > > i am trying to write something analyzing our velocity file hell > > automatically, showing direct (via #parse) or indirect (via declared > > variables, #set) between vm files. > > > > I found a way to intercept the #parse directive ( > > https://gist.github.com/paulwellnerbou/b0e53e7a045e8e90a840). Is this > > possible with the #set directive as well? > > > > Thank you and best regards > > Paul Wellner Bou > > >
Re: Intercepting #set
That's an option. Or, since Velocity is open source, you could always hack on it. Whichever works best for you. :) Best luck with it! On Fri, Nov 6, 2015 at 4:16 AM, Paul Wellner Bou wrote: > Thanks, Nathan, > > yes, thats useful, this way I get all variables used, at least. > Unfortunately I don't find a way to intercept something like > #set($var="whatever"). So I assume I will have to parse the vm file > manually searching for #set occurrences? > > Kind regards > Paul Wellner Bou > > On Thu, Nov 5, 2015 at 8:57 PM, Nathan Bubna wrote: > > > You could configure a NullSetEventHandler to catch when the RHS is null. > > But i'm afraid the #set directive is deeply embedded, without a lot of > > hooks, much like #if. But perhaps one of the other available > EventHandler > > interfaces can help? > > > > > > > https://velocity.apache.org/engine/releases/velocity-1.7/apidocs/org/apache/velocity/app/event/EventHandler.html > > > > > http://velocity.apache.org/engine/devel/developer-guide.html#Configuring_Event_Handlers > > > > On Thu, Nov 5, 2015 at 2:27 AM, Paul Wellner Bou > > wrote: > > > > > Hello, > > > > > > i am trying to write something analyzing our velocity file hell > > > automatically, showing direct (via #parse) or indirect (via declared > > > variables, #set) between vm files. > > > > > > I found a way to intercept the #parse directive ( > > > https://gist.github.com/paulwellnerbou/b0e53e7a045e8e90a840). Is this > > > possible with the #set directive as well? > > > > > > Thank you and best regards > > > Paul Wellner Bou > > > > > >
Re: Intercepting #set
Thanks, I will try to Powermock ASTSetDirective's constructor. Although I don't like powermocking things, so the nicest way might be to fork velocity for this purpose. Or would this be a possible feature for future versions? Thanks anyway and regards Paul. On Fri, Nov 6, 2015 at 6:43 PM Nathan Bubna wrote: > That's an option. Or, since Velocity is open source, you could always hack > on it. Whichever works best for you. :) > > Best luck with it! > > On Fri, Nov 6, 2015 at 4:16 AM, Paul Wellner Bou > wrote: > > > Thanks, Nathan, > > > > yes, thats useful, this way I get all variables used, at least. > > Unfortunately I don't find a way to intercept something like > > #set($var="whatever"). So I assume I will have to parse the vm file > > manually searching for #set occurrences? > > > > Kind regards > > Paul Wellner Bou > > > > On Thu, Nov 5, 2015 at 8:57 PM, Nathan Bubna wrote: > > > > > You could configure a NullSetEventHandler to catch when the RHS is > null. > > > But i'm afraid the #set directive is deeply embedded, without a lot of > > > hooks, much like #if. But perhaps one of the other available > > EventHandler > > > interfaces can help? > > > > > > > > > > > > https://velocity.apache.org/engine/releases/velocity-1.7/apidocs/org/apache/velocity/app/event/EventHandler.html > > > > > > > > > http://velocity.apache.org/engine/devel/developer-guide.html#Configuring_Event_Handlers > > > > > > On Thu, Nov 5, 2015 at 2:27 AM, Paul Wellner Bou > > > wrote: > > > > > > > Hello, > > > > > > > > i am trying to write something analyzing our velocity file hell > > > > automatically, showing direct (via #parse) or indirect (via declared > > > > variables, #set) between vm files. > > > > > > > > I found a way to intercept the #parse directive ( > > > > https://gist.github.com/paulwellnerbou/b0e53e7a045e8e90a840). Is > this > > > > possible with the #set directive as well? > > > > > > > > Thank you and best regards > > > > Paul Wellner Bou > > > > > > > > > >