Skip to content

Commit 4874d6b

Browse files
author
Jean Avila
committed
fix: validate_all.ps1 usa caminhos relativos em vez de hardcoded
- Substitui caminhos hardcoded Mestre-do-PC-V10-repo-pronto por caminhos relativos - Adiciona verificacao de seguranca para categoria cat_sec - Corrige contagem de operacoes para suportar formato array e objeto
1 parent a3fd826 commit 4874d6b

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

validate_all.ps1

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
# Validar JSON
1+
# Validar JSON — usa caminho relativo ao diretório do projeto
2+
$projectDir = Split-Path -Parent $MyInvocation.MyCommand.Path
3+
$opsFile = Join-Path $projectDir 'v10\allowed-operations.json'
24
try {
3-
$json = Get-Content 'C:\Users\Jeanc\Mestre-do-PC-V10-repo-pronto\Mestre-do-PC-V10-clean\v10\allowed-operations.json' -Raw | ConvertFrom-Json
4-
Write-Output "✅ JSON valido - operacoes: $($json.operations.Count)"
5+
$json = Get-Content $opsFile -Raw | ConvertFrom-Json
6+
$count = if ($json.operations) { $json.operations.Count } else { $json.Count }
7+
Write-Output "✅ JSON valido - operacoes: $count"
58
} catch {
69
Write-Output "❌ JSON Erro: $($_.Exception.Message)"
710
}
811

912
# Validar HTML
10-
$content = Get-Content 'C:\Users\Jeanc\Mestre-do-PC-V10-repo-pronto\Mestre-do-PC-V10-clean\v10\index.html' -Raw
13+
$htmlFile = Join-Path $projectDir 'v10\index.html'
14+
$content = Get-Content $htmlFile -Raw
1115
if ($content -match 'chmod_644') {
1216
Write-Output "✅ chmod 644 encontrado no HTML"
1317
}
@@ -21,7 +25,11 @@ Write-Output "✅ Comandos chown no HTML: $chownCount"
2125

2226
# Contar subcategorias de seguranca
2327
$secStart = $content.IndexOf('cat_sec')
24-
$secEnd = $content.IndexOf('];', $secStart)
25-
$secSection = $content.Substring($secStart, $secEnd - $secStart)
26-
$subCount = ([regex]::Matches($secSection, 'label:')).Count
27-
Write-Output "✅ Subcategorias na categoria Seguranca: $subCount"
28+
if ($secStart -ge 0) {
29+
$secEnd = $content.IndexOf('];', $secStart)
30+
$secSection = $content.Substring($secStart, $secEnd - $secStart)
31+
$subCount = ([regex]::Matches($secSection, 'label:')).Count
32+
Write-Output "✅ Subcategorias na categoria Seguranca: $subCount"
33+
} else {
34+
Write-Output "⚠️ Categoria 'cat_sec' não encontrada no HTML"
35+
}

0 commit comments

Comments
 (0)