Update windows deploy script
This commit is contained in:
34
deploy.ps1
34
deploy.ps1
@@ -7,10 +7,40 @@
|
|||||||
# .\deploy.ps1 C:\path\to\luxtools
|
# .\deploy.ps1 C:\path\to\luxtools
|
||||||
# .\deploy.ps1 --no-delete # don't delete extraneous files at target
|
# .\deploy.ps1 --no-delete # don't delete extraneous files at target
|
||||||
|
|
||||||
$TARGET = "S:\Web\lib\plugins\luxtools"
|
$TARGET = "S:\7-Infrastructure\lib\plugins\luxtools"
|
||||||
$DRY_RUN = $false
|
$DRY_RUN = $false
|
||||||
$DELETE = $true
|
$DELETE = $true
|
||||||
|
|
||||||
|
function Resolve-PathUsingExistingCase {
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]$Path
|
||||||
|
)
|
||||||
|
|
||||||
|
$fullPath = [System.IO.Path]::GetFullPath($Path)
|
||||||
|
$root = [System.IO.Path]::GetPathRoot($fullPath).TrimEnd('\\')
|
||||||
|
|
||||||
|
if ($fullPath.TrimEnd('\\') -ieq $root) {
|
||||||
|
return $root
|
||||||
|
}
|
||||||
|
|
||||||
|
$parent = Split-Path -Path $fullPath -Parent
|
||||||
|
$leaf = Split-Path -Path $fullPath -Leaf
|
||||||
|
$resolvedParent = Resolve-PathUsingExistingCase -Path $parent
|
||||||
|
|
||||||
|
if (Test-Path -LiteralPath $resolvedParent) {
|
||||||
|
$match = Get-ChildItem -LiteralPath $resolvedParent -Force -ErrorAction SilentlyContinue |
|
||||||
|
Where-Object { $_.Name -ieq $leaf } |
|
||||||
|
Select-Object -First 1
|
||||||
|
|
||||||
|
if ($null -ne $match) {
|
||||||
|
return (Join-Path -Path $resolvedParent -ChildPath $match.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (Join-Path -Path $resolvedParent -ChildPath $leaf)
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($arg in $args) {
|
foreach ($arg in $args) {
|
||||||
if ($arg -eq "--dry-run" -or $arg -eq "-n") {
|
if ($arg -eq "--dry-run" -or $arg -eq "-n") {
|
||||||
$DRY_RUN = $true
|
$DRY_RUN = $true
|
||||||
@@ -30,6 +60,8 @@ foreach ($arg in $args) {
|
|||||||
$TARGET = $arg
|
$TARGET = $arg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$TARGET = Resolve-PathUsingExistingCase -Path $TARGET
|
||||||
|
|
||||||
$SRC_DIR = $PSScriptRoot
|
$SRC_DIR = $PSScriptRoot
|
||||||
|
|
||||||
# Safety checks: make sure source looks like luxtools plugin
|
# Safety checks: make sure source looks like luxtools plugin
|
||||||
|
|||||||
Reference in New Issue
Block a user