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

Adding some assertions and corrected description in Keys #58

Merged
merged 1 commit into from
Oct 31, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/scala/com/typesafe/sbt/packager/debian/Keys.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ trait DebianKeys {
"""|Replacements of template parameters used in the upstart script.
| Default supported templates:
| author - author of this project
| descr - description
| name - normalized name of the app
| version - app version
| mainClass - main class of this app
""".stripMargin)

val debianMakeUpstartScript = TaskKey[Option[File]]("makeUpstartScript", "Creates or discovers the upstart script used by this project")
Expand Down
8 changes: 7 additions & 1 deletion test-project/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ debianPackageRecommends in Debian += "git"
//debianMakePrermScript := Some(sourceDirectory.value / "deb" / "control" / "prerm") //change defaults


TaskKey[Unit]("check-script") <<= (NativePackagerKeys.stagingDirectory in Universal, name, streams) map { (dir, name, streams) =>
TaskKey[Unit]("check-script") <<= (NativePackagerKeys.stagingDirectory in Universal, target in Debian, name, version, maintainer in Debian, streams) map {
(dir, debTarget, name, version, author, streams) =>
val script = dir / "bin" / name
System.out.synchronized {
System.err.println("---SCIRPT---")
Expand All @@ -46,5 +47,10 @@ TaskKey[Unit]("check-script") <<= (NativePackagerKeys.stagingDirectory in Univer
val output = Process("bash " + script.getAbsolutePath).!!
val expected = "SUCCESS!"
assert(output contains expected, "Failed to correctly run the main script!. Found ["+output+"] wanted ["+expected+"]")
// Check replacement
val prerm = debTarget / "DEBIAN" / "prerm"
val prermOutput = Process("bash " + prerm.getAbsolutePath).!!
val prermExpected = "removing ${{name}}-${{version}} from ${{author}}"
assert(prermOutput contains prermExpected, s"Failed to correctly run the prerm script!. Found [${prermOutput}] wanted [${prermExpected}]")
}