Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@AdmiringWorm
Copy link
Member

@AdmiringWorm AdmiringWorm commented Jun 30, 2023

Description Of Changes

These changes extracts all of the environment variables that we
make use of while running Chocolatey CLI. Both variables that are
used as part of running package scripts, and variables we use
only when they are set on the system.

A change to make these environment variables and all other internal
types available to other products and the test projects has been made.

Motivation and Context

To be able to have a single location to add and use environment variable names from.

Testing

N/A. Need to be ran through test kitchen.

Operating Systems Testing

  • Windows 10

Change Types Made

  • Bug fix (non-breaking change).
  • Feature / Enhancement (non-breaking change).
  • Breaking change (fix or feature that could cause existing functionality to change).
  • Documentation changes.
  • PowerShell code changes.

Change Checklist

  • Requires a change to the documentation.
  • Documentation has been updated.
  • Tests to cover my changes, have been added.
  • All new and existing tests passed?
  • PowerShell code changes: PowerShell v2 compatibility checked?

Related Issue

fixes #3675

@AdmiringWorm AdmiringWorm self-assigned this Jun 30, 2023
@AdmiringWorm AdmiringWorm requested a review from gep13 June 30, 2023 11:12
@AdmiringWorm AdmiringWorm force-pushed the environment-variables branch 2 times, most recently from df1f840 to 76676a3 Compare June 30, 2023 12:04
@AdmiringWorm AdmiringWorm marked this pull request as draft June 30, 2023 12:49
@AdmiringWorm
Copy link
Member Author

Putting this back to draft, as we can not make all internal types available for dependent projects.

@AdmiringWorm AdmiringWorm force-pushed the environment-variables branch from 76676a3 to bf0d8b9 Compare June 30, 2023 13:55
@AdmiringWorm AdmiringWorm marked this pull request as ready for review June 30, 2023 13:56
@gep13 gep13 added this to the 2.5.0 milestone May 29, 2025
@AdmiringWorm AdmiringWorm changed the title (maint) Extract all used environment variables (#3675) Extract all used environment variables Jun 2, 2025
@AdmiringWorm AdmiringWorm force-pushed the environment-variables branch 2 times, most recently from e489690 to 7cfa192 Compare June 2, 2025 13:16
@AdmiringWorm AdmiringWorm marked this pull request as draft June 2, 2025 13:16
@AdmiringWorm
Copy link
Member Author

Converted this PR to draft until it is ready to be reviewed.

@AdmiringWorm AdmiringWorm force-pushed the environment-variables branch 3 times, most recently from c507e12 to c439222 Compare June 3, 2025 08:43
@AdmiringWorm AdmiringWorm marked this pull request as ready for review June 3, 2025 11:20
@AdmiringWorm
Copy link
Member Author

@gep13 this PR is now ready for review.

@AdmiringWorm AdmiringWorm force-pushed the environment-variables branch 4 times, most recently from e48a233 to a20eed7 Compare June 5, 2025 13:50
These changes extracts all of the environment variables that we
make use of while running Chocolatey CLI. Both variables that are
used as part of running package scripts, and variables we use
only when they are set on the system.

A change to make these environment variables and all other internal
types available to other products and the test projects has been made.
…sources

Update EnvironmentVariables class to reference constants from
chocolatey.StringResources instead of hardcoded strings. Mark the
old EnvironmentVariables class as obsolete to enforce usage of the
new centralized resource definitions.

Refactor Helpers/Paths.cs and Helpers/EnvironmentHelper.cs to use
EnvironmentVariables.System.Path for PATH variable access and
modification, ensuring consistency with the updated resource usage.

These changes improve maintainability by consolidating environment
variable names in a single source and prevent duplication errors.
@AdmiringWorm AdmiringWorm force-pushed the environment-variables branch from a20eed7 to bffbb2d Compare June 5, 2025 15:28
…E template

Change the placeholder from ChocolateyPackageExitCode to
{EnvironmentVariables.Package.ChocolateyExitCode} to reflect the
correct environment variable name used for the script exit code.
This improves accuracy and consistency in the documentation.
Copy link
Member

@gep13 gep13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@gep13 gep13 merged commit fca4582 into chocolatey:develop Jun 5, 2025
5 checks passed
@gep13
Copy link
Member

gep13 commented Jun 5, 2025

@AdmiringWorm great work here! Thanks for getting this done!

@AdmiringWorm AdmiringWorm deleted the environment-variables branch June 6, 2025 12:18
@gep13 gep13 removed this from the 2.5.0 milestone Jul 4, 2025
@gep13
Copy link
Member

gep13 commented Jul 4, 2025

I have removed this PR from the milestone, since the issue #3675 is already contained in the milestone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor Environment Variable Usage into Centralized Constants Class

2 participants