Skip to content

Commit 84850ce

Browse files
feat: Build Exclusions ( Fixes #127 )
1 parent 8878fbc commit 84850ce

File tree

3 files changed

+36
-16
lines changed

3 files changed

+36
-16
lines changed

4bitcss.com/build.ps1

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ foreach ($underbarDirectory in Get-ChildItem -Path $site.PSScriptRoot -Filter _*
4343
}
4444

4545
$propertyName = $hierarchy[-1] -replace '_'
46-
$getFile = @{LiteralPath=$siteFile.FullName}
46+
$getFile = @{LiteralPath=$underbarFile.FullName}
4747
$fileData =
4848
switch -regex ($underbarFile.Extension) {
4949
'\.ps1$' { $ExecutionContext.SessionState.InvokeCommand.GetCommand($underbarFile.FullName, 'ExternalScript') }
@@ -75,6 +75,14 @@ foreach ($file in $functionFiles) {
7575
}
7676
#endregion Common Functions and Filters
7777

78+
if (-not $site.Exclude) {
79+
$site.Exclude = [Ordered]@{
80+
Pattern = @($functionPattern)
81+
Wildcard = @("*.turtle.ps1")
82+
}
83+
84+
}
85+
7886
# Set an alias to buildPage.ps1
7987
Set-Alias BuildPage ./buildPage.ps1
8088

4bitcss.com/buildPage.ps1

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,14 @@ if (-not $site.PagesByUrl) {
2828
}
2929
$pagesByUrl = $site.PagesByUrl
3030

31+
$site.FilesProcessed = $filesProcessed = [Ordered]@{}
3132
$site.FileQueue = $fileQueue = [Collections.Queue]::new()
3233
foreach ($file in $allFiles) { $fileQueue.Enqueue($file) }
3334

3435
:nextFile while ($fileQueue.Count) {
3536
$file = $fileQueue.Dequeue()
37+
if ($filesProcessed[$file.FullName]) { continue }
38+
if ($file.FullName -match '[\//]_') { continue }
3639
if ($Site -and $Site.Exclude) {
3740
$included = $false
3841
:exclude do {
@@ -54,7 +57,11 @@ foreach ($file in $allFiles) { $fileQueue.Enqueue($file) }
5457
}
5558
$included = $true
5659
} until ($included)
60+
if (-not $included) {
61+
continue nextFile
62+
}
5763
}
64+
$filesProcessed[$file.FullName] = $true
5865
$fileRoot = $file.Directory.FullName
5966
Push-Location $fileRoot
6067
# Get the file name by removing the extension.
@@ -404,20 +411,23 @@ foreach ($file in $allFiles) { $fileQueue.Enqueue($file) }
404411
$outputFiles
405412
} else {
406413
# otherwise, we'll save output to a file.
414+
if (-not $output) {
415+
$null = $null
416+
} else {
417+
# If the file does not exists
418+
if (-not (Test-Path -Path $outFile)) {
419+
# create an empty file.
420+
$null = New-Item -Path $outFile -ItemType File -Force
421+
}
407422

408-
# If the file does not exists
409-
if (-not (Test-Path -Path $outFile)) {
410-
# create an empty file.
411-
$null = New-Item -Path $outFile -ItemType File -Force
412-
}
413-
414-
$output > $outFile
415-
# and if that worked,
416-
if ($?) {
417-
# output the file.
418-
$page.OutputFile = Get-Item -Path $outFile
419-
$page.OutputFile
420-
}
423+
$output > $outFile
424+
# and if that worked,
425+
if ($?) {
426+
# output the file.
427+
$page.OutputFile = Get-Item -Path $outFile
428+
$page.OutputFile
429+
}
430+
}
421431
}
422432
#endregion Output
423433

4bitcss.com/config.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,11 @@ $Site.Logo = Get-Content -Path ../Assets/4bitcss.svg
120120
type = 'rotate' ; values = 0, 360 ;repeatCount = 'indefinite'; dur = "31s"; additive = 'sum'; id ='rotate-logo'
121121
} #>
122122

123+
$Site.NoIndex = $true
124+
123125
$site.Taskbar = [Ordered]@{
124-
'BlueSky' = 'https://bsky.app/profile/psturtle.com'
125-
'GitHub' = 'https://github.com/PowerShellWeb/Turtle'
126+
# 'BlueSky' = 'https://bsky.app/profile/psturtle.com'
127+
'GitHub' = 'https://github.com/2bitdesigns/4bitcss'
126128
'RSS' = 'https://psturtle.com/RSS/index.rss'
127129
<#'Help' = @(
128130

0 commit comments

Comments
 (0)