Compare commits
No commits in common. "8e6a14b3e07809b512ced51109c7161fb074f652" and "cf09799bc6f63107e259eb1413e87ce01462cf42" have entirely different histories.
8e6a14b3e0
...
cf09799bc6
72
config.toml
72
config.toml
@ -16,26 +16,6 @@ display = "Java Version"
|
|||||||
default = "1.4.10"
|
default = "1.4.10"
|
||||||
display = "Kotlin Version"
|
display = "Kotlin Version"
|
||||||
|
|
||||||
[versions]
|
|
||||||
http4k = "3.265.0"
|
|
||||||
pebble = "3.1.4"
|
|
||||||
caffeine = "2.8.5"
|
|
||||||
logback = "1.2.3"
|
|
||||||
mariadb = "2.6.2"
|
|
||||||
h2 = "1.4.200"
|
|
||||||
flyway = "7.0.0"
|
|
||||||
hikaricp = "3.4.5"
|
|
||||||
ktorm = "3.0.0"
|
|
||||||
junit = "5.7.0"
|
|
||||||
mokk = "1.10.0"
|
|
||||||
hamkrest = "1.7.0.3"
|
|
||||||
assertj = "3.17.2"
|
|
||||||
kodein-di = "7.1.0"
|
|
||||||
koin = "2.1.6"
|
|
||||||
jackson = "2.11.2"
|
|
||||||
kotlinx-serialization = "1.0-M1-1.4.0-rc"
|
|
||||||
arrow-core = "0.10.5"
|
|
||||||
|
|
||||||
[repositories]
|
[repositories]
|
||||||
|
|
||||||
[repositories.jcenter]
|
[repositories.jcenter]
|
||||||
@ -49,13 +29,14 @@ url = "https://dl.bintray.com/arrow-kt/arrow-kt/"
|
|||||||
[dependencies.http4k]
|
[dependencies.http4k]
|
||||||
groupId = "org.http4k"
|
groupId = "org.http4k"
|
||||||
artifactId = "http4k-core"
|
artifactId = "http4k-core"
|
||||||
|
version = "3.264.0"
|
||||||
category = "http4k"
|
category = "http4k"
|
||||||
default = true
|
default = true
|
||||||
|
|
||||||
[dependencies.http4k-server-jetty]
|
[dependencies.http4k-server-jetty]
|
||||||
groupId = "org.http4k"
|
groupId = "org.http4k"
|
||||||
artifactId = "http4k-server-jetty"
|
artifactId = "http4k-server-jetty"
|
||||||
version = "http4k"
|
version = "3.264.0"
|
||||||
category = "http4k"
|
category = "http4k"
|
||||||
default = true
|
default = true
|
||||||
logger = "org.eclipse.jetty"
|
logger = "org.eclipse.jetty"
|
||||||
@ -63,85 +44,94 @@ logger = "org.eclipse.jetty"
|
|||||||
[dependencies.http4k-server-apache]
|
[dependencies.http4k-server-apache]
|
||||||
groupId = "org.http4k"
|
groupId = "org.http4k"
|
||||||
artifactId = "http4k-server-apache"
|
artifactId = "http4k-server-apache"
|
||||||
version = "http4k"
|
version = "3.264.0"
|
||||||
category = "http4k"
|
category = "http4k"
|
||||||
|
|
||||||
[dependencies.http4k-client-apache]
|
[dependencies.http4k-client-apache]
|
||||||
groupId = "org.http4k"
|
groupId = "org.http4k"
|
||||||
artifactId = "http4k-client-apache"
|
artifactId = "http4k-client-apache"
|
||||||
version = "http4k"
|
version = "3.264.0"
|
||||||
category = "http4k"
|
category = "http4k"
|
||||||
|
|
||||||
[dependencies.http4k-format-jackson]
|
[dependencies.http4k-format-jackson]
|
||||||
groupId = "org.http4k"
|
groupId = "org.http4k"
|
||||||
artifactId = "http4k-format-jackson"
|
artifactId = "http4k-format-jackson"
|
||||||
version = "http4k"
|
version = "3.264.0"
|
||||||
category = "http4k"
|
category = "http4k"
|
||||||
|
|
||||||
[dependencies.http4k-format-kotlinx-serialization]
|
[dependencies.http4k-format-kotlinx-serialization]
|
||||||
groupId = "org.http4k"
|
groupId = "org.http4k"
|
||||||
artifactId = "http4k-format-kotlinx-serialization"
|
artifactId = "http4k-format-kotlinx-serialization"
|
||||||
version = "http4k"
|
version = "3.264.0"
|
||||||
category = "http4k"
|
category = "http4k"
|
||||||
|
|
||||||
[dependencies.http4k-contract]
|
[dependencies.http4k-contract]
|
||||||
groupId = "org.http4k"
|
groupId = "org.http4k"
|
||||||
artifactId = "http4k-contract"
|
artifactId = "http4k-contract"
|
||||||
version = "http4k"
|
version = "3.264.0"
|
||||||
category = "http4k"
|
category = "http4k"
|
||||||
|
|
||||||
[dependencies.pebble]
|
[dependencies.pebble]
|
||||||
groupId = "io.pebbletemplates"
|
groupId = "io.pebbletemplates"
|
||||||
artifactId = "pebble"
|
artifactId = "pebble"
|
||||||
|
version = "3.1.4"
|
||||||
default = true
|
default = true
|
||||||
logger = "com.mitchellbosecke.pebble"
|
logger = "com.mitchellbosecke.pebble"
|
||||||
|
|
||||||
[dependencies.caffeine]
|
[dependencies.caffeine]
|
||||||
groupId = "com.github.ben-manes.caffeine"
|
groupId = "com.github.ben-manes.caffeine"
|
||||||
artifactId = "caffeine"
|
artifactId = "caffeine"
|
||||||
|
version = "2.8.5"
|
||||||
|
|
||||||
[dependencies.logback]
|
[dependencies.logback]
|
||||||
groupId = "ch.qos.logback"
|
groupId = "ch.qos.logback"
|
||||||
artifactId = "logback-classic"
|
artifactId = "logback-classic"
|
||||||
|
version = "1.2.3"
|
||||||
default = true
|
default = true
|
||||||
|
|
||||||
[dependencies.mariadb]
|
[dependencies.mariadb]
|
||||||
groupId = "org.mariadb.jdbc"
|
groupId = "org.mariadb.jdbc"
|
||||||
artifactId = "mariadb-java-client"
|
artifactId = "mariadb-java-client"
|
||||||
|
version = "2.6.2"
|
||||||
category = "database"
|
category = "database"
|
||||||
|
|
||||||
[dependencies.h2]
|
[dependencies.h2]
|
||||||
groupId = "com.h2database"
|
groupId = "com.h2database"
|
||||||
artifactId = "h2"
|
artifactId = "h2"
|
||||||
|
version = "1.4.200"
|
||||||
category = "database"
|
category = "database"
|
||||||
|
|
||||||
[dependencies.flyway]
|
[dependencies.flyway]
|
||||||
groupId = "org.flywaydb"
|
groupId = "org.flywaydb"
|
||||||
artifactId = "flyway-core"
|
artifactId = "flyway-core"
|
||||||
|
version = "6.5.4"
|
||||||
category = "database"
|
category = "database"
|
||||||
logger = "org.flywaydb.core"
|
logger = "org.flywaydb.core"
|
||||||
|
|
||||||
[dependencies.hikaricp]
|
[dependencies.HikariCP]
|
||||||
groupId = "com.zaxxer"
|
groupId = "com.zaxxer"
|
||||||
artifactId = "HikariCP"
|
artifactId = "HikariCP"
|
||||||
|
version = "3.4.5"
|
||||||
category = "database"
|
category = "database"
|
||||||
logger = "com.zaxxer.hikari"
|
logger = "com.zaxxer.hikari"
|
||||||
|
|
||||||
[dependencies.ktorm]
|
[dependencies.Ktorm]
|
||||||
groupId = "me.liuwj.ktorm"
|
groupId = "me.liuwj.ktorm"
|
||||||
artifactId = "ktorm-core"
|
artifactId = "ktorm-core"
|
||||||
|
version = "3.0.0"
|
||||||
category = "database"
|
category = "database"
|
||||||
logger = "me.liuwj.ktorm.database"
|
logger = "me.liuwj.ktorm.database"
|
||||||
|
|
||||||
[dependencies.ktorm-mysql]
|
[dependencies.Ktorm-Mysql]
|
||||||
groupId = "me.liuwj.ktorm"
|
groupId = "me.liuwj.ktorm"
|
||||||
artifactId = "ktorm-support-mysql"
|
artifactId = "ktorm-support-mysql"
|
||||||
version = "ktorm"
|
version = "3.0.0"
|
||||||
category = "database"
|
category = "database"
|
||||||
|
|
||||||
[dependencies.junit]
|
[dependencies.junit]
|
||||||
groupId = "org.junit.jupiter"
|
groupId = "org.junit.jupiter"
|
||||||
artifactId = "junit-jupiter"
|
artifactId = "junit-jupiter"
|
||||||
|
version = "5.7.0"
|
||||||
scope = "test"
|
scope = "test"
|
||||||
category = "test"
|
category = "test"
|
||||||
default = true
|
default = true
|
||||||
@ -149,7 +139,7 @@ default = true
|
|||||||
[dependencies.junit-params]
|
[dependencies.junit-params]
|
||||||
groupId = "org.junit.jupiter"
|
groupId = "org.junit.jupiter"
|
||||||
artifactId = "junit-jupiter-params"
|
artifactId = "junit-jupiter-params"
|
||||||
version = "junit"
|
version = "5.7.0"
|
||||||
scope = "test"
|
scope = "test"
|
||||||
category = "test"
|
category = "test"
|
||||||
default = true
|
default = true
|
||||||
@ -157,46 +147,54 @@ default = true
|
|||||||
[dependencies.mokk]
|
[dependencies.mokk]
|
||||||
groupId = "io.mockk"
|
groupId = "io.mockk"
|
||||||
artifactId = "mockk"
|
artifactId = "mockk"
|
||||||
|
version = "1.10.0"
|
||||||
scope = "test"
|
scope = "test"
|
||||||
category = "test"
|
category = "test"
|
||||||
|
|
||||||
[dependencies.hamkrest]
|
[dependencies.hamkrest]
|
||||||
groupId = "com.natpryce"
|
groupId = "com.natpryce"
|
||||||
artifactId = "hamkrest"
|
artifactId = "hamkrest"
|
||||||
|
version = "1.7.0.3"
|
||||||
scope = "test"
|
scope = "test"
|
||||||
category = "test"
|
category = "test"
|
||||||
|
|
||||||
[dependencies.assertj]
|
[dependencies.assertJ]
|
||||||
groupId = "org.assertj"
|
groupId = "org.assertj"
|
||||||
artifactId = "assertj-core"
|
artifactId = "assertj-core"
|
||||||
|
version = "3.17.2"
|
||||||
scope = "test"
|
scope = "test"
|
||||||
category = "test"
|
category = "test"
|
||||||
default = true
|
default = true
|
||||||
|
|
||||||
[dependencies.kodein-di]
|
[dependencies.Kodein-DI]
|
||||||
groupId = "org.kodein.di"
|
groupId = "org.kodein.di"
|
||||||
artifactId = "kodein-di-jvm"
|
artifactId = "kodein-di-jvm"
|
||||||
|
version = "7.0.0"
|
||||||
category = "injection"
|
category = "injection"
|
||||||
repository = "jcenter"
|
repository = "jcenter"
|
||||||
|
|
||||||
[dependencies.koin]
|
[dependencies.Koin]
|
||||||
groupId = "org.koin"
|
groupId = "org.koin"
|
||||||
artifactId = "koin-core"
|
artifactId = "koin-core"
|
||||||
|
version = "2.1.6"
|
||||||
category = "injection"
|
category = "injection"
|
||||||
repository = "jcenter"
|
repository = "jcenter"
|
||||||
default = true
|
default = true
|
||||||
|
|
||||||
[dependencies.jackson]
|
[dependencies.Jackson]
|
||||||
groupId = "com.fasterxml.jackson.module"
|
groupId = "com.fasterxml.jackson.module"
|
||||||
artifactId = "jackson-module-kotlin"
|
artifactId = "jackson-module-kotlin"
|
||||||
|
version = "2.11.2"
|
||||||
category = "serialization"
|
category = "serialization"
|
||||||
|
|
||||||
[dependencies.kotlinx-serialization]
|
[dependencies.Kotlinx-serialization]
|
||||||
groupId = "org.jetbrains.kotlinx"
|
groupId = "org.jetbrains.kotlinx"
|
||||||
artifactId = "kotlinx-serialization-runtime"
|
artifactId = "kotlinx-serialization-runtime"
|
||||||
|
version = "1.0-M1-1.4.0-rc"
|
||||||
category = "serialization"
|
category = "serialization"
|
||||||
|
|
||||||
[dependencies.arrow-core]
|
[dependencies.Arrow-core]
|
||||||
groupId = "io.arrow-kt"
|
groupId = "io.arrow-kt"
|
||||||
artifactId = "arrow-core"
|
artifactId = "arrow-core"
|
||||||
|
version = "0.10.5"
|
||||||
repository = "arrow"
|
repository = "arrow"
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@ -40,7 +40,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.http4k</groupId>
|
<groupId>org.http4k</groupId>
|
||||||
<artifactId>http4k-core</artifactId>
|
<artifactId>http4k-core</artifactId>
|
||||||
<version>3.265.0</version>
|
<version>3.260.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
package starter.config
|
package starter
|
||||||
|
|
||||||
import com.electronwill.nightconfig.core.UnmodifiableConfig
|
|
||||||
import com.electronwill.nightconfig.core.file.FileConfig
|
import com.electronwill.nightconfig.core.file.FileConfig
|
||||||
import starter.*
|
|
||||||
import com.electronwill.nightconfig.core.Config as NightConfig
|
import com.electronwill.nightconfig.core.Config as NightConfig
|
||||||
|
|
||||||
data class StarterConfig(
|
data class StarterConfig(
|
||||||
@ -20,25 +18,18 @@ class Config {
|
|||||||
val cfg = FileConfig.of("config.toml")
|
val cfg = FileConfig.of("config.toml")
|
||||||
cfg.load()
|
cfg.load()
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
|
||||||
val versions = cfg.get<UnmodifiableConfig>("versions").valueMap() as Map<String, String>
|
|
||||||
|
|
||||||
val dependencies = cfg.configMap("dependencies")
|
val dependencies = cfg.configMap("dependencies")
|
||||||
.map { (name, values) ->
|
.map { (name, values) ->
|
||||||
val versionKey: String = values["version"] ?: name
|
|
||||||
val version = versions[versionKey] ?: error("Missing version for $name")
|
|
||||||
|
|
||||||
Dependency(
|
Dependency(
|
||||||
name,
|
name,
|
||||||
values["groupId"],
|
values["groupId"],
|
||||||
values["artifactId"],
|
values["artifactId"],
|
||||||
version,
|
values["version"],
|
||||||
values.getOrElse("default", false),
|
values.getOrElse("default", false),
|
||||||
values.getEnumOrElse("category", Category.Other),
|
values.getEnumOrElse("category", Category.Other),
|
||||||
values.getEnumOrElse("scope", Scope.Compile),
|
values.getEnumOrElse("scope", Scope.Compile),
|
||||||
values["logger"],
|
values["logger"],
|
||||||
values["repository"],
|
values["repository"],
|
||||||
versionKey
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1,10 +1,55 @@
|
|||||||
package starter
|
package starter
|
||||||
|
|
||||||
|
import org.http4k.core.then
|
||||||
|
import org.http4k.filter.ServerFilters
|
||||||
|
import org.http4k.routing.ResourceLoader
|
||||||
|
import org.http4k.routing.RoutingHttpHandler
|
||||||
|
import org.http4k.routing.routes
|
||||||
|
import org.http4k.routing.static
|
||||||
|
import org.http4k.server.SunHttp
|
||||||
|
import org.http4k.server.asServer
|
||||||
import org.koin.core.context.startKoin
|
import org.koin.core.context.startKoin
|
||||||
import starter.modules.mainModule
|
import org.koin.dsl.bind
|
||||||
import starter.modules.pebbleModule
|
import org.koin.dsl.module
|
||||||
import starter.modules.routesModule
|
import org.koin.dsl.onClose
|
||||||
import starter.modules.templateModule
|
import org.slf4j.Logger
|
||||||
|
import org.slf4j.LoggerFactory
|
||||||
|
import starter.routes.IndexRouteSupplier
|
||||||
|
import starter.routes.RouteSupplier
|
||||||
|
import starter.routes.ZipRouteSupplier
|
||||||
|
import starter.routes.toRouter
|
||||||
|
import starter.templates.*
|
||||||
|
|
||||||
|
val mainModule = module {
|
||||||
|
single(createdAtStart = true) {
|
||||||
|
get<Logger>().info("Starting on http://localhost:7000")
|
||||||
|
get<RoutingHttpHandler>().asServer(SunHttp(7000)).start()
|
||||||
|
} onClose { it?.stop() }
|
||||||
|
|
||||||
|
single { Config().load() }
|
||||||
|
single { LoggerFactory.getLogger("Starter") }
|
||||||
|
single { Views(get(), get()) }
|
||||||
|
single { ProjectZip(getAll()) }
|
||||||
|
}
|
||||||
|
|
||||||
|
val templateModule = module {
|
||||||
|
single { PomTemplate(get()) } bind Template::class
|
||||||
|
single { MainTemplate(get()) } bind Template::class
|
||||||
|
single { LogbackTemplate(get()) } bind Template::class
|
||||||
|
single { GitignoreTemplate(get()) } bind Template::class
|
||||||
|
}
|
||||||
|
|
||||||
|
val routesModule = module {
|
||||||
|
single { IndexRouteSupplier(get()) } bind RouteSupplier::class
|
||||||
|
single { ZipRouteSupplier(get(), get()) } bind RouteSupplier::class
|
||||||
|
single {
|
||||||
|
ServerFilters.CatchAll().then(
|
||||||
|
routes(
|
||||||
|
static(ResourceLoader.Classpath("/assets")),
|
||||||
|
getAll<RouteSupplier>().toRouter()
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun main() {
|
fun main() {
|
||||||
startKoin {
|
startKoin {
|
||||||
|
|||||||
@ -18,7 +18,6 @@ data class Dependency(
|
|||||||
val scope: Scope,
|
val scope: Scope,
|
||||||
val logger: String?,
|
val logger: String?,
|
||||||
val repository: String?,
|
val repository: String?,
|
||||||
val versionKey: String,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
data class Repository(val name: String, val url: String)
|
data class Repository(val name: String, val url: String)
|
||||||
@ -32,5 +31,3 @@ data class Project(
|
|||||||
val dependencies: List<Dependency>,
|
val dependencies: List<Dependency>,
|
||||||
val repositories: List<Repository>,
|
val repositories: List<Repository>,
|
||||||
)
|
)
|
||||||
|
|
||||||
data class Version(val name: String, val value: String)
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package starter.modules
|
package starter
|
||||||
|
|
||||||
import com.mitchellbosecke.pebble.extension.escaper.SafeString
|
import com.mitchellbosecke.pebble.extension.escaper.SafeString
|
||||||
import com.mitchellbosecke.pebble.template.EvaluationContext
|
import com.mitchellbosecke.pebble.template.EvaluationContext
|
||||||
@ -6,7 +6,6 @@ import com.mitchellbosecke.pebble.template.PebbleTemplate
|
|||||||
import org.intellij.lang.annotations.Language
|
import org.intellij.lang.annotations.Language
|
||||||
import org.koin.dsl.bind
|
import org.koin.dsl.bind
|
||||||
import org.koin.dsl.module
|
import org.koin.dsl.module
|
||||||
import starter.Dependency
|
|
||||||
import starter.utils.PebbleEngineBuilder
|
import starter.utils.PebbleEngineBuilder
|
||||||
import starter.utils.PebbleEngineBuilder.CacheType.ConcurrentMap
|
import starter.utils.PebbleEngineBuilder.CacheType.ConcurrentMap
|
||||||
import starter.utils.PebbleFunction
|
import starter.utils.PebbleFunction
|
||||||
@ -1,7 +1,6 @@
|
|||||||
package starter.views
|
package starter
|
||||||
|
|
||||||
import com.mitchellbosecke.pebble.PebbleEngine
|
import com.mitchellbosecke.pebble.PebbleEngine
|
||||||
import starter.config.StarterConfig
|
|
||||||
import starter.utils.render
|
import starter.utils.render
|
||||||
|
|
||||||
class Views(private val engine: PebbleEngine, config: StarterConfig) {
|
class Views(private val engine: PebbleEngine, config: StarterConfig) {
|
||||||
@ -1,24 +0,0 @@
|
|||||||
package starter.modules
|
|
||||||
|
|
||||||
import org.http4k.routing.RoutingHttpHandler
|
|
||||||
import org.http4k.server.SunHttp
|
|
||||||
import org.http4k.server.asServer
|
|
||||||
import org.koin.dsl.module
|
|
||||||
import org.koin.dsl.onClose
|
|
||||||
import org.slf4j.Logger
|
|
||||||
import org.slf4j.LoggerFactory
|
|
||||||
import starter.ProjectZip
|
|
||||||
import starter.config.Config
|
|
||||||
import starter.views.Views
|
|
||||||
|
|
||||||
val mainModule = module {
|
|
||||||
single(createdAtStart = true) {
|
|
||||||
get<Logger>().info("Starting on http://localhost:7000")
|
|
||||||
get<RoutingHttpHandler>().asServer(SunHttp(7000)).start()
|
|
||||||
} onClose { it?.stop() }
|
|
||||||
|
|
||||||
single { Config().load() }
|
|
||||||
single { LoggerFactory.getLogger("Starter") }
|
|
||||||
single { Views(get(), get()) }
|
|
||||||
single { ProjectZip(getAll()) }
|
|
||||||
}
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
package starter.modules
|
|
||||||
|
|
||||||
import org.http4k.core.then
|
|
||||||
import org.http4k.filter.ServerFilters
|
|
||||||
import org.http4k.routing.ResourceLoader
|
|
||||||
import org.http4k.routing.routes
|
|
||||||
import org.http4k.routing.static
|
|
||||||
import org.koin.dsl.bind
|
|
||||||
import org.koin.dsl.module
|
|
||||||
import starter.routes.IndexRouteSupplier
|
|
||||||
import starter.routes.RouteSupplier
|
|
||||||
import starter.routes.ZipRouteSupplier
|
|
||||||
import starter.routes.toRouter
|
|
||||||
|
|
||||||
val routesModule = module {
|
|
||||||
single { IndexRouteSupplier(get()) } bind RouteSupplier::class
|
|
||||||
single { ZipRouteSupplier(get(), get()) } bind RouteSupplier::class
|
|
||||||
single {
|
|
||||||
ServerFilters.CatchAll().then(
|
|
||||||
routes(
|
|
||||||
static(ResourceLoader.Classpath("/assets")),
|
|
||||||
getAll<RouteSupplier>().toRouter()
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
package starter.modules
|
|
||||||
|
|
||||||
import org.koin.dsl.bind
|
|
||||||
import org.koin.dsl.module
|
|
||||||
import starter.templates.*
|
|
||||||
|
|
||||||
val templateModule = module {
|
|
||||||
single { PomTemplate(get()) } bind Template::class
|
|
||||||
single { MainTemplate(get()) } bind Template::class
|
|
||||||
single { LogbackTemplate(get()) } bind Template::class
|
|
||||||
single { GitignoreTemplate(get()) } bind Template::class
|
|
||||||
}
|
|
||||||
@ -4,7 +4,8 @@ import org.http4k.core.Method
|
|||||||
import org.http4k.core.Response
|
import org.http4k.core.Response
|
||||||
import org.http4k.core.Status
|
import org.http4k.core.Status
|
||||||
import org.http4k.routing.bind
|
import org.http4k.routing.bind
|
||||||
import starter.views.Views
|
import starter.StarterConfig
|
||||||
|
import starter.Views
|
||||||
|
|
||||||
class IndexRouteSupplier(private val views: Views) : RouteSupplier {
|
class IndexRouteSupplier(private val views: Views) : RouteSupplier {
|
||||||
override fun get() = "/" bind Method.GET to {
|
override fun get() = "/" bind Method.GET to {
|
||||||
|
|||||||
@ -8,15 +8,15 @@ import org.http4k.core.with
|
|||||||
import org.http4k.routing.bind
|
import org.http4k.routing.bind
|
||||||
import starter.Project
|
import starter.Project
|
||||||
import starter.ProjectZip
|
import starter.ProjectZip
|
||||||
import starter.config.StarterConfig
|
import starter.StarterConfig
|
||||||
import starter.extensions.attachment
|
import starter.extensions.attachment
|
||||||
import starter.extensions.badRequest
|
import starter.extensions.badRequest
|
||||||
import starter.extensions.ok
|
import starter.extensions.ok
|
||||||
import java.io.ByteArrayInputStream
|
import java.io.ByteArrayInputStream
|
||||||
|
|
||||||
class ZipRouteSupplier(
|
class ZipRouteSupplier(
|
||||||
private val conf: StarterConfig,
|
private val conf: StarterConfig,
|
||||||
private val projectZip: ProjectZip,
|
private val projectZip: ProjectZip,
|
||||||
) : RouteSupplier {
|
) : RouteSupplier {
|
||||||
|
|
||||||
override fun get() = "/" bind Method.POST to { req ->
|
override fun get() = "/" bind Method.POST to { req ->
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package starter.templates
|
|||||||
|
|
||||||
import com.mitchellbosecke.pebble.PebbleEngine
|
import com.mitchellbosecke.pebble.PebbleEngine
|
||||||
import starter.Project
|
import starter.Project
|
||||||
import starter.Version
|
|
||||||
import starter.utils.prettyPrintXml
|
import starter.utils.prettyPrintXml
|
||||||
import starter.utils.render
|
import starter.utils.render
|
||||||
|
|
||||||
@ -14,7 +13,6 @@ class PomTemplate(private val engine: PebbleEngine) : Template {
|
|||||||
"dependencies" to project.dependencies.sortedBy { it.scope },
|
"dependencies" to project.dependencies.sortedBy { it.scope },
|
||||||
"repositories" to project.repositories,
|
"repositories" to project.repositories,
|
||||||
"kotlinxSerialization" to project.dependencies.any { it.name == "Kotlinx-serialization" },
|
"kotlinxSerialization" to project.dependencies.any { it.name == "Kotlinx-serialization" },
|
||||||
"versions" to project.dependencies.map { Version(name = it.versionKey, value = it.version) }.toSet()
|
|
||||||
)
|
)
|
||||||
|
|
||||||
project.inputs.forEach {
|
project.inputs.forEach {
|
||||||
|
|||||||
@ -8,9 +8,9 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>{{ dep.groupId }}</groupId>
|
<groupId>{{ dep.groupId }}</groupId>
|
||||||
<artifactId>{{ dep.artifactId }}</artifactId>
|
<artifactId>{{ dep.artifactId }}</artifactId>
|
||||||
<version>{{ "${" }}{{ dep.versionKey }}{{ ".version}" }}</version>
|
<version>{{ dep.version }}</version>
|
||||||
{% if dep.scope == "Test" %}
|
{% if dep.scope == "Test" %}
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</dependency>
|
</dependency>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@ -12,11 +12,6 @@
|
|||||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<main.class>{{ basePackage }}/{{ name | lower | capitalize }}Kt</main.class>
|
<main.class>{{ basePackage }}/{{ name | lower | capitalize }}Kt</main.class>
|
||||||
<!-- versions -->
|
|
||||||
{% for version in versions %}
|
|
||||||
<{{version.name}}.version>{{version.value}}</{{version.name}}.version>
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
{% include "starter/pom/@dependencies" %}
|
{% include "starter/pom/@dependencies" %}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user