Skip to content

Commit

Permalink
removed reference to cassandraVersion in deploy once its downloaded
Browse files Browse the repository at this point in the history
  • Loading branch information
Shiti committed Apr 18, 2016
1 parent 01aa75f commit b443832
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name := "sbt-cassandra"

description := "SBT plugin to launch and use Cassandra during integration tests"

version := "1.0.2"
version := "1.0.3"

scalaVersion := "2.10.4"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ object CassandraITPlugin extends AutoPlugin {
casVersion: String,
targetDir: File,
logger: Logger): File = {
val cassandraTarGz: File = if (tarFile.trim.nonEmpty) {
val cassandraTarGz: File = if (tarFile.nonEmpty) {
file(tarFile)
} else if (casVersion.trim.nonEmpty) {
} else if (casVersion.nonEmpty) {
val file: File = new File(targetDir, s"apache-cassandra-$casVersion-bin.tar.gz")
val source = s"http://archive.apache.org/dist/cassandra/$casVersion/apache-cassandra-$casVersion-bin.tar.gz"
IO.download(url(source), file)
Expand All @@ -57,8 +57,11 @@ object CassandraITPlugin extends AutoPlugin {

if (cassandraTarGz == null) sys.error("could not load: cassandra tar.gz file.")
logger.info(s"cassandraTarGz: ${cassandraTarGz.getAbsolutePath}")
val fileName: String = cassandraTarGz.getName
val extensionIndex = fileName.indexOf(".tar.gz")
val dirName = fileName.substring(0, extensionIndex)
Process(Seq("tar", "-xzf", cassandraTarGz.getAbsolutePath), targetDir).!
val cassHome = targetDir / s"apache-cassandra-$casVersion"
val cassHome = targetDir / dirName
//old cassandra versions used log4j, newer versions use logback and are configurable through env vars
val oldLogging = cassHome / "conf" / "log4j-server.properties"
if (oldLogging.exists) {
Expand Down Expand Up @@ -189,7 +192,7 @@ object CassandraITPlugin extends AutoPlugin {
import autoImport._

lazy val cassandraITDefaultSettings: Seq[Def.Setting[_]] = Seq(
cassandraVersion:="",
cassandraVersion := "",
cassandraConfigDir := "",
cassandraCqlInit := "",
cassandraTgz := "",
Expand All @@ -208,7 +211,8 @@ object CassandraITPlugin extends AutoPlugin {
val targetDir = target.value
val logger = streams.value.log

val cassHome = deployCassandra(cassandraTgz.value, cassandraVersion.value, targetDir, logger)
val cassHome = deployCassandra(cassandraTgz.value.trim,
cassandraVersion.value.trim, targetDir, logger)

val confDir: String = {
if (cassandraConfigDir.value.trim.isEmpty) {
Expand Down

0 comments on commit b443832

Please sign in to comment.