-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #646 from damirv/master
overridable bash and bat templates
- Loading branch information
Showing
9 changed files
with
71 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import scala.io.Source | ||
|
||
enablePlugins(JavaAppPackaging) | ||
|
||
name := "override-templates" | ||
|
||
version := "0.1.0" | ||
|
||
bashScriptTemplateLocation := baseDirectory.value / "custom-templates" / "custom-bash-template" | ||
|
||
batScriptTemplateLocation := baseDirectory.value / "custom-templates" / "custom-bat-template" | ||
|
||
TaskKey[Unit]("run-check-bash") := { | ||
val cwd = (stagingDirectory in Universal).value | ||
val source = scala.io.Source.fromFile((cwd / "bin" / packageName.value).getAbsolutePath) | ||
val contents = try source.getLines mkString "\n" finally source.close() | ||
assert(contents contains "this is the custom bash template", "Bash template didn't contain the right text: \n" + contents) | ||
} | ||
|
||
TaskKey[Unit]("run-check-bat") := { | ||
val cwd = (stagingDirectory in Universal).value | ||
val batFilename = packageName.value + ".bat" | ||
val source = scala.io.Source.fromFile((cwd / "bin" / batFilename).getAbsolutePath) | ||
val contents = try source.getLines mkString "\n" finally source.close() | ||
assert(contents contains "this is the custom bat template", "Bat template didn't contain the right text: \n" + contents) | ||
} |
3 changes: 3 additions & 0 deletions
3
src/sbt-test/bash/override-templates/custom-templates/custom-bash-template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
# this is the custom bash template |
1 change: 1 addition & 0 deletions
1
src/sbt-test/bash/override-templates/custom-templates/custom-bat-template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@REM this is the custom bat template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % sys.props("project.version")) |
3 changes: 3 additions & 0 deletions
3
src/sbt-test/bash/override-templates/src/main/scala/MainApp.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
object MainApp extends App { | ||
println("SUCCESS!") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Run the staging and check the script. | ||
> stage | ||
> run-check-bash | ||
> run-check-bat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters