jbangdev / jbang

Unleash the power of Java - JBang Lets Students, Educators and Professional Developers create, edit and run self-contained source-only Java programs with unprecedented ease.
https://jbang.dev
MIT License
1.43k stars 157 forks source link

have a repo with GAV dir structure too provide jbang examples based on dep #307

Open maxandersen opened 4 years ago

quintesse commented 4 years ago

That sounds crazy :-) How would you detect that those folders are a dep, check online? And how would you prevent folder names that by accident have the same name a s a dep to be used as such? And you'd remove a single //DEPS line at most, right?

I think this needs some good use-cases.

gavinking commented 4 years ago

I would have expected a STEF dir structure, right, @FroMage?

maxandersen commented 4 years ago

idea is that today we bundle some basic example templates like jbang -t qrest quarkus.java and i was thinking we could allow something like jbang --deps org.hibernate:hibernate-core:4.6.8 hib.java and have it create a hibernate based example.

but now seeing it its just too verbose.

maybe add templates to catalog mechanism so you can do jbang -t start-hibernate@jbangdev myapp.java or even jbang -t start-hibernate@quintesse myapp.java ?

FroMage commented 4 years ago

You guys need better defaults, I probably want jbang -t start-hibernate myapp.java to mean jbang -t start-hibernate@jbangdev myapp.java, no?

And if you're doing starter template code, might as well have short names such as jbang -t hibernate myapp.java. I mean, if you need something that is not a starter you can always call it jbang -t hibernate-somethingelse myapp.java.

FroMage commented 4 years ago

I would have expected a STEF dir structure, right, @FroMage?

Well, @maxandersen has made it posterity with Math.max so it's only fair we get our names in places, eh?

jbang --tako --gavin --stef where --tako is a shortcut for "I want starter templates", --gavin for "put in hibernate stuff" and --stef for "make sure it deploys to prod if it mostly compiles".

quintesse commented 4 years ago

Agree with @FroMage ... we definitely need a --tako option.

Well that and the fact that shorter names would be better. Perhaps we could, when dealing with templates default to using a different catalog, eg. jbang-templates instead of jbang-catalog. The trick would be how to make you be able to leave out the @jbangdev part without messing up the current alias lookup mechanism.

Of course the templating system might just use different rules for lookup than aliases, where simple names that haven't resolved to files or other aliases get resolved against @jbangdev. But I'm not sure if that would perhaps push things over some arbitrary "complexity boundary".

FroMage commented 4 years ago

Sure, just put templates in your catalog repo under templates/hibernate/files…, no? That seems simple enough.