Azure / draft-classic

A tool for developers to create cloud-native applications on Kubernetes.
https://draft.sh
MIT License
3.92k stars 395 forks source link

pack detection should default to the most popular language found that has a pack #476

Closed jstrachan closed 6 years ago

jstrachan commented 6 years ago

I just tried the pack detection on a simple spring boot java app via draft create and got

Error: Could not find a pack Q_Q

With debug I saw:

DEBU[0000] language: Shell percent: 36.794912 color: #89e051
DEBU[0000] language: Batchfile percent: 26.097383 color: #C1F12E
DEBU[0000] language: Java percent: 18.710249 color: #b07219
DEBU[0000] language: Maven POM percent: 12.777604 color:
DEBU[0000] language: Gradle percent: 3.878636 color:
DEBU[0000] language: GDB percent: 0.192889 color:
DEBU[0000] language: INI percent: 0.573454 color:
DEBU[0000] language: Coq percent: 0.130331 color:

Its quite common to have some shell scripts and sometimes not huge amounts of Java code / POM files etc.

In this particular case its due to spring boot apps often including shell scripts to wrap invoking maven + gradle - which can be larger than the hello world Java source code ;)

So I wonder if a nicer approach would be to

If folks are happy with the above I'd be happy to submit a PR. Would love draft to just work OOTB with any Spring Boot app generated from: http://start.spring.io/ for example!

jstrachan commented 6 years ago

BTW I just submitted this PR that demonstrates draft create fails on a canonical Spring Boot project https://github.com/Azure/draft/pull/489

With the above PR merged you can demonstrate this issue via:

cd examples/examples-spring-boot
draft create

You can create your own spring boot example with a few clicks on: http://start.spring.io/ - I did not modify the code in any way from whats generated from start.spring.io)

FWIW Spring Boot is probably the most common framework for building microservices with Java and should be something draft create can cope with