Created
April 11, 2014 14:43
SBT task to create version.txt
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
lazy val branchName = settingKey[String]("The name of the Github branch which will prefix the RPM") | |
branchName := sys.props.getOrElse("branchName", sys.env.getOrElse("branchName", "master")) | |
lazy val rpmPrepare = taskKey[Unit]("Executes steps which are needed before the RPM can be build") | |
rpmPrepare := { | |
val dir = Paths.get("build") | |
val versionFile = dir.resolve("version.txt") | |
Files.deleteIfExists(versionFile) | |
Files.createFile(versionFile) | |
Some(new PrintWriter(versionFile.toFile)).foreach{p => p.write("%s_%s".format(branchName.value, version.value)); p.close()} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment