Initial commit
This commit is contained in:
commit
3cba772836
1341 changed files with 532924 additions and 0 deletions
66
#alt_skripte/resore_renv.ps1
Normal file
66
#alt_skripte/resore_renv.ps1
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
# Basisordner, in dem alle Shiny App Unterordner liegen
|
||||
$baseDir = "C:\Users\johnn\Desktop\formr"
|
||||
|
||||
# Voller Pfad zu Rscript.exe
|
||||
$rscriptExe = "C:\Program Files\R\R-4.6.0\bin\x64\Rscript.exe"
|
||||
|
||||
# Logdatei für die Ergebnisse
|
||||
$logFile = Join-Path $baseDir "renv_restore_log.txt"
|
||||
"Start: $(Get-Date)" | Out-File -FilePath $logFile
|
||||
|
||||
# Alle Unterordner finden, die eine renv.lock enthalten
|
||||
$appFolders = Get-ChildItem -Path $baseDir -Recurse -Filter "renv.lock" |
|
||||
ForEach-Object { $_.Directory.FullName } |
|
||||
Sort-Object -Unique
|
||||
|
||||
Write-Host "Gefundene Apps mit renv.lock: $($appFolders.Count)"
|
||||
|
||||
$erfolgreich = @()
|
||||
$fehlgeschlagen = @()
|
||||
|
||||
foreach ($folder in $appFolders) {
|
||||
Write-Host "Bearbeite: $folder"
|
||||
"----" | Out-File -FilePath $logFile -Append
|
||||
"App: $folder" | Out-File -FilePath $logFile -Append
|
||||
|
||||
# R Befehl als Einzeiler, escaped für Rscript -e
|
||||
$rCommand = "renv::restore(project = '$($folder -replace '\\','/')', prompt = FALSE)"
|
||||
|
||||
$output = & $rscriptExe -e $rCommand 2>&1
|
||||
$output | Out-File -FilePath $logFile -Append
|
||||
|
||||
# Grobe Erfolgsprüfung: enthält die Ausgabe Fehlerhinweise?
|
||||
$hatFehler = $output -match "Error|error in|konnte nicht|es gibt kein Paket"
|
||||
|
||||
if ($hatFehler) {
|
||||
"Status: FEHLER" | Out-File -FilePath $logFile -Append
|
||||
$fehlgeschlagen += $folder
|
||||
} else {
|
||||
"Status: OK" | Out-File -FilePath $logFile -Append
|
||||
$erfolgreich += $folder
|
||||
}
|
||||
}
|
||||
|
||||
"Ende: $(Get-Date)" | Out-File -FilePath $logFile -Append
|
||||
|
||||
# Zusammenfassung
|
||||
Write-Host ""
|
||||
Write-Host "===== Zusammenfassung ====="
|
||||
Write-Host "Gesamt: $($appFolders.Count)"
|
||||
Write-Host "Erfolgreich: $($erfolgreich.Count)"
|
||||
Write-Host "Fehlgeschlagen: $($fehlgeschlagen.Count)"
|
||||
|
||||
if ($fehlgeschlagen.Count -gt 0) {
|
||||
Write-Host ""
|
||||
Write-Host "Fehlgeschlagene Ordner:"
|
||||
$fehlgeschlagen | ForEach-Object { Write-Host " - $_" }
|
||||
}
|
||||
|
||||
"===== Zusammenfassung =====" | Out-File -FilePath $logFile -Append
|
||||
"Gesamt: $($appFolders.Count)" | Out-File -FilePath $logFile -Append
|
||||
"Erfolgreich: $($erfolgreich.Count)" | Out-File -FilePath $logFile -Append
|
||||
"Fehlgeschlagen: $($fehlgeschlagen.Count)" | Out-File -FilePath $logFile -Append
|
||||
$fehlgeschlagen | Out-File -FilePath $logFile -Append
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Fertig. Log unter: $logFile"
|
||||
Loading…
Add table
Add a link
Reference in a new issue