Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: A crud generator inspired by Ruby On Rails scaffolding #18380

Closed
wants to merge 10 commits into from
Closed

WIP: A crud generator inspired by Ruby On Rails scaffolding #18380

wants to merge 10 commits into from

Conversation

netodevel
Copy link
Contributor

@netodevel netodevel commented Jul 3, 2021

This is a demonstration of what I'm developing

Attention:
turn down the volume before running the demo.

demo-scaffold-quarkus.mp4

A crud generator inspired by Ruby On Rails scaffolding.

Goal

Automate/generate repetitive daily tasks (or at least the beginning of them) as a simple CRUD.

What I planned for the first version

Crud generator in Java with standard structure (model, service, controller) and tests.
Maven and Gradle support.

commands:

mvn quarkus:model -Dparams="User name:String age:Int createAt:Date"
mvn quarkus:repository -Dparams="User"
mvn quarkus:service -Dparams="User"
mvn quarkus:repository -Dparams="User"
mvn quarkus:scaffold -Dparams="User name:String age:Int createAt:Date"

Future

In the future this may go beyond generating crud and also generating initial settings.

Input:
mvn quarkus:config -Dparam="amazon-sqs"

Output:

add dependencies
add properties
add example of consumer and producer

In the future it will be possible to choose which target language, such as: kotlin.
and control this by some properties files that the generator will consult before executing.
I also see generation of migrations(liquibase,flyway) in the future.

This feature is still on WIP.

I post here to hear opinions about and help me complete this feature as well.
Thanks.

@quarkus-bot
Copy link

quarkus-bot bot commented Jul 3, 2021

Thanks for your pull request!

The title of your pull request does not follow our editorial rules. Could you have a look?

  • title should not end up with dot

This message is automatically generated by a bot.

@netodevel netodevel changed the title A crud generator inspired by Ruby On Rails scaffolding. WIP A crud generator inspired by Ruby On Rails scaffolding. Jul 3, 2021
@quarkus-bot quarkus-bot bot added area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/maven area/platform Issues related to definition and interaction with Quarkus Platform labels Jul 3, 2021
@netodevel netodevel changed the title WIP A crud generator inspired by Ruby On Rails scaffolding. WIP: A crud generator inspired by Ruby On Rails scaffolding. Jul 3, 2021
@netodevel netodevel changed the title WIP: A crud generator inspired by Ruby On Rails scaffolding. WIP: A crud generator inspired by Ruby On Rails scaffolding Jul 4, 2021
@geoand
Copy link
Contributor

geoand commented Jul 5, 2021

Thanks a lot for this work!

I am cc'ing @ebullient @maxandersen @ia3andy who are most knowledgeable in this area

@maxandersen
Copy link
Member

Looks good and interesting; I do though think making this something as part of maven/gradle plugin is not the way forward. Ultimately should be a plugin to quarkus cli. That has the advantage that this wont be dependent on core repository but can be done separately (like quarkus jhipster support is not part of quarkus core).

We don't have the plugin mechanism yet but will soon; follow #18408 to know more.

@@ -42,6 +42,12 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-devtools-codestarts</artifactId>
</dependency>
<!-- Generator Mustache -->
<dependency>
<groupId>com.github.spullara.mustache.java</groupId>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a specific reason you don't use qute ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just because I am more familiar with mustache, I have never used qute for this purpose.

@netodevel
Copy link
Contributor Author

Looks good and interesting; I do though think making this something as part of maven/gradle plugin is not the way forward. Ultimately should be a plugin to quarkus cli. That has the advantage that this wont be dependent on core repository but can be done separately (like quarkus jhipster support is not part of quarkus core).

We don't have the plugin mechanism yet but will soon; follow #18408 to know more.

really, coupling to the core is not a very good thing.
I just discovered the cli. 😄
https://quarkus.io/guides/cli-tooling

the idea then is this scaffold to be a separate project and use it as a "plugin" to be installed on the cli, right?

I just have a counterpoint for us to think about.
The java community (that I know of) has no familiarity or desire to install cli for their development workflow.
that's why I adopted engaging in the practicality of using maven/gradle;

I've been through this in the spring community.
I really count on my fingers how many people have already installed the spring cli and used the scaffold plugin.
https://github.com/NetoDevel/cli-spring-boot-scaffold

@maxandersen
Copy link
Member

the idea then is this scaffold to be a separate project and use it as a "plugin" to be installed on the cli, right?

basically yes.

@netodevel now I don't disagree with you that some devs don't like to have cli's when they just have mvn/gradle plugins...the cool thing is that with the way the cli is made nothing really prevent us from making a quarkus:cli maven and gradle command available. That would be a bit meta and I'm not a superfan of it and there could be a speed penalty but it could be considered.

One thing is though a concern I always have with these codegenerators it is that they go stale if not maintained continuously and thats my main reason to want to decouple that from the core quarkus plugins to let them move as fast or slow as they want/are able to.

@netodevel
Copy link
Contributor Author

@maxandersen,
Okay, given this scenario, I think we can move all the code that makes the generator to the Quarkiverse Hub?
When the plugin feature in the cli is ready, maybe this project is a plugin that is already installed by default?
We can go in line to experiment only in CLI, and if adoptions are low maybe try it on maven/gradle?
Did you agree?

I really see in the future the quarkus site emphasizing the use of cli with generators to make development fun.
And maybe change this community's idea about cli.

@netodevel
Copy link
Contributor Author

@ebullient @maxandersen @ia3andy,
Guys, any directions how should I proceed?

@maxandersen
Copy link
Member

@netodevel sorry for the delay - the way forward is you create a repo with a command called quarkus- and make it generate the scaffolding code.

then when we (hopefully soon) have quarkus plugin support it becomes easy to integrate it.

At this time we don't plan on having a "in-core" scaffolding tool - projects like the one you made here, jhipster, nubesgen and others all are available. If someone standsout as being really fitting we might consider make it the default or extra easy to install, but lets say you make this available in netodvel/jbang-catalog the only thing you would need to do is:

jbang app install quarkus-scaffold@netodevel 
quarkus scaffold

This way you and contributors can grow and build this on top of Quarkus rather than being tied to specific version of quarkus.

wdyt?

@ia3andy
Copy link
Contributor

ia3andy commented Jul 7, 2021

As @maxandersen said, I would suggest to give a try to Qute for the templates, it's really nice and easy to use (and it is native compatible).

@netodevel
Copy link
Contributor Author

@maxandersen, @ia3andy,

I agree, so i will close this pr.
Thanks.

@netodevel netodevel closed this Jul 7, 2021
@quarkus-bot quarkus-bot bot added the triage/invalid This doesn't seem right label Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/maven area/platform Issues related to definition and interaction with Quarkus Platform triage/invalid This doesn't seem right
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants