Skip to content

Commit

Permalink
Added more debug outputs across all functions
Browse files Browse the repository at this point in the history
  • Loading branch information
techthoughts2 committed Dec 8, 2024
1 parent ccaf15e commit df9c06e
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"powershell"
],
"cSpell.words": [
"gldata",
"jakemorrison",
"Pscx",
"shortcode"
Expand Down
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Module Changes
- Updated to use Unicode Version: 16.0 (was previously Unicode Version: 15.1)
- Added more debug outputs across all functions
- Build Updates
- Improved integration tests
- Updated tests to follow Pester 5 rules
Expand Down
3 changes: 3 additions & 0 deletions src/pwshEmojiExplorer/Private/Confirm-DataLocation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function Confirm-DataLocation {
)
$result = $true #assume the best
Write-Verbose -Message 'Verifying data set output location...'
Write-Debug -Message ('Data path: {0}' -f $script:dataPath)
try {
$pathEval = Test-Path -Path $script:dataPath -ErrorAction Stop
}
Expand All @@ -29,6 +30,8 @@ function Confirm-DataLocation {
return $result
}

Write-Debug -Message ('Path evaluation: {0}' -f $pathEval)

if (-not ($pathEval)) {
Write-Verbose -Message 'Creating output directory...'
try {
Expand Down
8 changes: 8 additions & 0 deletions src/pwshEmojiExplorer/Private/Confirm-MetadataUpdate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function Confirm-MetadataUpdate {

Write-Verbose -Message 'Checking for metadata file...'
$localMetaDataFilePath = [System.IO.Path]::Combine($script:dataPath, $script:metadataFile)
Write-Debug -Message ('Metadata file path: {0}' -f $localMetaDataFilePath)
try {
$pathEval = Test-Path -Path $localMetaDataFilePath -ErrorAction Stop
}
Expand All @@ -33,6 +34,7 @@ function Confirm-MetadataUpdate {

if (-not ($pathEval)) {
$result = $false
Write-Debug -Message 'Metadata file not found.'
} #if_pathEval
else {
Write-Verbose 'Metadata file found. Performing metadata comparison...'
Expand All @@ -47,8 +49,10 @@ function Confirm-MetadataUpdate {

$tempMetadataFile = '{0}_temp' -f $script:metadataFile
$tempMetadataFilePath = [System.IO.Path]::Combine($script:dataPath, $tempMetadataFile)
Write-Debug -Message ('Temp metadata file path: {0}' -f $tempMetadataFilePath)
# if the temp metadata file exists, delete it
if (Test-Path -Path $tempMetadataFile) {
Write-Debug -Message 'Removing temp metadata file...'
Remove-Item -Path $tempMetadataFilePath -Force
}

Expand All @@ -60,6 +64,7 @@ function Confirm-MetadataUpdate {
return $result
}

Write-Debug -Message 'Getting content of temp metadata file...'
try {
$remoteMetadata = Get-Content $tempMetadataFilePath -ErrorAction 'Stop' | ConvertFrom-Json
}
Expand All @@ -69,6 +74,9 @@ function Confirm-MetadataUpdate {
return $result
}

Write-Debug -Message ('Local metadata version: {0}' -f $localMetadata.version)
Write-Debug -Message ('Remote metadata version: {0}' -f $remoteMetadata.version)

Write-Verbose -Message ('{0} vs {1}' -f $localMetadata.version, $remoteMetadata.version)
if ($localMetadata.version -eq $remoteMetadata.version) {
Write-Verbose 'Metadata file is current.'
Expand Down
2 changes: 2 additions & 0 deletions src/pwshEmojiExplorer/Private/Confirm-XMLDataSet.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function Confirm-XMLDataSet {

# if the file doesn't exist, we need to download it
Write-Verbose -Message 'Checking for data file...'
Write-Debug -Message ('Data file path: {0}' -f $dataFile)
try {
$pathEval = Test-Path -Path $dataFile -ErrorAction Stop
}
Expand All @@ -38,6 +39,7 @@ function Confirm-XMLDataSet {
}

if (-not ($pathEval)) {
Write-Debug -Message 'Data file not found.'
$result = $false
} #if_pathEval
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ function Convert-EmojiToHexCodePoint {
[string]$Emoji
)

Write-Debug -Message 'Converting emoji to hexadecimal code points...'
$charArray = $Emoji.ToCharArray()
$codePoints = New-Object System.Collections.Generic.List[string]

Expand Down
2 changes: 2 additions & 0 deletions src/pwshEmojiExplorer/Private/ConvertTo-PSEmoji.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ function ConvertTo-PSEmoji {
[PSCustomObject]$CustomObject
)

Write-Debug -Message 'Converting custom object to PSEmoji object...'

$emoji = [PSEmoji]::new(
$CustomObject.Group,
$CustomObject.Subgroup,
Expand Down
1 change: 1 addition & 0 deletions src/pwshEmojiExplorer/Private/Expand-XMLDataSet.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function Expand-XMLDataSet {
$dataFile = '{0}/{1}' -f $script:dataPath, $script:dataFile

Write-Verbose -Message 'Testing if data set file already exists...'
Write-Debug -Message ('Data file path: {0}' -f $dataFile)
try {
$pathEval = Test-Path -Path $dataFile -ErrorAction Stop
Write-Verbose -Message "EVAL: $true"
Expand Down
4 changes: 3 additions & 1 deletion src/pwshEmojiExplorer/Private/Get-RemoteFile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ function Get-RemoteFile {
}

Write-Verbose -Message 'Downloading file...'
$outFilePath = [System.IO.Path]::Combine($script:dataPath, $OutFile)
Write-Debug -Message ('Out file path: {0}' -f $outFilePath)
try {
$invokeWebRequestSplat = @{
OutFile = [System.IO.Path]::Combine($script:dataPath, $OutFile)
OutFile = $outFilePath
Uri = 'https://{0}/{1}' -f $script:dlURI, $File
ErrorAction = 'Stop'
}
Expand Down
2 changes: 2 additions & 0 deletions src/pwshEmojiExplorer/Private/Import-XMLDataSet.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ function Import-XMLDataSet {
if ($null -eq $script:glData) {
$dataCheck = Invoke-XMLDataCheck
if ($dataCheck) {
Write-Debug -Message 'XMLDataCheck returned true.'
try {
$getContentSplat = @{
Path = "$script:dataPath\$script:dataFile"
Expand All @@ -39,6 +40,7 @@ function Import-XMLDataSet {
} #catch
} #if_dataCheck
else {
Write-Debug -Message 'XMLDataCheck returned false.'
$result = $false
} #else_dataCheck
} #if_gldata
Expand Down

0 comments on commit df9c06e

Please sign in to comment.