.lucee extension for templates and components

Hi,
In the new Lucee dialect, components and templates both have the .lucee
extension.
I have some framework code that searches for cfc’s and gets metadata using
getcomponentmetadata(). Will something like this still be possible? In
other words, can we determine programmatically whether a .lucee file is a
component or a template?

Thanks!
Jeroen

I’m familiar with that problem!
I had the same with the detection of script only component with the parser.

I was even considering to have the following rule, Components files need to
start with a Upper case key and regular templates wit a lower case key, but
forcing this to people is a step to far.
But of course nobody is stopping you to do this as a rule, always start
your component with a upper case key (Susi.lucee) and your templates with a
lower case key (susi.lucee).

MichaOn Thu, Apr 16, 2015 at 12:36 AM, Jeroen Knoef <@Jeroen_Knoef> wrote:

Hi,
In the new Lucee dialect, components and templates both have the .lucee
extension.
I have some framework code that searches for cfc’s and gets metadata using
getcomponentmetadata(). Will something like this still be possible? In
other words, can we determine programmatically whether a .lucee file is a
component or a template?

Thanks!
Jeroen


You received this message because you are subscribed to the Google Groups
“Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/435ef0d3-f4e1-40ce-83c3-8b88eeb43741%40googlegroups.com
https://groups.google.com/d/msgid/lucee/435ef0d3-f4e1-40ce-83c3-8b88eeb43741%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

Still: your files ought to be organised so you don’t have to sift through them working out what’s a class and what’s a template, I reckon.

Of course. The reason I’m wondering about this, is that I’m working on a
kind of plugin architecture. The plugin developer would publish a zip
file that may contain templates and components. I’d rather not limit the
developer in the structure of that zip file (or enforce a naming
convention), so I need to scan the whole plugin directory and be able to
make the distinction.

Will something like this still be possible? In other words, can we determine programmatically whether a .lucee file is a component or a template?

However this should definitely also be possible. What currently happens if one does getComponentMetadata() on a .lucee file which isn’t a component? If it fails or does not given a sensible way to differentiate, does the language need a function getFileMetadata() or something that will work appropriately on each kind of file? Suspect: yes.

The question is if the same extension for templates and components is a
good choice. Templates may be compiled to classes, but that doesn’t make
it the same thing as a component, from the viewpoint of the Lucee
developer. I don’t know of another template engine that uses the same
extension as their host language. It would be weird, for instance, if a
Java template engine would use the .java extension.

As an aside, I’m also wondering whether the whole template engine
shouldn’t be an extension. Even though it’s were CFML started, I think
it is no longer the core of what CFML is. I would like it if you could
swap it out for another template engine. (You can do that now, but you
have to do the integration yourself. Multiple template engines available
as extensions would be nice).

Which then raises the question as to the appropriateness of a single
extension for .lucee files.

I’ve never been sold on this. cfc/cfm made a clear statement about the
purpose of a file, is it a class or a template. I’d like to see that
distinction retained.On 16 April 2015 at 09:27, Adam Cameron <@Adam_Cameron> wrote:

On 16 April 2015 at 09:27, Adam Cameron <@Adam_Cameron> wrote:

I am not entirely sure .lucee is fully rounded out to be shipped with
Lucee 5, from what I’ve seen.

Agreed, I’m considering it a “Developer Preview”

However this should definitely also be possible. What currently happens if
one does getComponentMetadata() on a .lucee file which isn’t a component?

Just to answer my own question: it gives an error:

Lucee 5.0.0.43 Error (expression)Messageinvalid component definition, can’t
find component [myTemplate]

This is unsurprising, and exactly what I’d expect.

Just FYI.On Thursday, 16 April 2015 08:38:40 UTC+1, Adam Cameron wrote:


Adam