From 714893319f4d131a0b7261bb1a92212cd6863916 Mon Sep 17 00:00:00 2001 From: Nepomuk Seiler Date: Thu, 31 Oct 2013 16:38:51 +0100 Subject: [PATCH] Adding some assertions and corrected description in Keys --- .../scala/com/typesafe/sbt/packager/debian/Keys.scala | 2 +- test-project/build.sbt | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/scala/com/typesafe/sbt/packager/debian/Keys.scala b/src/main/scala/com/typesafe/sbt/packager/debian/Keys.scala index aaecfb525..66da9378b 100644 --- a/src/main/scala/com/typesafe/sbt/packager/debian/Keys.scala +++ b/src/main/scala/com/typesafe/sbt/packager/debian/Keys.scala @@ -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") diff --git a/test-project/build.sbt b/test-project/build.sbt index 1562bab75..714381ac2 100644 --- a/test-project/build.sbt +++ b/test-project/build.sbt @@ -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---") @@ -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}]") }