lösche dumme powershell scripte
This commit is contained in:
1 parent
6ef38aa7d2
commit
de5895f558
2 files changed
-77
No files matched your search
@@ -1,45 +0,0 @@
|
||||
[CmdletBinding()]
|
||||
param()
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$projectRoot = Split-Path -Parent $PSScriptRoot
|
||||
$perspektivwerkSource = Join-Path $projectRoot 'public/perspektivwerk'
|
||||
$remoteTarget = 'boogie:/home/boogie/html/perspektivwerk/'
|
||||
|
||||
if (-not (Test-Path -LiteralPath $perspektivwerkSource -PathType Container)) {
|
||||
throw "Der zu übertragende Ordner '$perspektivwerkSource' wurde nicht gefunden."
|
||||
}
|
||||
|
||||
$sourceItems = @(Get-ChildItem -LiteralPath $perspektivwerkSource -Force)
|
||||
if ($sourceItems.Count -eq 0) {
|
||||
throw "Der zu übertragende Ordner '$perspektivwerkSource' enthält keine Dateien."
|
||||
}
|
||||
|
||||
if (-not (Get-Command scp -ErrorAction SilentlyContinue)) {
|
||||
throw 'OpenSSH scp wurde nicht gefunden. Installiere den OpenSSH-Client oder füge ihn zum PATH hinzu.'
|
||||
}
|
||||
|
||||
if (-not (Get-Command ssh -ErrorAction SilentlyContinue)) {
|
||||
throw 'OpenSSH ssh wurde nicht gefunden. Installiere den OpenSSH-Client oder füge ihn zum PATH hinzu.'
|
||||
}
|
||||
|
||||
Write-Host 'Zielverzeichnisse auf dem Server:'
|
||||
Write-Host " $perspektivwerkSource\* -> $remoteTarget"
|
||||
|
||||
Write-Host "Übertrage ausschließlich die statische Perspektivwerk-Seite nach $remoteTarget"
|
||||
Write-Host 'SCP-Upload und anschließende Rechtekorrektur benötigen jeweils eine SSH-Verbindung.'
|
||||
|
||||
& scp -r @sourceItems $remoteTarget
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Der Upload nach '$remoteTarget' ist fehlgeschlagen (scp Exit-Code $LASTEXITCODE)."
|
||||
}
|
||||
|
||||
Write-Host 'Setze Lese- und Durchsuchrechte auf dem hochgeladenen Ordner.'
|
||||
& ssh boogie 'chmod -R a+rX /home/boogie/html/perspektivwerk'
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Der Upload war erfolgreich, aber die Rechtekorrektur ist fehlgeschlagen (ssh Exit-Code $LASTEXITCODE)."
|
||||
}
|
||||
|
||||
Write-Host 'Upload und Rechtekorrektur abgeschlossen: /home/boogie/html/perspektivwerk/ (inklusive js/booking.js).'
|
||||
@@ -1,32 +0,0 @@
|
||||
$projectRoot = Split-Path -Parent $PSScriptRoot
|
||||
$deployScriptPath = Join-Path $projectRoot 'scripts\Deploy-Perspektivwerk.ps1'
|
||||
|
||||
Describe 'Perspektivwerk deployment' {
|
||||
It 'provides a deployment script for the static page' {
|
||||
(Test-Path -LiteralPath $deployScriptPath) | Should Be $true
|
||||
}
|
||||
|
||||
It 'uploads the static page and its nested booking assets with one scp invocation' {
|
||||
$script = Get-Content -LiteralPath $deployScriptPath -Raw
|
||||
|
||||
$script | Should Match 'public[\\/]perspektivwerk'
|
||||
$script | Should Not Match 'public[\\/]booking'
|
||||
$script | Should Match 'boogie:/home/boogie/html/perspektivwerk/'
|
||||
([regex]::Matches($script, '& scp')).Count | Should Be 1
|
||||
$script | Should Not Match '& rsync'
|
||||
}
|
||||
|
||||
It 'repairs read and traversal permissions with a separate SSH invocation' {
|
||||
$script = Get-Content -LiteralPath $deployScriptPath -Raw
|
||||
|
||||
([regex]::Matches($script, '& ssh')).Count | Should Be 1
|
||||
$script | Should Match 'chmod -R a\+rX /home/boogie/html/perspektivwerk'
|
||||
}
|
||||
|
||||
It 'prints the complete static-page target directory' {
|
||||
$script = Get-Content -LiteralPath $deployScriptPath -Raw
|
||||
|
||||
$script | Should Match 'Zielverzeichnisse auf dem Server'
|
||||
$script | Should Match 'boogie:/home/boogie/html/perspektivwerk/'
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user