diff --git a/src/actions/cache.ps1 b/src/actions/cache.ps1 index 6dc95b14..bc8f8ad7 100644 --- a/src/actions/cache.ps1 +++ b/src/actions/cache.ps1 @@ -1,11 +1,11 @@  function Get-CacheFiles { try { - if (Test-DirectoryNotExists -path $PVMConfig.paths.cache) { + if (Test-DirectoryNotExists -path $PVMConfig.paths.directories.cache) { return $null } - $files = Get-ChildItemWrapper -path $PVMConfig.paths.cache -filter '*.json' + $files = Get-ChildItemWrapper -path $PVMConfig.paths.directories.cache -filter '*.json' return $files } catch { @@ -16,7 +16,7 @@ function Get-CacheFiles { function Show-CacheFiles { try { - if (Test-DirectoryNotExists -path $PVMConfig.paths.cache) { + if (Test-DirectoryNotExists -path $PVMConfig.paths.directories.cache) { Show-Error -message "`nNo cache directory found." return -1 } @@ -123,7 +123,7 @@ function Clear-CacheFiles { } } - Remove-ItemWrapper -path "$($PVMConfig.paths.cache)\*" + Remove-ItemWrapper -path "$($PVMConfig.paths.directories.cache)\*" Show-Success -message "`nAll cache files deleted successfully." diff --git a/src/actions/ini/add.ps1 b/src/actions/ini/add.ps1 index 679f19c3..f7760270 100644 --- a/src/actions/ini/add.ps1 +++ b/src/actions/ini/add.ps1 @@ -146,7 +146,7 @@ function Install-XDebugExtension { } if ($null -eq $xDebugList -or $xDebugList.Count -eq 0) { - Show-Error -message "`nNo match was found, check the '$($PVMConfig.paths.logError)' for any potentiel errors" + Show-Error -message "`nNo match was found, check the '$($PVMConfig.paths.files.logError)' for any potentiel errors" return -1 } @@ -170,21 +170,21 @@ function Install-XDebugExtension { return -1 } - $null = Invoke-WebRequestWrapper -uri $chosenItem.href -outFile $PVMConfig.paths.php + $null = Invoke-WebRequestWrapper -uri $chosenItem.href -outFile $PVMConfig.paths.directories.php $phpPath = Split-Path -Path $iniPath -Parent if (-not $skipConfirmation) { if (Test-FileExists -path "$phpPath\ext\$($chosenItem.fileName)") { $response = Read-HostWrapper -prompt "`n$($chosenItem.fileName) already exists. Would you like to overwrite it? (y/n)" if (Test-NoResponse -response $response) { - Remove-ItemWrapper -path "$($PVMConfig.paths.php)\$($chosenItem.fileName)" + Remove-ItemWrapper -path "$($PVMConfig.paths.directories.php)\$($chosenItem.fileName)" Write-Gray -message "`nInstallation cancelled" return -1 } } } - Move-ItemWrapper -path "$($PVMConfig.paths.php)\$($chosenItem.fileName)" -destination "$phpPath\ext" + Move-ItemWrapper -path "$($PVMConfig.paths.directories.php)\$($chosenItem.fileName)" -destination "$phpPath\ext" $xDebugConfig = Get-XdebugConfigV2 -XDebugPath $($chosenItem.fileName) if ($chosenItem.extVersion -like '3.*') { $xDebugConfig = Get-XdebugConfigV3 -XDebugPath $($chosenItem.fileName) @@ -303,9 +303,9 @@ function Install-Extension { return -1 } - $null = Invoke-WebRequestWrapper -uri $chosenItem.href -outFile $PVMConfig.paths.php + $null = Invoke-WebRequestWrapper -uri $chosenItem.href -outFile $PVMConfig.paths.directories.php $fileNamePath = $chosenItem.fileName -replace '.zip$', '' - $extractPath = "$($PVMConfig.paths.php)\$fileNamePath" + $extractPath = "$($PVMConfig.paths.directories.php)\$fileNamePath" Expand-Zip -zipPath "$extractPath.zip" -extractPath $extractPath -deleteZipAfter $true $files = Get-ChildItemWrapper -path $extractPath $extFile = $files | Where-Object -FilterScript { @@ -322,7 +322,7 @@ function Install-Extension { if (Test-FileExists -path "$phpPath\ext\$($extFile.Name)") { $response = Read-HostWrapper -prompt "`n$($extFile.Name) already exists. Would you like to overwrite it? (y/n)" if (Test-NoResponse -response $response) { - Remove-ItemWrapper -path "$($PVMConfig.paths.php)\$fileNamePath" + Remove-ItemWrapper -path "$($PVMConfig.paths.directories.php)\$fileNamePath" Write-Gray -message "`nInstallation cancelled" return -1 } diff --git a/src/actions/install.ps1 b/src/actions/install.ps1 index dac3f9f3..e9f63d9c 100644 --- a/src/actions/install.ps1 +++ b/src/actions/install.ps1 @@ -182,7 +182,7 @@ function Get-PHP { $buildType = $versionObject.BuildType $arch = $versionObject.arch - $destination = $PVMConfig.paths.php + $destination = $PVMConfig.paths.directories.php $created = New-Directory -path $destination if ($created -ne 0) { Show-Error -message "Failed to create directory $destination" diff --git a/src/actions/log.ps1 b/src/actions/log.ps1 index b31b1443..c4d6a717 100644 --- a/src/actions/log.ps1 +++ b/src/actions/log.ps1 @@ -233,12 +233,12 @@ function Show-Log { $pageSize = [int]$pageSize # Check if log file exists - if (Test-FileNotExists -path $PVMConfig.paths.logError) { - Show-Error -message "`nLog file not found: $($PVMConfig.paths.logError)" + if (Test-FileNotExists -path $PVMConfig.paths.files.logError) { + Show-Error -message "`nLog file not found: $($PVMConfig.paths.files.logError)" return -1 } - $entries = @(Get-LogEntries -path $PVMConfig.paths.logError -term $term) + $entries = @(Get-LogEntries -path $PVMConfig.paths.files.logError -term $term) if ($entries.Length -eq 0) { Show-Warning -message "`nNo log entries found." @@ -264,7 +264,7 @@ function Show-Log { Clear-Host return 0 } catch { - Show-Error -message "`nFailed to show log: $($PVMConfig.paths.logError)" + Show-Error -message "`nFailed to show log: $($PVMConfig.paths.files.logError)" $null = Add-LogEntry -data @{ header = "$($MyInvocation.MyCommand.Name) - Failed to show log"; exception = $_ } return -1 } diff --git a/src/actions/profile.ps1 b/src/actions/profile.ps1 index d9267b7a..117abc5c 100644 --- a/src/actions/profile.ps1 +++ b/src/actions/profile.ps1 @@ -156,8 +156,8 @@ function Disable-IniExtensionDirect { function Get-PopularPHPSettings { try { # Return list of popular/common PHP settings that should be included in profiles - if (Test-FileExists -path $PVMConfig.paths.profileTemplate) { - $data = (Get-ContentWrapper -path $PVMConfig.paths.profileTemplate -raw | ConvertFrom-Json) + if (Test-FileExists -path $PVMConfig.paths.files.profileTemplate) { + $data = (Get-ContentWrapper -path $PVMConfig.paths.files.profileTemplate -raw | ConvertFrom-Json) if ($null -ne $data.settings -and $data.settings.Count -gt 0) { return $data.settings } @@ -172,8 +172,8 @@ function Get-PopularPHPSettings { function Get-PopularPHPExtensions { try { # Return list of popular/common PHP extensions that should be included in profiles - if (Test-FileExists -path $PVMConfig.paths.profileTemplate) { - $data = (Get-ContentWrapper -path $PVMConfig.paths.profileTemplate -raw | ConvertFrom-Json) + if (Test-FileExists -path $PVMConfig.paths.files.profileTemplate) { + $data = (Get-ContentWrapper -path $PVMConfig.paths.files.profileTemplate -raw | ConvertFrom-Json) if ($null -ne $data.extensions -and $data.extensions.Count -gt 0) { return $data.extensions } @@ -244,13 +244,13 @@ function Save-PHPProfile { } # Save to JSON file - $created = New-Directory -path $PVMConfig.paths.profiles + $created = New-Directory -path $PVMConfig.paths.directories.profiles if ($created -ne 0) { Show-Error -message "`nFailed to create profiles directory." return -1 } - $profilePath = "$($PVMConfig.paths.profiles)\$profileName.json" + $profilePath = "$($PVMConfig.paths.directories.profiles)\$profileName.json" $jsonContent = $userProfile | ConvertTo-Json -Depth 10 Set-ContentWrapper -path $profilePath -value $jsonContent @@ -259,7 +259,7 @@ function Save-PHPProfile { Show-Message -message " Extensions: $($userProfile.extensions.Count) (popular/common only)" Show-Message -message " Location: $profilePath" Show-Info -message "`nNote: Only popular/common settings and extensions are saved." - Show-Info -message " You can manually edit settings/extensions at '$($PVMConfig.paths.profileTemplate)'." + Show-Info -message " You can manually edit settings/extensions at '$($PVMConfig.paths.files.profileTemplate)'." return 0 } catch { @@ -287,7 +287,7 @@ function Use-PHPProfile { } # Load profile JSON - $profilePath = "$($PVMConfig.paths.profiles)\$profileName.json" + $profilePath = "$($PVMConfig.paths.directories.profiles)\$profileName.json" if (Test-FileNotExists -path $profilePath) { Show-Error -message "`nProfile '$profileName' not found." Show-Message -message " Use 'pvm profile list' to see available profiles." @@ -373,11 +373,11 @@ function Use-PHPProfile { function Get-ProfileFiles { try { - if (Test-DirectoryNotExists -path $PVMConfig.paths.profiles) { + if (Test-DirectoryNotExists -path $PVMConfig.paths.directories.profiles) { return $null } - $files = Get-ChildItemWrapper -path $PVMConfig.paths.profiles -filter '*.json' + $files = Get-ChildItemWrapper -path $PVMConfig.paths.directories.profiles -filter '*.json' return $files } catch { @@ -388,7 +388,7 @@ function Get-ProfileFiles { function Show-PHPProfiles { try { - if (Test-DirectoryNotExists -path $PVMConfig.paths.profiles) { + if (Test-DirectoryNotExists -path $PVMConfig.paths.directories.profiles) { Show-Error -message "`nNo profiles directory found. Create a profile with 'pvm profile save '." return -1 } @@ -433,7 +433,7 @@ function Show-PHPProfiles { Show-Message -message (' PHP '.PadRight($maxNameLength, '.') + " $($userProfile.PHPVersion)") Show-Message -message (' Settings '.PadRight($maxNameLength, '.') + " $($userProfile.Settings)") Show-Message -message (' Extensions '.PadRight($maxNameLength, '.') + " $($userProfile.Extensions)") - Show-Message -message (' Path '.PadRight($maxNameLength, '.') + " $($PVMConfig.paths.profiles)\$($userProfile.File)`n") + Show-Message -message (' Path '.PadRight($maxNameLength, '.') + " $($PVMConfig.paths.directories.profiles)\$($userProfile.File)`n") } return 0 @@ -448,7 +448,7 @@ function Show-PHPProfile { param ($profileName) try { - $profilePath = "$($PVMConfig.paths.profiles)\$profileName.json" + $profilePath = "$($PVMConfig.paths.directories.profiles)\$profileName.json" if (Test-FileNotExists -path $profilePath) { Show-Error -message "`nProfile '$profileName' not found." Show-Message -message " Use 'pvm profile list' to see available profiles." @@ -516,7 +516,7 @@ function Remove-PHPProfile { param ($profileName, $skipConfirmation = $false) try { - $profilePath = "$($PVMConfig.paths.profiles)\$profileName.json" + $profilePath = "$($PVMConfig.paths.directories.profiles)\$profileName.json" if (Test-FileNotExists -path $profilePath) { Show-Error -message "`nProfile '$profileName' not found." @@ -561,7 +561,7 @@ function Clear-PHPProfiles { } } - Remove-ItemWrapper -path "$($PVMConfig.paths.profiles)\*" + Remove-ItemWrapper -path "$($PVMConfig.paths.directories.profiles)\*" Show-Success -message "`nAll profiles deleted successfully." @@ -577,7 +577,7 @@ function Export-PHPProfile { param ($profileName, $exportPath = $null) try { - $profilePath = "$($PVMConfig.paths.profiles)\$profileName.json" + $profilePath = "$($PVMConfig.paths.directories.profiles)\$profileName.json" if (Test-FileNotExists -path $profilePath) { Show-Error -message "`nProfile '$profileName' not found." @@ -624,13 +624,13 @@ function Import-PHPProfile { # Use provided name or name from profile $finalName = if ($profileName) { $profileName } else { $userProfile.name } - $created = New-Directory -path $PVMConfig.paths.profiles + $created = New-Directory -path $PVMConfig.paths.directories.profiles if ($created -ne 0) { Show-Error -message "`nFailed to create profiles directory." return -1 } - $targetPath = "$($PVMConfig.paths.profiles)\$finalName.json" + $targetPath = "$($PVMConfig.paths.directories.profiles)\$finalName.json" # Update profile name if different if ($finalName -ne $userProfile.name) { @@ -697,7 +697,7 @@ function New-ExamplePHPProfile { } $jsonContent = $profileExample | ConvertTo-Json -Depth 10 - Set-ContentWrapper -path $PVMConfig.paths.profileExample -value $jsonContent + Set-ContentWrapper -path $PVMConfig.paths.files.profileExample -value $jsonContent return 0 } catch { @@ -714,7 +714,7 @@ function New-ProfileTemplate { } $jsonContent = $profileTemplate | ConvertTo-Json -Depth 10 - Set-ContentWrapper -path $PVMConfig.paths.profileTemplate -value $jsonContent + Set-ContentWrapper -path $PVMConfig.paths.files.profileTemplate -value $jsonContent return 0 } catch { diff --git a/src/actions/run.ps1 b/src/actions/run.ps1 index 7b24e34b..e4c7ae32 100644 --- a/src/actions/run.ps1 +++ b/src/actions/run.ps1 @@ -77,7 +77,7 @@ function Invoke-RunScripts { Show-SubProcessOutput -output $result.output New-Lines -count 3 } catch { - Write-Yellow -message "`nFailed to run command: pvm $scriptCommand, check logs at '$($PVMConfig.paths.logError)'`n" + Write-Yellow -message "`nFailed to run command: pvm $scriptCommand, check logs at '$($PVMConfig.paths.files.logError)'`n" $null = Add-LogEntry -data @{ header = "$($MyInvocation.MyCommand.Name) - Failed to run script"; exception = $_ } $results += @{ code = -1; output = $null } } diff --git a/src/actions/setup.ps1 b/src/actions/setup.ps1 index 86923883..7fbcd47f 100644 --- a/src/actions/setup.ps1 +++ b/src/actions/setup.ps1 @@ -39,14 +39,14 @@ function Initialize-PVM { function Initialize-PVMDirectories { $dirs = @( - $PVMConfig.paths.storage, - $PVMConfig.paths.fakeStorage, - $PVMConfig.paths.php, - $PVMConfig.paths.data, - $PVMConfig.paths.templates, - $PVMConfig.paths.cache, - $PVMConfig.paths.profiles, - $PVMConfig.paths.log + $PVMConfig.paths.directories.storage, + $PVMConfig.paths.directories.fakeStorage, + $PVMConfig.paths.directories.php, + $PVMConfig.paths.directories.data, + $PVMConfig.paths.directories.templates, + $PVMConfig.paths.directories.cache, + $PVMConfig.paths.directories.profiles, + $PVMConfig.paths.directories.log ) Show-Message -message "`nPVM environment directories:" @@ -71,7 +71,7 @@ function Initialize-PVMFiles { $codes += $code = New-ExamplePHPProfile if ($code -eq 0) { - Show-Success -message "`nExample profile created successfully at '$($PVMConfig.paths.profileExample)'." + Show-Success -message "`nExample profile created successfully at '$($PVMConfig.paths.files.profileExample)'." Show-Message -message "- Use 'pvm help profile' to learn more." } else { Show-Error -message "`nFailed to create example profile." @@ -79,7 +79,7 @@ function Initialize-PVMFiles { $codes += $code = New-ProfileTemplate if ($code -eq 0) { - Show-Success -message "`nProfile template created successfully at '$($PVMConfig.paths.profileTemplate)'." + Show-Success -message "`nProfile template created successfully at '$($PVMConfig.paths.files.profileTemplate)'." Show-Message -message '- Feel free to modify it.' } else { Show-Error -message "`nFailed to create profile template." @@ -87,14 +87,14 @@ function Initialize-PVMFiles { $codes += $code = Set-ZendExtensionsList if ($code -eq 0) { - Show-Success -message "`nZend extensions list created successfully at '$($PVMConfig.paths.zendExtensionsList)'." + Show-Success -message "`nZend extensions list created successfully at '$($PVMConfig.paths.files.zendExtensionsList)'." } else { Show-Error -message "`nFailed to create zend extensions list." } $codes += $code = Set-AliasesList if ($code -eq 0) { - Show-Success -message "`nAliases list created successfully at '$($PVMConfig.paths.aliasesList)'." + Show-Success -message "`nAliases list created successfully at '$($PVMConfig.paths.files.aliasesList)'." Show-Message -message "- Use 'pvm aliases' to see available aliases." Show-Message -message "- Feel free to modify it." } else { @@ -103,7 +103,7 @@ function Initialize-PVMFiles { $codes += $code = Set-ScriptsList if ($code -eq 0) { - Show-Success -message "`nScripts list created successfully at '$($PVMConfig.paths.scriptsList)'." + Show-Success -message "`nScripts list created successfully at '$($PVMConfig.paths.files.scriptsList)'." Show-Message -message "- Use 'pvm run list' to see available scripts." Show-Message -message "- Feel free to modify it." } else { diff --git a/src/actions/test.ps1 b/src/actions/test.ps1 index 47a331d3..fea632db 100644 --- a/src/actions/test.ps1 +++ b/src/actions/test.ps1 @@ -521,7 +521,7 @@ function Invoke-Tests { return 0 } catch { $null = Add-LogEntry -data @{ header = "$($MyInvocation.MyCommand.Name) - Failed to run tests"; exception = $_ } - Show-Error -message "`nFailed to run tests, check log: $($PVMConfig.paths.logError)" + Show-Error -message "`nFailed to run tests, check log: $($PVMConfig.paths.files.logError)" return -1 } } diff --git a/src/core/handlers.ps1 b/src/core/handlers.ps1 index 243b7aed..512cf3cb 100644 --- a/src/core/handlers.ps1 +++ b/src/core/handlers.ps1 @@ -245,7 +245,7 @@ function Invoke-Log { $clearLog = $arguments -contains '--clear' if ($clearLog) { - Clear-ContentWrapper -path $PVMConfig.paths.logError + Clear-ContentWrapper -path $PVMConfig.paths.file.logError Show-Success -message "`nLog Cleared Successfully" return 0 } @@ -471,7 +471,7 @@ function Invoke-Info { $config = [ordered]@{ 'PVM Version' = $PVMConfig.version 'PVM Root' = $PVMRoot - 'Storage Path' = $PVMConfig.paths.storage + 'Storage Path' = $PVMConfig.paths.directories.storage 'Current PHP' = $currentPhpVersion 'Real PHP Path' = $currentPhpPath 'Active PHP Path' = $PVMConfig.env.PHP_CURRENT_VERSION_PATH @@ -480,7 +480,7 @@ function Invoke-Info { 'Profiles' = @(Get-ProfileFiles).Count 'Cached Files' = @(Get-CacheFiles).Count } - $allKeys = $config.Keys + $PVMConfig.paths.Keys + $PVMConfig.env.Keys + $allKeys = $config.Keys + $PVMConfig.paths.directories.Keys + $PVMConfig.paths.files.Keys + $PVMConfig.env.Keys $maxNameLength = ($allKeys | Measure-Object -Maximum Length).Maximum + ($PVMConfig.env.MIN_PAD_RIGHT_LENGTH * 2) Show-Info -message "`n`nPVM status:`n" @@ -491,10 +491,13 @@ function Invoke-Info { if ($arguments -contains '--verbose') { $PVM_PATHS = [ordered]@{} - foreach ($entry in $PVMConfig.paths.GetEnumerator()) { + $PVM_PATHS['Current PHP Path'] = $PVMConfig.env.PHP_CURRENT_VERSION_PATH + foreach ($entry in $PVMConfig.paths.directories.GetEnumerator()) { + $PVM_PATHS[$entry.Key] = $entry.Value + } + foreach ($entry in $PVMConfig.paths.files.GetEnumerator()) { $PVM_PATHS[$entry.Key] = $entry.Value } - $PVM_PATHS['Current PHP Path'] = $PVMConfig.env.PHP_CURRENT_VERSION_PATH Show-Info -message "`n`nPVM paths:`n" foreach ($entry in $PVM_PATHS.GetEnumerator()) { diff --git a/src/helpers/config.ps1 b/src/helpers/config.ps1 index 2eb083fc..3bab32e2 100644 --- a/src/helpers/config.ps1 +++ b/src/helpers/config.ps1 @@ -2,7 +2,7 @@ function Set-AliasesList { try { $jsonContent = $PVMConfig.defaults.aliases | ConvertTo-Json -Depth 10 - Set-ContentWrapper -path $PVMConfig.paths.aliasesList -value $jsonContent + Set-ContentWrapper -path $PVMConfig.paths.files.aliasesList -value $jsonContent return 0 } catch { @@ -13,8 +13,8 @@ function Set-AliasesList { function Get-Aliases { try { - if (Test-FileExists -path $PVMConfig.paths.aliasesList) { - $data = (Get-ContentWrapper -path $PVMConfig.paths.aliasesList -raw | ConvertFrom-Json) + if (Test-FileExists -path $PVMConfig.paths.files.aliasesList) { + $data = (Get-ContentWrapper -path $PVMConfig.paths.files.aliasesList -raw | ConvertFrom-Json) if ($null -ne $data) { $ordered = [ordered]@{} $data.PSObject.Properties | ForEach-Object -Process { $ordered[$_.Name] = $_.Value } @@ -35,7 +35,7 @@ function Get-FlagMap { function Set-ScriptsList { try { $jsonContent = $PVMConfig.defaults.scripts | ConvertTo-Json -Depth 10 - Set-ContentWrapper -path $PVMConfig.paths.scriptsList -value $jsonContent + Set-ContentWrapper -path $PVMConfig.paths.files.scriptsList -value $jsonContent return 0 } catch { @@ -46,8 +46,8 @@ function Set-ScriptsList { function Get-Scripts { try { - if (Test-FileExists -path $PVMConfig.paths.scriptsList) { - $data = (Get-ContentWrapper -path $PVMConfig.paths.scriptsList -raw | ConvertFrom-Json) + if (Test-FileExists -path $PVMConfig.paths.files.scriptsList) { + $data = (Get-ContentWrapper -path $PVMConfig.paths.files.scriptsList -raw | ConvertFrom-Json) if ($null -ne $data) { $ordered = [ordered]@{} $data.PSObject.Properties | ForEach-Object -Process { $ordered[$_.Name] = $_.Value } @@ -148,23 +148,27 @@ function Get-Config { version = '2.6' # PVM version paths = [ordered]@{ - pvmRoot = $rootPath - storage = $storage - fakeStorage = $fakeStorage - php = "$storage\php" - data = $data - templates = $templates - cache = "$data\cache" - profiles = $profiles - profileExample = "$profiles\profile-example.json" - profileTemplate = "$templates\profile-template.json" - zendExtensionsList = "$templates\zend_extensions.json" - aliasesList = "$templates\aliases.json" - scriptsList = "$templates\scripts.json" - log = $logs - logError = "$logs\error.log" - pathVarBackup = "$logs\path.bak.log" - assets = "$rootPath\assets" + directories = @{ + pvmRoot = $rootPath + storage = $storage + fakeStorage = $fakeStorage + php = "$storage\php" + data = $data + templates = $templates + cache = "$data\cache" + profiles = $profiles + log = $logs + assets = "$rootPath\assets" + } + files = @{ + profileExample = "$profiles\profile-example.json" + profileTemplate = "$templates\profile-template.json" + zendExtensionsList = "$templates\zend_extensions.json" + aliasesList = "$templates\aliases.json" + scriptsList = "$templates\scripts.json" + logError = "$logs\error.log" + pathVarBackup = "$logs\path.bak.log" + } } links = [ordered]@{ @@ -268,23 +272,24 @@ function Get-Config { $fakeTemplates = "$fakeData\templates" $fakeLogs = "$fakeStorage\logs" - $PVMConfig.paths.pvmRoot = $root - $PVMConfig.paths.storage = $fakeStorage - $PVMConfig.paths.fakeStorage = $fakeStorage - $PVMConfig.paths.php = "$fakeStorage\php" - $PVMConfig.paths.data = $fakeData - $PVMConfig.paths.templates = $fakeTemplates - $PVMConfig.paths.cache = "$fakeData\cache" - $PVMConfig.paths.profiles = $fakeProfiles - $PVMConfig.paths.profileExample = "$fakeProfiles\profile-example.json" - $PVMConfig.paths.profileTemplate = "$fakeTemplates\profile-template.json" - $PVMConfig.paths.zendExtensionsList = "$fakeTemplates\zend_extensions.json" - $PVMConfig.paths.aliasesList = "$fakeTemplates\aliases.json" - $PVMConfig.paths.scriptsList = "$fakeTemplates\scripts.json" - $PVMConfig.paths.log = $fakeLogs - $PVMConfig.paths.logError = "$fakeLogs\error.log" - $PVMConfig.paths.pathVarBackup = "$fakeLogs\path.bak.log" - $PVMConfig.paths.assets = "$root\assets" + $PVMConfig.paths.directories.pvmRoot = $root + $PVMConfig.paths.directories.storage = $fakeStorage + $PVMConfig.paths.directories.fakeStorage = $fakeStorage + $PVMConfig.paths.directories.php = "$fakeStorage\php" + $PVMConfig.paths.directories.data = $fakeData + $PVMConfig.paths.directories.templates = $fakeTemplates + $PVMConfig.paths.directories.cache = "$fakeData\cache" + $PVMConfig.paths.directories.profiles = $fakeProfiles + $PVMConfig.paths.directories.log = $fakeLogs + $PVMConfig.paths.directories.assets = "$root\assets" + + $PVMConfig.paths.files.profileExample = "$fakeProfiles\profile-example.json" + $PVMConfig.paths.files.profileTemplate = "$fakeTemplates\profile-template.json" + $PVMConfig.paths.files.zendExtensionsList = "$fakeTemplates\zend_extensions.json" + $PVMConfig.paths.files.aliasesList = "$fakeTemplates\aliases.json" + $PVMConfig.paths.files.scriptsList = "$fakeTemplates\scripts.json" + $PVMConfig.paths.files.logError = "$fakeLogs\error.log" + $PVMConfig.paths.files.pathVarBackup = "$fakeLogs\path.bak.log" $PVMConfig.env.PHP_CURRENT_VERSION_PATH = "$root\pvm\php" } diff --git a/src/helpers/output.ps1 b/src/helpers/output.ps1 index 14139218..ec5e05d7 100644 --- a/src/helpers/output.ps1 +++ b/src/helpers/output.ps1 @@ -29,7 +29,7 @@ function Add-LogEntry { param ($data) try { - $logPath = if ($data.logPath) { $data.logPath } else { $PVMConfig.paths.logError } + $logPath = if ($data.logPath) { $data.logPath } else { $PVMConfig.paths.files.logError } $created = New-Directory -path (Split-Path -Path $logPath -Parent) if ($created -ne 0) { Show-Error -message "Failed to create directory $(Split-Path -Path $logPath -Parent)" @@ -354,7 +354,7 @@ function Invoke-Sound { } $MediaPlayer = New-Player - $path = "$($PVMConfig.paths.assets)\sounds\$filename" + $path = "$($PVMConfig.paths.directories.assets)\sounds\$filename" $MediaPlayer.Open($path) $duration = Get-Sound-TotalSeconds -path $path $MediaPlayer.Play() diff --git a/src/helpers/php.ps1 b/src/helpers/php.ps1 index 311e3b3e..38a4fccb 100644 --- a/src/helpers/php.ps1 +++ b/src/helpers/php.ps1 @@ -64,7 +64,7 @@ function Test-TwoPHPVersionsEqual { function Set-ZendExtensionsList { try { $jsonContent = $PVMConfig.defaults.zendExtensions | ConvertTo-Json -Depth 10 - Set-ContentWrapper -path $PVMConfig.paths.zendExtensionsList -value $jsonContent + Set-ContentWrapper -path $PVMConfig.paths.files.zendExtensionsList -value $jsonContent return 0 } catch { @@ -75,8 +75,8 @@ function Set-ZendExtensionsList { function Get-ZendExtensionsList { try { - if (Test-FileExists -path $PVMConfig.paths.zendExtensionsList) { - $data = (Get-ContentWrapper -path $PVMConfig.paths.zendExtensionsList -raw | ConvertFrom-Json) + if (Test-FileExists -path $PVMConfig.paths.files.zendExtensionsList) { + $data = (Get-ContentWrapper -path $PVMConfig.paths.files.zendExtensionsList -raw | ConvertFrom-Json) if ($null -ne $data -and $data.Count -gt 0) { return $data } @@ -102,7 +102,7 @@ function Update-InstalledPHPVersionsCache { function Get-InstalledPHPVersionsFromDisk { return Show-SpinnerWhileJob -scriptBlock { - $directories = Get-AllSubdirectories -path $PVMConfig.paths.php + $directories = Get-AllSubdirectories -path $PVMConfig.paths.directories.php $installedVersions = $directories | ForEach-Object -Process { if (Test-FileExists -path "$($_.FullName)\php.exe") { $phpInfo = Get-PHPInstallInfo -path $_.FullName diff --git a/src/helpers/store.ps1 b/src/helpers/store.ps1 index a0c192ec..c465c135 100644 --- a/src/helpers/store.ps1 +++ b/src/helpers/store.ps1 @@ -90,7 +90,7 @@ function Get-CacheFilePath { $filename = "$filename.json" } - return "$($PVMConfig.paths.cache)\$filename" + return "$($PVMConfig.paths.directories.cache)\$filename" } function Test-HasData { diff --git a/src/helpers/system.ps1 b/src/helpers/system.ps1 index 9a2aa8d4..59074928 100644 --- a/src/helpers/system.ps1 +++ b/src/helpers/system.ps1 @@ -131,11 +131,11 @@ function Optimize-SystemPath { # Saving Path to log $outputLog = Add-LogEntry -data @{ - logPath = $PVMConfig.paths.pathVarBackup + logPath = $PVMConfig.paths.files.pathVarBackup header = "Original PATH`n$oldPath" } if ($outputLog -eq 0) { - Show-Message -message "`nOriginal Path saved to '$($PVMConfig.paths.pathVarBackup)'" + Show-Message -message "`nOriginal Path saved to '$($PVMConfig.paths.files.pathVarBackup)'" } $output = 0 diff --git a/src/helpers/update-check.ps1 b/src/helpers/update-check.ps1 index 434d9f09..6498503b 100644 --- a/src/helpers/update-check.ps1 +++ b/src/helpers/update-check.ps1 @@ -1,7 +1,7 @@  function Get-LastUpdateCheckTimestamp { try { - $timestampFile = "$($PVMConfig.paths.cache)\last_update_check.txt" + $timestampFile = "$($PVMConfig.paths.directories.cache)\last_update_check.txt" if (Test-FileExists -path $timestampFile) { return [DateTime](Get-ContentWrapper -path $timestampFile) } @@ -13,8 +13,8 @@ function Get-LastUpdateCheckTimestamp { function Set-LastUpdateCheckTimestamp { try { - $timestampFile = "$($PVMConfig.paths.cache)\last_update_check.txt" - $created = New-Directory -path $PVMConfig.paths.cache + $timestampFile = "$($PVMConfig.paths.directories.cache)\last_update_check.txt" + $created = New-Directory -path $PVMConfig.paths.directories.cache if ($created -ne 0) { Show-Error -message "`nFailed to create cache directory." return -1 diff --git a/tests/actions/cache.tests.ps1 b/tests/actions/cache.tests.ps1 index 96786354..c5fb905b 100644 --- a/tests/actions/cache.tests.ps1 +++ b/tests/actions/cache.tests.ps1 @@ -1,12 +1,12 @@  BeforeAll { $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\cache-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\cache-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) - $script:CACHE_PATH = $PVMConfig.paths.cache + $script:CACHE_PATH = $PVMConfig.paths.directories.cache New-Item -ItemType Directory -Path $TEST_DRIVE -Force | Out-Null - New-Item -ItemType Directory -Path $PVMConfig.paths.cache -Force | Out-Null + New-Item -ItemType Directory -Path $PVMConfig.paths.directories.cache -Force | Out-Null Mock Show-Error {} Mock Show-Info {} diff --git a/tests/actions/current.tests.ps1 b/tests/actions/current.tests.ps1 index d092994b..3fab2edb 100644 --- a/tests/actions/current.tests.ps1 +++ b/tests/actions/current.tests.ps1 @@ -1,11 +1,11 @@  BeforeAll { $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\current-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\current-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) $script:PHP_CURRENT_DIR = $PVMConfig.env.PHP_CURRENT_VERSION_PATH - $script:PHP_DIR = $PVMConfig.paths.php + $script:PHP_DIR = $PVMConfig.paths.directories.php New-Item -ItemType Directory -Path $TEST_DRIVE -Force | Out-Null New-Item -ItemType Directory -Path $PHP_CURRENT_DIR -Force | Out-Null diff --git a/tests/actions/ini.tests.ps1 b/tests/actions/ini.tests.ps1 index b5665d0c..9cb80e2c 100644 --- a/tests/actions/ini.tests.ps1 +++ b/tests/actions/ini.tests.ps1 @@ -1,7 +1,7 @@  BeforeAll { $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\ini-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\ini-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) $script:testIniPath = "$TEST_DRIVE\php.ini" @@ -12,10 +12,10 @@ BeforeAll { $script:PECL_WIN_EXT_DOWNLOAD_URL = $PVMConfig.links.peclWinExtDownload New-Item -ItemType Directory -Path $TEST_DRIVE -Force | Out-Null - New-Item -ItemType Directory -Path $PVMConfig.paths.cache -Force | Out-Null + New-Item -ItemType Directory -Path $PVMConfig.paths.directories.cache -Force | Out-Null # Create directory and symlink for current PHP version - $phpVersionPath = "$($PVMConfig.paths.php)\php-8.2" + $phpVersionPath = "$($PVMConfig.paths.directories.php)\php-8.2" New-Item -ItemType Directory -Path $phpVersionPath -Force Mock Show-Error {} diff --git a/tests/actions/ini/add.tests.ps1 b/tests/actions/ini/add.tests.ps1 index edd8a28c..d7c88c50 100644 --- a/tests/actions/ini/add.tests.ps1 +++ b/tests/actions/ini/add.tests.ps1 @@ -1,7 +1,7 @@  BeforeAll { $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\add-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\add-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) $script:testIniPath = "$TEST_DRIVE\php.ini" @@ -9,7 +9,7 @@ BeforeAll { $script:testBackupPath = "$testIniPath.bak" New-Item -ItemType Directory -Path $TEST_DRIVE -Force | Out-Null - New-Item -ItemType Directory -Path $PVMConfig.paths.cache -Force | Out-Null + New-Item -ItemType Directory -Path $PVMConfig.paths.directories.cache -Force | Out-Null $script:XDEBUG_BASE_URL = $PVMConfig.links.xdebugBase $script:PECL_PACKAGES_URL = $PVMConfig.links.peclPackages diff --git a/tests/actions/ini/disable.tests.ps1 b/tests/actions/ini/disable.tests.ps1 index 99ce2928..cd55433b 100644 --- a/tests/actions/ini/disable.tests.ps1 +++ b/tests/actions/ini/disable.tests.ps1 @@ -1,7 +1,7 @@  BeforeAll { $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\disable-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\disable-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) $script:testIniPath = "$TEST_DRIVE\php.ini" @@ -9,7 +9,7 @@ BeforeAll { $script:testBackupPath = "$testIniPath.bak" New-Item -ItemType Directory -Path $TEST_DRIVE -Force | Out-Null - New-Item -ItemType Directory -Path $PVMConfig.paths.cache -Force | Out-Null + New-Item -ItemType Directory -Path $PVMConfig.paths.directories.cache -Force | Out-Null Mock Show-Warning {} Mock Show-Info {} diff --git a/tests/actions/ini/enable.tests.ps1 b/tests/actions/ini/enable.tests.ps1 index 7f4d054f..0070ce1e 100644 --- a/tests/actions/ini/enable.tests.ps1 +++ b/tests/actions/ini/enable.tests.ps1 @@ -1,7 +1,7 @@  BeforeAll { $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\enable-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\enable-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) $script:testIniPath = "$TEST_DRIVE\php.ini" @@ -9,7 +9,7 @@ BeforeAll { $script:testBackupPath = "$testIniPath.bak" New-Item -ItemType Directory -Path $TEST_DRIVE -Force | Out-Null - New-Item -ItemType Directory -Path $PVMConfig.paths.cache -Force | Out-Null + New-Item -ItemType Directory -Path $PVMConfig.paths.directories.cache -Force | Out-Null Mock Show-Warning {} Mock Show-Info {} diff --git a/tests/actions/ini/ext.tests.ps1 b/tests/actions/ini/ext.tests.ps1 index 5e7f71bb..cd7c3930 100644 --- a/tests/actions/ini/ext.tests.ps1 +++ b/tests/actions/ini/ext.tests.ps1 @@ -1,7 +1,7 @@  BeforeAll { $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\ext-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\ext-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) $script:testIniPath = "$TEST_DRIVE\php.ini" diff --git a/tests/actions/ini/get.tests.ps1 b/tests/actions/ini/get.tests.ps1 index 0032cc9e..8c500aa8 100644 --- a/tests/actions/ini/get.tests.ps1 +++ b/tests/actions/ini/get.tests.ps1 @@ -1,7 +1,7 @@  BeforeAll { $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\get-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\get-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) $script:testIniPath = "$TEST_DRIVE\php.ini" @@ -9,7 +9,7 @@ BeforeAll { $script:testBackupPath = "$testIniPath.bak" New-Item -ItemType Directory -Path $TEST_DRIVE -Force | Out-Null - New-Item -ItemType Directory -Path $PVMConfig.paths.cache -Force | Out-Null + New-Item -ItemType Directory -Path $PVMConfig.paths.directories.cache -Force | Out-Null Mock Show-Warning {} Mock Show-Info {} diff --git a/tests/actions/ini/helpers/fetch.tests.ps1 b/tests/actions/ini/helpers/fetch.tests.ps1 index 11788fb1..846ffe98 100644 --- a/tests/actions/ini/helpers/fetch.tests.ps1 +++ b/tests/actions/ini/helpers/fetch.tests.ps1 @@ -1,7 +1,7 @@  BeforeAll { $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\fetch-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\fetch-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) $script:PECL_BASE_URL = $PVMConfig.links.peclBase @@ -630,7 +630,7 @@ Describe "Select-ExtensionFromMatches Tests" { Describe "Resolve-ExtensionLinks Tests" { BeforeEach { - $PVMConfig.paths.cache = "$TEST_DRIVE\cache" + $PVMConfig.paths.directories.cache = "$TEST_DRIVE\cache" } It "Returns filtered links" { diff --git a/tests/actions/ini/helpers/shared.tests.ps1 b/tests/actions/ini/helpers/shared.tests.ps1 index c3ee1695..3e09e247 100644 --- a/tests/actions/ini/helpers/shared.tests.ps1 +++ b/tests/actions/ini/helpers/shared.tests.ps1 @@ -1,7 +1,7 @@  BeforeAll { $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\shared-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\shared-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) $script:testIniPath = "$TEST_DRIVE\php.ini" diff --git a/tests/actions/ini/info.tests.ps1 b/tests/actions/ini/info.tests.ps1 index cee821a6..9e69dcb3 100644 --- a/tests/actions/ini/info.tests.ps1 +++ b/tests/actions/ini/info.tests.ps1 @@ -1,7 +1,7 @@  BeforeAll { $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\info-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\info-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) $script:testIniPath = "$TEST_DRIVE\php.ini" @@ -9,7 +9,7 @@ BeforeAll { $script:testBackupPath = "$testIniPath.bak" New-Item -ItemType Directory -Path $TEST_DRIVE -Force | Out-Null - New-Item -ItemType Directory -Path $PVMConfig.paths.cache -Force | Out-Null + New-Item -ItemType Directory -Path $PVMConfig.paths.directories.cache -Force | Out-Null Mock Show-Error {} Mock Show-Message {} diff --git a/tests/actions/ini/remove.tests.ps1 b/tests/actions/ini/remove.tests.ps1 index a5200ab2..f58c7274 100644 --- a/tests/actions/ini/remove.tests.ps1 +++ b/tests/actions/ini/remove.tests.ps1 @@ -1,7 +1,7 @@  BeforeAll { $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\remove-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\remove-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) $script:testIniPath = "$TEST_DRIVE\php.ini" diff --git a/tests/actions/ini/restore.tests.ps1 b/tests/actions/ini/restore.tests.ps1 index 3fdf6281..fd50bbaf 100644 --- a/tests/actions/ini/restore.tests.ps1 +++ b/tests/actions/ini/restore.tests.ps1 @@ -1,7 +1,7 @@  BeforeAll { $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\restore-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\restore-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) $script:testIniPath = "$TEST_DRIVE\php.ini" diff --git a/tests/actions/ini/set.tests.ps1 b/tests/actions/ini/set.tests.ps1 index a7668ae7..b3e6afd6 100644 --- a/tests/actions/ini/set.tests.ps1 +++ b/tests/actions/ini/set.tests.ps1 @@ -1,7 +1,7 @@  BeforeAll { $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\set-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\set-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) $script:testIniPath = "$TEST_DRIVE\php.ini" @@ -9,7 +9,7 @@ BeforeAll { $script:testBackupPath = "$testIniPath.bak" New-Item -ItemType Directory -Path $TEST_DRIVE -Force | Out-Null - New-Item -ItemType Directory -Path $PVMConfig.paths.cache -Force | Out-Null + New-Item -ItemType Directory -Path $PVMConfig.paths.directories.cache -Force | Out-Null Mock Show-Warning {} Mock Show-Message {} diff --git a/tests/actions/ini/status.tests.ps1 b/tests/actions/ini/status.tests.ps1 index 376c0e34..2f067afb 100644 --- a/tests/actions/ini/status.tests.ps1 +++ b/tests/actions/ini/status.tests.ps1 @@ -1,7 +1,7 @@  BeforeAll { $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\status-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\status-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) $script:testIniPath = "$TEST_DRIVE\php.ini" @@ -9,7 +9,7 @@ BeforeAll { $script:testBackupPath = "$testIniPath.bak" New-Item -ItemType Directory -Path $TEST_DRIVE -Force | Out-Null - New-Item -ItemType Directory -Path $PVMConfig.paths.cache -Force | Out-Null + New-Item -ItemType Directory -Path $PVMConfig.paths.directories.cache -Force | Out-Null Mock Show-Warning {} Mock Write-Color {} diff --git a/tests/actions/install.tests.ps1 b/tests/actions/install.tests.ps1 index 04c6f18f..cbd52a83 100644 --- a/tests/actions/install.tests.ps1 +++ b/tests/actions/install.tests.ps1 @@ -1,10 +1,10 @@  BeforeAll { $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\install-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\install-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) - $script:PHP_DIR = $PVMConfig.paths.php + $script:PHP_DIR = $PVMConfig.paths.directories.php New-Item -ItemType Directory -Path $TEST_DRIVE -Force | Out-Null diff --git a/tests/actions/list.tests.ps1 b/tests/actions/list.tests.ps1 index c2831df0..f2663a47 100644 --- a/tests/actions/list.tests.ps1 +++ b/tests/actions/list.tests.ps1 @@ -1,7 +1,7 @@  BeforeAll { $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\list-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\list-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) New-Item -ItemType Directory -Path $TEST_DRIVE -Force | Out-Null diff --git a/tests/actions/log.tests.ps1 b/tests/actions/log.tests.ps1 index 8e68c762..c64ee152 100644 --- a/tests/actions/log.tests.ps1 +++ b/tests/actions/log.tests.ps1 @@ -1,7 +1,7 @@  BeforeAll { $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\log-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\log-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) New-Item -ItemType Directory -Path $TEST_DRIVE -Force | Out-Null @@ -139,7 +139,7 @@ Describe "Test-LogPageSize" { Describe "Get-LogEntries" { BeforeAll { - $script:LOG_ERROR_PATH = $PVMConfig.paths.logError + $script:LOG_ERROR_PATH = $PVMConfig.paths.files.logError New-Item -ItemType Directory -Path (Split-Path -Path $LOG_ERROR_PATH) -Force | Out-Null } @@ -321,7 +321,7 @@ Describe "Get-LogNavigation" { Describe "Show-Log" { BeforeAll { - $script:LOG_ERROR_PATH = $PVMConfig.paths.logError + $script:LOG_ERROR_PATH = $PVMConfig.paths.files.logError New-Item -ItemType Directory -Path (Split-Path -Path $LOG_ERROR_PATH) -Force | Out-Null } diff --git a/tests/actions/profile.tests.ps1 b/tests/actions/profile.tests.ps1 index aa3c74f4..1c615a33 100644 --- a/tests/actions/profile.tests.ps1 +++ b/tests/actions/profile.tests.ps1 @@ -1,13 +1,13 @@  BeforeAll { $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\profile-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\profile-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) - $script:PROFILES_PATH = $PVMConfig.paths.profiles - $script:TEMPLATES_PATH = $PVMConfig.paths.templates - $script:PROFILE_TEMPLATE_PATH = $PVMConfig.paths.profileTemplate - $script:EXAMPLE_PROFILE_PATH = $PVMConfig.paths.profileExample + $script:PROFILES_PATH = $PVMConfig.paths.directories.profiles + $script:TEMPLATES_PATH = $PVMConfig.paths.directories.templates + $script:PROFILE_TEMPLATE_PATH = $PVMConfig.paths.files.profileTemplate + $script:EXAMPLE_PROFILE_PATH = $PVMConfig.paths.files.profileExample New-Item -ItemType Directory -Path $TEST_DRIVE -Force | Out-Null New-Item -ItemType Directory -Path $PROFILES_PATH -Force | Out-Null diff --git a/tests/actions/run.tests.ps1 b/tests/actions/run.tests.ps1 index c4689d68..e2606ef6 100644 --- a/tests/actions/run.tests.ps1 +++ b/tests/actions/run.tests.ps1 @@ -2,7 +2,7 @@ BeforeAll { $script:PVMRootBackup = $PVMRoot $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\run-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\run-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) New-Item -ItemType Directory -Path $TEST_DRIVE -Force | Out-Null diff --git a/tests/actions/setup.tests.ps1 b/tests/actions/setup.tests.ps1 index 3753e32c..cd2774b4 100644 --- a/tests/actions/setup.tests.ps1 +++ b/tests/actions/setup.tests.ps1 @@ -2,7 +2,7 @@ BeforeAll { $script:PVMRootBackup = $PVMRoot $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\setup-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\setup-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) New-Item -ItemType Directory -Path $TEST_DRIVE -Force | Out-Null diff --git a/tests/actions/uninstall.tests.ps1 b/tests/actions/uninstall.tests.ps1 index 50f08bab..badf0926 100644 --- a/tests/actions/uninstall.tests.ps1 +++ b/tests/actions/uninstall.tests.ps1 @@ -1,7 +1,7 @@  BeforeAll { $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\uninstall-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\uninstall-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) New-Item -ItemType Directory -Path $TEST_DRIVE -Force | Out-Null diff --git a/tests/actions/use.tests.ps1 b/tests/actions/use.tests.ps1 index 4497f6a3..99036360 100644 --- a/tests/actions/use.tests.ps1 +++ b/tests/actions/use.tests.ps1 @@ -1,7 +1,7 @@  BeforeAll { $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\use-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\use-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) New-Item -ItemType Directory -Path $TEST_DRIVE -Force | Out-Null diff --git a/tests/core/bootstrap.tests.ps1 b/tests/core/bootstrap.tests.ps1 index ec98eddf..0e59d275 100644 --- a/tests/core/bootstrap.tests.ps1 +++ b/tests/core/bootstrap.tests.ps1 @@ -1,7 +1,7 @@  BeforeAll { $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\bootstrap-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\bootstrap-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) $PVMConfig.version = '1.0.0' diff --git a/tests/core/handlers.tests.ps1 b/tests/core/handlers.tests.ps1 index daf96a3e..c3fec21b 100644 --- a/tests/core/handlers.tests.ps1 +++ b/tests/core/handlers.tests.ps1 @@ -2,7 +2,7 @@ BeforeAll { $script:PVMRootBackup = $PVMRoot $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\handlers-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\handlers-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) Import-Module -Name PowerShellGet -ErrorAction SilentlyContinue diff --git a/tests/helpers/config.tests.ps1 b/tests/helpers/config.tests.ps1 index 34051ffb..05a64b03 100644 --- a/tests/helpers/config.tests.ps1 +++ b/tests/helpers/config.tests.ps1 @@ -2,12 +2,12 @@ BeforeAll { $script:PVMRootBackup = $PVMRoot $script:PVMConfigBackup = Copy-ObjectDeep -object $PVMConfig - $script:TEST_DRIVE = "$($PVMConfig.paths.fakeStorage)\config-drive" + $script:TEST_DRIVE = "$($PVMConfig.paths.directories.fakeStorage)\config-drive" $PVMConfig.test.setFakePaths.Invoke($TEST_DRIVE) - $script:TEMPLATES_PATH = $PVMConfig.paths.templates - $script:ALIASES_LIST_PATH = $PVMConfig.paths.aliasesList - $script:SCRIPTS_LIST_PATH = $PVMConfig.paths.scriptsList + $script:TEMPLATES_PATH = $PVMConfig.paths.directories.templates + $script:ALIASES_LIST_PATH = $PVMConfig.paths.files.aliasesList + $script:SCRIPTS_LIST_PATH = $PVMConfig.paths.files.scriptsList New-Item -ItemType Directory -Path $TEST_DRIVE -Force | Out-Null } @@ -406,14 +406,14 @@ MIN_LINE_LENGTH=50 It "Sets paths correctly" { $result = Get-Config -rootPath $testRoot - $result.paths.storage | Should -Be "$testRoot\storage" - $result.paths.php | Should -Be "$testRoot\storage\php" - $result.paths.data | Should -Be "$testRoot\storage\data" - $result.paths.templates | Should -Be "$testRoot\storage\data\templates" - $result.paths.cache | Should -Be "$testRoot\storage\data\cache" - $result.paths.profiles | Should -Be "$testRoot\storage\data\profiles" - $result.paths.log | Should -Be "$testRoot\storage\logs" - $result.paths.logError | Should -Be "$testRoot\storage\logs\error.log" + $result.paths.directories.storage | Should -Be "$testRoot\storage" + $result.paths.directories.php | Should -Be "$testRoot\storage\php" + $result.paths.directories.data | Should -Be "$testRoot\storage\data" + $result.paths.directories.templates | Should -Be "$testRoot\storage\data\templates" + $result.paths.directories.cache | Should -Be "$testRoot\storage\data\cache" + $result.paths.directories.profiles | Should -Be "$testRoot\storage\data\profiles" + $result.paths.directories.log | Should -Be "$testRoot\storage\logs" + $result.paths.files.logError | Should -Be "$testRoot\storage\logs\error.log" } It "Uses TEST_DRIVE from .env for fake storage when provided" { @@ -432,7 +432,7 @@ TEST_DRIVE=C:\fake-storage $result = Get-Config -rootPath $customRoot - $result.paths.fakeStorage | Should -Be 'C:\fake-storage' + $result.paths.directories.fakeStorage | Should -Be 'C:\fake-storage' } It "Falls back to storage/tests when TEST_DRIVE is not set" { @@ -450,7 +450,7 @@ MIN_LINE_LENGTH=50 $result = Get-Config -rootPath $fallbackRoot - $result.paths.fakeStorage | Should -Be "$fallbackRoot\storage\tests" + $result.paths.directories.fakeStorage | Should -Be "$fallbackRoot\storage\tests" } It "Falls back to storage/tests when TEST_DRIVE is not a valid path" { @@ -469,7 +469,7 @@ TEST_DRIVE=bad