mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-30 01:48:12 -07:00
include() for install{}.
This commit is contained in:
parent
789c969a9b
commit
886b7a4bfa
18 changed files with 214 additions and 191 deletions
|
@ -1,8 +1,5 @@
|
|||
package com.beust.kobalt
|
||||
|
||||
import com.beust.kobalt.misc.From
|
||||
import com.beust.kobalt.misc.IncludedFile
|
||||
import com.beust.kobalt.misc.To
|
||||
import org.testng.Assert
|
||||
import org.testng.annotations.BeforeClass
|
||||
import org.testng.annotations.DataProvider
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
package com.beust.kobalt.maven
|
||||
|
||||
import com.beust.kobalt.IFileSpec
|
||||
import com.beust.kobalt.homeDir
|
||||
import com.beust.kobalt.misc.From
|
||||
import com.beust.kobalt.misc.IncludedFile
|
||||
import com.beust.kobalt.*
|
||||
import com.beust.kobalt.misc.KFiles
|
||||
import com.beust.kobalt.misc.To
|
||||
import org.testng.annotations.Test
|
||||
|
||||
@Test(enabled = false)
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
package com.beust.kobalt.misc
|
||||
|
||||
import com.beust.kobalt.From
|
||||
import com.beust.kobalt.IFileSpec
|
||||
import com.beust.kobalt.IncludedFile
|
||||
import com.beust.kobalt.To
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.testng.Assert
|
||||
import org.testng.annotations.Test
|
||||
import java.io.File
|
||||
import java.nio.file.Files
|
||||
|
||||
@Test
|
||||
class IncludedFileTest {
|
||||
|
@ -14,4 +19,28 @@ class IncludedFileTest {
|
|||
Assert.assertTrue(it.exists(), "Should exist: $it")
|
||||
}
|
||||
}
|
||||
|
||||
fun shouldRecursivelyCopy() {
|
||||
val TEXT = "I'm a file"
|
||||
val ROOT = Files.createTempDirectory("kobalt-test").toFile()
|
||||
val from = File(ROOT, "from")
|
||||
File(from, "a/b").apply { mkdirs() }
|
||||
val file = File("/a/b/foo")
|
||||
File(from, file.path).apply { writeText(TEXT) }
|
||||
val to = File(ROOT, "to").apply {
|
||||
deleteRecursively()
|
||||
mkdirs()
|
||||
}
|
||||
|
||||
val targetFile = File(to, file.path)
|
||||
assertThat(targetFile).doesNotExist()
|
||||
|
||||
KFiles.copyRecursively(from, to)
|
||||
|
||||
assertThat(to).isDirectory()
|
||||
with(targetFile) {
|
||||
assertThat(this).exists()
|
||||
assertThat(this.readText()).isEqualTo(TEXT)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package com.beust.kobalt.misc
|
||||
|
||||
import com.beust.kobalt.From
|
||||
import com.beust.kobalt.IFileSpec
|
||||
import com.beust.kobalt.IncludedFile
|
||||
import com.beust.kobalt.To
|
||||
import org.testng.Assert
|
||||
import org.testng.annotations.Test
|
||||
import javax.inject.Inject
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue