-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrestructure.ps1
More file actions
150 lines (132 loc) · 5.21 KB
/
Copy pathrestructure.ps1
File metadata and controls
150 lines (132 loc) · 5.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# Dead Link Checker - Directory Restructuring Script
# This script organizes all project files into a clean, professional structure
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Dead Link Checker - Restructuring" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# Define new directory structure
$directories = @(
"src", # Source code
"docs", # Documentation
"build_tools", # Build scripts and configs
"assets", # Images, icons, etc.
"reports" # Reports output (keep existing)
)
# Create directories
Write-Host "Creating directory structure..." -ForegroundColor Yellow
foreach ($dir in $directories) {
if (-not (Test-Path $dir)) {
New-Item -ItemType Directory -Path $dir -Force | Out-Null
Write-Host "[OK] Created: $dir" -ForegroundColor Green
} else {
Write-Host "[SKIP] Already exists: $dir" -ForegroundColor Gray
}
}
Write-Host ""
Write-Host "Moving files to new structure..." -ForegroundColor Yellow
# Move source code files
$sourceFiles = @(
"deadlink_checker.py",
"deadlink_gui.py"
)
foreach ($file in $sourceFiles) {
if (Test-Path $file) {
Move-Item -Path $file -Destination "src\" -Force
Write-Host "[OK] Moved: $file -> src\" -ForegroundColor Green
}
}
# Move documentation files
$docFiles = @(
"README.md",
"QUICKSTART.md",
"LICENSE.txt",
"BUILD_INSTALLER.md",
"BUILD_REFERENCE.txt",
"BUILD_FIXES.md",
"INSTALLATION_GUIDE.md",
"INSTALLER_SETUP_SUMMARY.md",
"VERSIONED_FILENAME.md"
)
foreach ($file in $docFiles) {
if (Test-Path $file) {
Move-Item -Path $file -Destination "docs\" -Force
Write-Host "[OK] Moved: $file -> docs\" -ForegroundColor Green
}
}
# Move build tools
$buildFiles = @(
"build.ps1",
"build_installer.ps1",
"build_installer.bat",
"deadlink_gui.spec",
"installer_script.iss",
"version_info.txt",
"requirements.txt"
)
foreach ($file in $buildFiles) {
if (Test-Path $file) {
Move-Item -Path $file -Destination "build_tools\" -Force
Write-Host "[OK] Moved: $file -> build_tools\" -ForegroundColor Green
}
}
# Move assets
$assetFiles = @(
"sc.png",
"run_gui.bat"
)
foreach ($file in $assetFiles) {
if (Test-Path $file) {
Move-Item -Path $file -Destination "assets\" -Force
Write-Host "[OK] Moved: $file -> assets\" -ForegroundColor Green
}
}
Write-Host ""
Write-Host "Updating file references..." -ForegroundColor Yellow
# Update build_installer.ps1 to reference new paths
$buildScriptPath = "build_tools\build_installer.ps1"
if (Test-Path $buildScriptPath) {
$content = Get-Content $buildScriptPath -Raw
$content = $content -replace 'requirements\.txt', '..\build_tools\requirements.txt'
$content = $content -replace 'deadlink_gui\.spec', 'deadlink_gui.spec'
$content = $content -replace 'installer_script\.iss', 'installer_script.iss'
Set-Content -Path $buildScriptPath -Value $content
Write-Host "[OK] Updated: build_installer.ps1" -ForegroundColor Green
}
# Update deadlink_gui.spec to reference new paths
$specPath = "build_tools\deadlink_gui.spec"
if (Test-Path $specPath) {
$content = Get-Content $specPath -Raw
$content = $content -replace "\['deadlink_gui\.py'\]", "['../src/deadlink_gui.py']"
$content = $content -replace "version='version_info\.txt'", "version='version_info.txt'"
Set-Content -Path $specPath -Value $content
Write-Host "[OK] Updated: deadlink_gui.spec" -ForegroundColor Green
}
# Update installer_script.iss to reference new paths
$issPath = "build_tools\installer_script.iss"
if (Test-Path $issPath) {
$content = Get-Content $issPath -Raw
$content = $content -replace 'Source: "dist\\', 'Source: "../dist\'
$content = $content -replace 'Source: "README\.md"', 'Source: "../docs/README.md"'
$content = $content -replace 'Source: "QUICKSTART\.md"', 'Source: "../docs/QUICKSTART.md"'
$content = $content -replace 'Source: "reports\\', 'Source: "../reports\'
$content = $content -replace 'LicenseFile=LICENSE\.txt', 'LicenseFile=..\docs\LICENSE.txt'
Set-Content -Path $issPath -Value $content
Write-Host "[OK] Updated: installer_script.iss" -ForegroundColor Green
}
Write-Host ""
Write-Host "========================================" -ForegroundColor Green
Write-Host "[SUCCESS] Restructuring Complete!" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Green
Write-Host ""
Write-Host "New directory structure:" -ForegroundColor Cyan
Write-Host " src/ - Source code" -ForegroundColor Gray
Write-Host " docs/ - Documentation" -ForegroundColor Gray
Write-Host " build_tools/ - Build scripts & configs" -ForegroundColor Gray
Write-Host " assets/ - Images, icons, etc." -ForegroundColor Gray
Write-Host " reports/ - Generated reports" -ForegroundColor Gray
Write-Host ""
Write-Host "To build, run from project root:" -ForegroundColor Yellow
Write-Host " cd build_tools" -ForegroundColor Cyan
Write-Host " .\build_installer.ps1" -ForegroundColor Cyan
Write-Host ""
Read-Host "Press Enter to exit"