From 2b78272a940ba75862b212d4b4b4f08c1b2ac784 Mon Sep 17 00:00:00 2001 From: "J.P. Hutchins" Date: Sat, 22 Jun 2024 19:10:11 -0700 Subject: [PATCH 1/2] fix: remove ENVR_ added environment variables; add test --- envr.ps1 | 10 +++++++++- tests/sh/test_project_options.sh | 2 ++ tests/windows/test_project_options.ps1 | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/envr.ps1 b/envr.ps1 index 666690e..9e0edb8 100644 --- a/envr.ps1 +++ b/envr.ps1 @@ -529,7 +529,15 @@ function global:unsource ([switch]$NonDestructive) { if (Get-Variable -Name "ENVR_ROOT" -ErrorAction SilentlyContinue) { Remove-Variable -Name ENVR_ROOT -Scope Global -Force - } + } + + # Remove project options: + if (Test-Path -Path env:ENVR_ROOT) { + Remove-Item -Path env:ENVR_ROOT + } + if (Test-Path -Path env:ENVR_PROJECT_NAME) { + Remove-Item -Path env:ENVR_PROJECT_NAME + } # Remove variables leftover from script run # $_VAR_REMOVE_LIST = diff --git a/tests/sh/test_project_options.sh b/tests/sh/test_project_options.sh index 88ca7c5..e6632bc 100644 --- a/tests/sh/test_project_options.sh +++ b/tests/sh/test_project_options.sh @@ -25,5 +25,7 @@ unsource assertEqual "$OLD_PATH" "$PATH" assertEqual "$OLD_ALS" "$(alias)" +assertEqual "" "$ENVR_PROJECT_NAME" +assertEqual "" "$ENVR_ROOT" exit $RES \ No newline at end of file diff --git a/tests/windows/test_project_options.ps1 b/tests/windows/test_project_options.ps1 index fd6a450..4d52de1 100644 --- a/tests/windows/test_project_options.ps1 +++ b/tests/windows/test_project_options.ps1 @@ -16,5 +16,8 @@ function global:project_options () { $PS1_OUT = prompt 6>&1 $TEST_RES += assertEqual $OLD_PS1_OUT $PS1_OUT + $TEST_RES += assertEqual $null $env:ENVR_PROJECT_NAME + $TEST_RES += assertEqual $null $env:ENVR_ROOT + return $TEST_RES } \ No newline at end of file From 9882b2fed16c23a859850d87ac34ed92f8982b24 Mon Sep 17 00:00:00 2001 From: "J.P. Hutchins" Date: Sat, 22 Jun 2024 19:10:52 -0700 Subject: [PATCH 2/2] version: 0.5.5 -> 0.5.6 --- envr.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/envr.ps1 b/envr.ps1 index 9e0edb8..7cdc69d 100644 --- a/envr.ps1 +++ b/envr.ps1 @@ -1,4 +1,4 @@ -# envr v0.5.5 +# envr v0.5.6 # https://www.github.com/JPHutchins/envr # https://www.crumpledpaper.tech