Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

create a cleanup task for gemerator

  • Loading branch information...
commit 2f8cf06d2abe81d5105879beb7af1dcdbaf7dea7 1 parent b4adea5
@sprsquish authored
Showing with 12 additions and 2 deletions.
  1. +12 −2 src/main/scala/com/twitter/sbt/ThriftGemerator.scala
View
14 src/main/scala/com/twitter/sbt/ThriftGemerator.scala
@@ -53,6 +53,7 @@ class ThriftGem(
case None => {
val exitCode = (Process("gem build " + name + ".gemspec", basePath) !)
if (exitCode == 0) {
+ FileUtilities.createDirectory(targetPath, log)
(basePath / (gemName + ".gem")).asFile.renameTo((targetPath / (gemName + ".gem")).asFile)
None
} else {
@@ -63,11 +64,14 @@ class ThriftGem(
}
}
- def test() =
+ def test() = {
testFramework.map(_.test(basePath, log)).getOrElse(None)
+ }
- def release() =
+ def release() = {
+ FileUtilities.createDirectory(targetPath, log)
repository.release(gemName + ".gem", targetPath, log)
+ }
import scala.collection.mutable
import java.io.File
@@ -321,6 +325,12 @@ trait ThriftGemerator extends CompileThriftRuby {
override def updateAction = gemerate dependsOn(super.updateAction)
+ lazy val cleanGem = (
+ cleanTask(gem.targetPath) && cleanTask(gem.thriftPath ** "*.rb")
+ ) describedAs("Clean generated gem folders")
+
+ override def cleanAction = super.cleanAction dependsOn(cleanGem)
+
lazy val buildGem = task {
gem.build()
} dependsOn(compileThriftRuby) describedAs("Build the gem")
Please sign in to comment.
Something went wrong with that request. Please try again.