rename parameters createSymlink
This commit is contained in:
parent
a881310f48
commit
eb514fb8aa
2 changed files with 13 additions and 13 deletions
|
@ -341,20 +341,20 @@ fun Prov.deleteDir(dir: String, path: String, sudo: Boolean = false): ProvResult
|
||||||
* Creates and validates a symlink.
|
* Creates and validates a symlink.
|
||||||
*/
|
*/
|
||||||
fun Prov.createSymlink(
|
fun Prov.createSymlink(
|
||||||
source: File,
|
originalFile: File,
|
||||||
target: File,
|
link: File,
|
||||||
sudo: Boolean = false,
|
sudo: Boolean = false,
|
||||||
overwriteIfExisting: Boolean = true,
|
overwriteIfExisting: Boolean = true,
|
||||||
createTargetDirIfMissing: Boolean = true,
|
createLinkDirIfMissing: Boolean = true,
|
||||||
): ProvResult = task {
|
): ProvResult = task {
|
||||||
if (createTargetDirIfMissing) {
|
if (createLinkDirIfMissing) {
|
||||||
createParentDir(target, sudo)
|
createParentDir(link, sudo)
|
||||||
}
|
}
|
||||||
val overwriteFlag = if (overwriteIfExisting) "f" else ""
|
val overwriteFlag = if (overwriteIfExisting) "f" else ""
|
||||||
cmd("ln -s$overwriteFlag $source $target", sudo = sudo)
|
cmd("ln -s$overwriteFlag $originalFile $link", sudo = sudo)
|
||||||
// ensure link works
|
// ensure link works
|
||||||
taskWithResult("validate link") {
|
taskWithResult("validate link") {
|
||||||
ProvResult(checkFile(target.toString(), sudo = sudo))
|
ProvResult(checkFile(link.toString(), sudo = sudo))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -415,8 +415,8 @@ internal class FilesystemKtTest {
|
||||||
fun test_createLink_without_dir() {
|
fun test_createLink_without_dir() {
|
||||||
// given
|
// given
|
||||||
val prov = defaultTestContainer()
|
val prov = defaultTestContainer()
|
||||||
val source = File("testlinksource")
|
val source = File("testoriginalfile")
|
||||||
val target = File("testlinktarget")
|
val target = File("testlink")
|
||||||
prov.createFile(source.toString(), "textinlinkfile")
|
prov.createFile(source.toString(), "textinlinkfile")
|
||||||
|
|
||||||
// when
|
// when
|
||||||
|
@ -436,8 +436,8 @@ internal class FilesystemKtTest {
|
||||||
fun test_createLink_with_dirs() {
|
fun test_createLink_with_dirs() {
|
||||||
// given
|
// given
|
||||||
val prov = defaultTestContainer()
|
val prov = defaultTestContainer()
|
||||||
val source = File("~/linksourcedir/testlinksource2")
|
val source = File("~/linkoriginalfiledir/testoriginalfile2")
|
||||||
val target = File("linkdir1/linkdir2/testlinktarget2")
|
val target = File("linkdir1/linkdir2/testlink2")
|
||||||
prov.createFile(source.toString(), "textinlinkfile2")
|
prov.createFile(source.toString(), "textinlinkfile2")
|
||||||
|
|
||||||
// when
|
// when
|
||||||
|
@ -457,8 +457,8 @@ internal class FilesystemKtTest {
|
||||||
fun test_createLink_with_dirs_and_sudo() {
|
fun test_createLink_with_dirs_and_sudo() {
|
||||||
// given
|
// given
|
||||||
val prov = defaultTestContainer()
|
val prov = defaultTestContainer()
|
||||||
val source = File("/linksourcedirsudo/linksourcefilesudo")
|
val source = File("~/linkoriginalfiledirsudo/testoriginalfilesudo")
|
||||||
val target = File("/linkdir1sudo/linkdir2sudo/linksudo")
|
val target = File("linkdir1sudo/linkdir2sudo/testlinksudo")
|
||||||
prov.createFile(source.toString(), "textinlinkfilesudo", sudo = true)
|
prov.createFile(source.toString(), "textinlinkfilesudo", sudo = true)
|
||||||
|
|
||||||
// when
|
// when
|
||||||
|
|
Loading…
Reference in a new issue