Files
SkyArtShop/Sky_Art_shop/quick-update.ps1

58 lines
2.1 KiB
PowerShell
Raw Normal View History

# Quick View Update - Copy changed view files without restarting site
# Run this after editing views to update live site without downtime
param(
[string]$ViewFile = ""
)
$devPath = "E:\Documents\Website Projects\Sky_Art_Shop"
$prodPath = "C:\inetpub\wwwroot\skyartshop"
if ($ViewFile) {
# Copy specific file
$sourceFile = Join-Path $devPath $ViewFile
$destFile = Join-Path $prodPath $ViewFile
if (Test-Path $sourceFile) {
$destDir = Split-Path $destFile -Parent
if (-not (Test-Path $destDir)) {
New-Item -ItemType Directory -Path $destDir -Force | Out-Null
}
Copy-Item $sourceFile $destFile -Force
Write-Host "✅ Updated: $ViewFile" -ForegroundColor Green
# Touch web.config to trigger reload without restart
$webConfig = Join-Path $prodPath "web.config"
if (Test-Path $webConfig) {
(Get-Item $webConfig).LastWriteTime = Get-Date
Write-Host "✅ Site reloaded automatically (no downtime)" -ForegroundColor Cyan
}
}
else {
Write-Host "❌ File not found: $sourceFile" -ForegroundColor Red
}
}
else {
# Sync all Views
Write-Host "🔄 Syncing all views..." -ForegroundColor Cyan
$viewsSource = Join-Path $devPath "Views"
$viewsDest = Join-Path $prodPath "Views"
if (Test-Path $viewsSource) {
Copy-Item -Path $viewsSource -Destination $prodPath -Recurse -Force
Write-Host "✅ All views synced" -ForegroundColor Green
# Touch web.config
$webConfig = Join-Path $prodPath "web.config"
if (Test-Path $webConfig) {
(Get-Item $webConfig).LastWriteTime = Get-Date
Write-Host "✅ Site reloaded automatically" -ForegroundColor Cyan
}
}
}
Write-Host "`n💡 Usage examples:" -ForegroundColor Yellow
Write-Host " .\quick-update.ps1 # Sync all views"
Write-Host " .\quick-update.ps1 'Views\Shared\_AdminLayout.cshtml' # Update specific view"