Skip to content

Commit 135dc79

Browse files
authored
Merge pull request #204 from GruppOne/correzioni-rp
Correzioni finali per la RP
2 parents 8762563 + d66ef30 commit 135dc79

36 files changed

+1386
-897
lines changed

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ __latexindent_temp.tex
290290
# ignora cartella contenente alcuni script
291291
.pwsh/scripts
292292

293-
# ignora cartella delle firme
293+
# ignora cartelle delle firme
294294
**/firme/
295295

296296
# ignora diagrammi PlantUML analisi dei requisiti
@@ -299,4 +299,6 @@ esterni/analisi-dei-requisiti/components/casi-duso/web-app/diagrams/img
299299

300300
# ignora subfolder dove teniamo le release compilate
301301
.releases/
302-
node_modules
302+
303+
# questa non so perché sia qui :/
304+
node_modules/

.pwsh/Invoke-LocalChktexAction.ps1

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#Requires -PSEdition Core
2+
[CmdletBinding(DefaultParameterSetName = "WithFolder")]
3+
param (
4+
[Parameter(Position = 0, ParameterSetName = "WithFile")]
5+
[System.IO.FileInfo[]]
6+
$files,
7+
[Parameter(Position = 0, ParameterSetName = "WithFolder")]
8+
[System.IO.DirectoryInfo]
9+
$folder = (Get-Location | Get-Item)
10+
)
11+
12+
begin {
13+
[System.IO.DirectoryInfo]$startingLocation = Get-Location | Get-Item
14+
[System.IO.DirectoryInfo]$workspaceFolder = Get-Item $PSScriptRoot/../../
15+
[string]$chktexrc = Get-Item "$workspaceFolder/.chktexrc" | Select-Object -ExpandProperty FullName
16+
}
17+
18+
process {
19+
if ($PSCmdlet.ParameterSetName -eq "WithFolder") {
20+
$files = Get-ChildItem $folder -Recurse -File -Include "*.tex"
21+
}
22+
23+
foreach ($file in $files) {
24+
Write-Verbose "Linting $file"
25+
Set-Location $file.Directory
26+
$warnings = chktex -q -l $chktexrc $file.Name
27+
28+
if ($warnings) {
29+
Write-Output "----------------------------------------"
30+
Write-Output $warnings
31+
Write-Output "----------------------------------------"
32+
}
33+
}
34+
}
35+
36+
end {
37+
Set-Location $startingLocation
38+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#Requires -PSEdition Core
2+
[CmdletBinding()]
3+
param (
4+
# search files in this path
5+
[Parameter(Position = 0)]
6+
[System.IO.DirectoryInfo]
7+
$Path = (Get-Item "."),
8+
[switch]
9+
$RemovePdfs
10+
)
11+
12+
$auxFilesFound = Get-ChildItem -Recurse -File -Include @(
13+
# if ($RemovePdfs) {
14+
# "*.pdf"
15+
# }
16+
"*.aux"
17+
"*.log"
18+
"*.lof"
19+
"*.lot"
20+
"*.out"
21+
"*.toc"
22+
"*.synctex.gz"
23+
"*.synctex(busy)"
24+
"*plantuml.latex"
25+
"*plantuml.txt"
26+
"__latexindent_temp.tex"
27+
)
28+
29+
$pdfsFound = @()
30+
31+
if ($RemovePdfs) {
32+
$pdfsFound = Get-ChildItem -Recurse -File -Include "*.pdf" |
33+
Where-Object FullName -NotMatch "\.releases"
34+
35+
Write-Output "found $($pdfsFound.Count) pdfs"
36+
}
37+
38+
$foldersFound = Get-ChildItem -Directory -Recurse -Include @(
39+
"_minted-*"
40+
)
41+
42+
$diagramsFoldersFound = Get-ChildItem -Directory -Recurse -Include "img" |
43+
Where-Object { (Split-Path -Parent $_) -match "diagrams" }
44+
45+
Write-Output "found $($auxFilesFound.count) auxiliary files and $($foldersFound.count) folders"
46+
47+
if ($pdfsFound) {
48+
Remove-Item -Verbose $pdfsFound
49+
}
50+
51+
if ($auxFilesFound) {
52+
Remove-Item -Verbose $auxFilesFound
53+
}
54+
55+
if ($foldersFound) {
56+
Remove-Item -Recurse -Verbose $foldersFound
57+
}
58+
59+
if ($diagramsFoldersFound) {
60+
Remove-Item -Recurse -Verbose $diagramsFoldersFound
61+
}
62+
63+
# Get-ChildItem -Recurse -Directory -LiteralPath $Path |
64+
# Where-Object { -not $_.GetFiles("*", "AllDirectories") } |
65+
# Remove-Item -Recurse
Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
#Requires -PSEdition Core
2+
[CmdletBinding()]
3+
param (
4+
[String]
5+
$ReleaseBaseName = "GruppOne-Stalker",
6+
[String]
7+
$VersionBuildMetadata
8+
)
9+
10+
try {
11+
java -version | Out-Null
12+
}
13+
catch [System.Management.Automation.CommandNotFoundException] {
14+
throw "java is not available on PATH"
15+
}
16+
17+
if (-not $env:PLANTUML_JAR) {
18+
throw "environment variable PLANTUML_JAR is not set"
19+
}
20+
21+
try {
22+
lualatex -v | Out-Null
23+
}
24+
catch [System.Management.Automation.CommandNotFoundException] {
25+
throw "lualatex is not available on PATH"
26+
}
27+
28+
$lualatexCommand = {
29+
[CmdletBinding()]
30+
param(
31+
# LaTeX file to build
32+
[Parameter(Position = 0, Mandatory = $true)]
33+
[String]
34+
$sourceFilename,
35+
# LaTeX file to build
36+
[Parameter(Position = 1, Mandatory = $true)]
37+
[String]
38+
$destinationFilename
39+
)
40+
[System.IO.FileInfo]$sourceFile = Get-Item -LiteralPath $sourceFilename
41+
$compiledSourceFilename = $sourceFile.FullName -replace "\.tex$", ".pdf"
42+
43+
Set-Location $sourceFile.Directory
44+
45+
lualatex `
46+
--interaction=nonstopmode `
47+
--file-line-error `
48+
--shell-escape `
49+
$sourceFile.Name
50+
51+
if ($LASTEXITCODE) {
52+
Write-Error "something went wrong while compiling $($sourceFile) "
53+
}
54+
55+
if (-not (Test-Path $compiledSourceFilename)) {
56+
throw "no output produced"
57+
}
58+
59+
lualatex `
60+
--interaction=nonstopmode `
61+
--file-line-error `
62+
--shell-escape `
63+
$sourceFile.Name
64+
65+
$compiledSource = Get-Item -LiteralPath $compiledSourceFilename
66+
Copy-Item -Force $compiledSource $destinationFilename
67+
}
68+
69+
Write-Output "building PlantUML diagrams"
70+
71+
$rawOut = java -jar ${env:PLANTUML_JAR} `
72+
-progress `
73+
-failfast `
74+
-checkmetadata `
75+
-charset "UTF-8" `
76+
-x "**/commons/style/*.pu" `
77+
-o "img" `
78+
"**/diagrams/*.pu"
79+
80+
Write-Output "`n--------------------------"
81+
82+
if ($LASTEXITCODE -and $rawOut -notmatch "No diagram found") {
83+
throw "something went wrong while exporting UML diagrams"
84+
}
85+
86+
$productVersion = (
87+
Get-Item -LiteralPath "commons/template.tex" |
88+
Select-String -Pattern "^\\setVersione{\d+\.\d+\.\d+}$" |
89+
Select-Object -ExpandProperty Line
90+
) -replace "^\\setVersione{" -replace "}$"
91+
92+
if (-not $productVersion) {
93+
throw "Product version was not found"
94+
}
95+
96+
$ReleaseName = $ReleaseBaseName + "_" + "$productVersion"
97+
if ($VersionBuildMetadata) {
98+
$ReleaseName += "+" + $VersionBuildMetadata
99+
}
100+
101+
$OutputBaseDirectory = "$(Get-Location)/.releases/$ReleaseName"
102+
103+
if (-not (Test-Path $OutputBaseDirectory)) {
104+
Write-Output "created destination folder $OutputBaseDirectory"
105+
New-Item -ItemType Directory $OutputBaseDirectory
106+
107+
New-Item -ItemType Directory "$OutputBaseDirectory/esterni"
108+
New-Item -ItemType Directory "$OutputBaseDirectory/esterni/verbali"
109+
New-Item -ItemType Directory "$OutputBaseDirectory/interni"
110+
New-Item -ItemType Directory "$OutputBaseDirectory/interni/verbali"
111+
}
112+
113+
# this is horrible
114+
$documents = @(
115+
[PSCustomObject]@{
116+
SourceFile = Get-Item "esterni/analisi-dei-requisiti/analisi-dei-requisiti.tex"
117+
Destination = [IO.Path]::Combine($OutputBaseDirectory, "esterni", "analisi-dei-requisiti_v$productVersion.pdf")
118+
},
119+
[PSCustomObject]@{
120+
SourceFile = Get-Item "esterni/glossario/glossario.tex"
121+
Destination = [IO.Path]::Combine($OutputBaseDirectory, "esterni", "glossario_v$productVersion.pdf")
122+
},
123+
[PSCustomObject]@{
124+
SourceFile = Get-Item "esterni/piano-di-progetto/piano-di-progetto.tex"
125+
Destination = [IO.Path]::Combine($OutputBaseDirectory, "esterni", "piano-di-progetto_v$productVersion.pdf")
126+
},
127+
[PSCustomObject]@{
128+
SourceFile = Get-Item "esterni/piano-di-qualifica/piano-di-qualifica.tex"
129+
Destination = [IO.Path]::Combine($OutputBaseDirectory, "esterni", "piano-di-qualifica_v$productVersion.pdf")
130+
},
131+
[PSCustomObject]@{
132+
SourceFile = Get-Item "interni/norme-di-progetto/norme-di-progetto.tex"
133+
Destination = [IO.Path]::Combine($OutputBaseDirectory, "interni", "norme-di-progetto_v$productVersion.pdf")
134+
},
135+
# [PSCustomObject]@{
136+
# SourceFile = Get-Item "interni/studio-di-fattibilita/studio-di-fattibilita.tex"
137+
# Destination = [IO.Path]::Combine($OutputBaseDirectory, "interni", "studio-di-fattibilita_v$productVersion.pdf")
138+
# },
139+
[PSCustomObject]@{
140+
SourceFile = Get-Item "lettera-di-presentazione/lettera-di-presentazione.tex"
141+
Destination = [IO.Path]::Combine($OutputBaseDirectory, "lettera-di-presentazione.pdf")
142+
}
143+
)
144+
145+
$meetingNotes = Get-ChildItem -Path "esterni/verbali", "interni/verbali" -File -Recurse |
146+
Where-Object Name -match "verbale-(esterno|interno)_\d{4}-\d{2}-\d{2}\.tex" | ForEach-Object {
147+
148+
$extOrInt = $_ | Split-Path -Parent | Split-Path -Parent | Split-Path -Leaf
149+
150+
return [PSCustomObject]@{
151+
SourceFile = $_
152+
Destination = [IO.Path]::Combine($OutputBaseDirectory, $extOrInt, "verbali", ($_.Name -replace "\.tex", ".pdf"))
153+
}
154+
}
155+
156+
$allDocuments = $documents + $meetingNotes
157+
158+
Write-Output "Found $($documents.Length) documents and $($meetingNotes.Length) meeting notes"
159+
Write-Output "Current product version is $productVersion"
160+
161+
$build = $allDocuments | ForEach-Object {
162+
$jobArguments = [ordered]@{
163+
Name = "compiling latex file $($_.SourceFile.Name)"
164+
ScriptBlock = $lualatexCommand
165+
ArgumentList = @(
166+
$_.SourceFile.FullName
167+
$_.Destination
168+
)
169+
}
170+
171+
Start-Job @jobArguments
172+
}
173+
174+
$build.Name
175+
176+
Receive-Job -Wait -AutoRemoveJob $build | Out-Null
177+
178+
## This section allows to exit gracefully, terminating incomplete jobs
179+
180+
# # Change the default behavior of CTRL-C so that the script can intercept and use it versus just terminating the script.
181+
# [Console]::TreatControlCAsInput = $True
182+
# # Sleep for 1 second and then flush the key buffer so any previously pressed keys are discarded and the loop can monitor for the use of CTRL-C. The sleep command ensures the buffer flushes correctly.
183+
# Start-Sleep -Seconds 1
184+
# $Host.UI.RawUI.FlushInputBuffer()
185+
186+
# # Continue to loop while there running jobs.
187+
# While ((Get-Job $build | Where-Object State -Match Running)) {
188+
# # If a key was pressed during the loop execution, check to see if it was CTRL-C (aka "3"), and if so exit the script after clearing out any running jobs and setting CTRL-C back to normal.
189+
# If ($Host.UI.RawUI.KeyAvailable -and ($Key = $Host.UI.RawUI.ReadKey("AllowCtrlC,NoEcho,IncludeKeyUp"))) {
190+
# If ([Int]$Key.Character -eq 3) {
191+
# Write-Host ""
192+
# Write-Warning "CTRL-C was used - Shutting down any running jobs before exiting the script."
193+
# Remove-Job $build -Force -Confirm:$False
194+
195+
# [Console]::TreatControlCAsInput = $False
196+
# _Exit-Script -HardExit $True
197+
# }
198+
199+
# # Flush the key buffer again for the next loop.
200+
# $Host.UI.RawUI.FlushInputBuffer()
201+
# }
202+
203+
# # Perform other work here such as process pending jobs or process out current jobs.
204+
# }
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Get-Job "compiling latex file*" |
2+
Stop-Job -PassThru |
3+
Remove-Job
-1.41 KB
Loading

commons/template.tex

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
\setVersione{0.2.4}
1+
\setVersione{0.3.0}
22

33
\thispagestyle{empty}
44
\pagenumbering{gobble}
@@ -42,20 +42,28 @@
4242
\newpage
4343
\pagestyle{nopage}
4444

45+
\setcounter{table}{-1}
46+
4547
\section*{Registro delle modifiche}%
4648
\label{sec:registro_delle_modifiche}
4749

50+
\newcommand{\rowcolorOne}{\rowcolor{white!80!lightgray!100}}
51+
\newcommand{\rowcolorTwo}{\rowcolor{lightgray} }
52+
4853
\rowcolors{2}{lightgray}{white!80!lightgray!100}
4954
\renewcommand{\arraystretch}{2} % allarga le righe con dello spazio sotto e sopra
50-
\begin{longtable}[H]{>{\centering\bfseries}m{2cm} >{\centering}m{5cm} >{\centering}m{2.5cm} >{\centering\arraybackslash}m{6.5cm}}
51-
\caption{Registro delle modifiche}%
52-
\label{tab:registro_delle_modifiche} \\
55+
\begin{longtable}[H]{|>{\centering\bfseries}m{2cm} >{\centering}m{5cm} >{\centering}m{2.5cm} >{\centering\arraybackslash}m{6.5cm}|}
5356
\rowcolor{darkgray!90!}
5457
\color{white}{\textbf{Versione}} & \color{white}{\textbf{Nominativo}} & \color{white}{\textbf{Data}} & \color{white}{\textbf{Descrizione}} \\
5558
\endfirsthead%
5659
\rowcolor{darkgray!90!}
5760
\color{white}{\textbf{Versione}} & \color{white}{\textbf{Nominativo}} & \color{white}{\textbf{Data}} & \color{white}{\textbf{Descrizione}} \\
5861
\endhead%
62+
\rowcolor{white}%
63+
\multicolumn{4}{r}{\textit{Continua alla pagina seguente}}
64+
\endfoot%
65+
\hline % chktex 44
66+
\endlastfoot%
5967
\modifiche{}%
6068
\end{longtable}
6169
% section registro_delle_modifiche (end)

0 commit comments

Comments
 (0)