From dafc60c999f22516dfc4e4e06c2da4bf9d4bd26f Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Sun, 21 Mar 2021 02:56:46 +0700 Subject: [PATCH 1/3] copy files without hbs extension instead processing by template engine (to support binary files in templates) --- .../kotlin/dev/icerock/tools/shaper/core/Shaper.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/shaper-core/src/main/kotlin/dev/icerock/tools/shaper/core/Shaper.kt b/shaper-core/src/main/kotlin/dev/icerock/tools/shaper/core/Shaper.kt index 4647772..81db006 100644 --- a/shaper-core/src/main/kotlin/dev/icerock/tools/shaper/core/Shaper.kt +++ b/shaper-core/src/main/kotlin/dev/icerock/tools/shaper/core/Shaper.kt @@ -24,10 +24,15 @@ class Shaper(private val templateConfig: TemplateConfig) { if (!exists()) mkdirs() } - val templateSource = TemplateSourceFactory.create(fileConfig.contentTemplateName) - val contentTemplate = handlebars.compile(templateSource) - FileWriter(file).use { fileWriter -> - contentTemplate.apply(allParams, fileWriter) + if (fileConfig.contentTemplateName.endsWith(".hbs")) { + val templateSource = TemplateSourceFactory.create(fileConfig.contentTemplateName) + val contentTemplate = handlebars.compile(templateSource) + FileWriter(file).use { fileWriter -> + contentTemplate.apply(allParams, fileWriter) + } + } else { + val source = File(fileConfig.contentTemplateName) + source.copyTo(file, overwrite = true) } } val resultWriter = StringWriter() From c35074f10214b1a7dd109fa4c56a20c4fa360951 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Sun, 21 Mar 2021 02:57:39 +0700 Subject: [PATCH 2/3] remove invalid uberjar (install dist have separated jars) --- shaper-cli/build.gradle.kts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/shaper-cli/build.gradle.kts b/shaper-cli/build.gradle.kts index 9d6aa2d..5030405 100644 --- a/shaper-cli/build.gradle.kts +++ b/shaper-cli/build.gradle.kts @@ -15,15 +15,6 @@ application { mainClass.set("dev.icerock.tools.shaper.cli.ShaperCliKt") } -tasks.withType().configureEach { - dependsOn(configurations.runtimeClasspath) - from({ - configurations.runtimeClasspath.get() - .filter { it.name.endsWith("jar") } - .map { zipTree(it) } - }) -} - // export PATH=~/.shaper/shaper-cli/bin:$PATH tasks.create("install") { dependsOn(tasks.getByName("installDist")) From 5f757d31fbb181e3f18f0750e78a6ed7eeb54374 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Sun, 21 Mar 2021 16:05:03 +0700 Subject: [PATCH 3/3] up version --- build.gradle.kts | 2 +- install-shaper.sh | 4 ++-- run-cli-sample.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 7686b9c..d076305 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { subprojects { group = "dev.icerock.tools" - version = "0.2.0-SNAPSHOT" + version = "0.1.1" apply(plugin = "org.jetbrains.kotlin.jvm") } diff --git a/install-shaper.sh b/install-shaper.sh index 41255bd..36937be 100755 --- a/install-shaper.sh +++ b/install-shaper.sh @@ -1,10 +1,10 @@ mkdir -p ~/.shaper && \ cd ~/.shaper && \ -curl -L -s "https://github.com/icerockdev/shaper/releases/download/release%2F0.1.0/shaper-cli-0.1.0.zip" > cli.zip && \ +curl -L -s "https://github.com/icerockdev/shaper/releases/download/release%2F0.1.1/shaper-cli-0.1.1.zip" > cli.zip && \ unzip -q cli.zip && \ rm cli.zip && \ rm -rf shaper-cli || true && \ -mv shaper-cli-0.1.0 shaper-cli && \ +mv shaper-cli-0.1.1 shaper-cli && \ echo "repositories:" > config.yaml && \ echo 'To complete setup add into your environments: export PATH=~/.shaper/shaper-cli/bin:$PATH' echo 'After it you can call shaper by command: shaper-cli -i -o ' \ No newline at end of file diff --git a/run-cli-sample.sh b/run-cli-sample.sh index 4e4bf41..55c9579 100755 --- a/run-cli-sample.sh +++ b/run-cli-sample.sh @@ -1,3 +1,3 @@ ./gradlew build cd samples -java -jar ../shaper-cli/build/libs/shaper-cli-0.1.0-SNAPSHOT.jar -i $1.yaml -o $1-out \ No newline at end of file +java -jar ../shaper-cli/build/libs/shaper-cli-0.1.1-SNAPSHOT.jar -i $1.yaml -o $1-out \ No newline at end of file