Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#2860) Add new PowerShell helper function for acquiring paths from private variables #2861

Merged
merged 5 commits into from
Oct 19, 2022

Conversation

AdmiringWorm
Copy link
Member

Description Of Changes

This pull request adds a new PowerShell helper that can be used going forward to get access to the private environment variable PackagePath, as well as to get the installation directory of Chocolatey CLI.

Motivation and Context

There is no direct replacement for using the environment variable $env:PackagPath and $env:ChocolateyPackagePath that can be used by maintainers (at least on Chocolatey Community Repository.).
As such it makes sense to add this ability to maintainers through the use of a new cmdlet that can be used.

Testing

  1. Mainly tested by running new tests in test kitchen.

But manual testing can be done with:

  1. Create a new nupkg package of the source files located in tests/packages/test-chocolateypath.
  2. Run choco install <PATH-TO-NUPKG>
  3. Ensure the package outputs the expected values for the package path, and the install path.
  4. Run choco uninstall test-chocolateypath
  5. Ensure the package outputs the expected values for the package path and install path both for the before modify script and the uninstall script.

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)
  • PowerShell code changes.

Related Issue

Fixes #2860

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 v2 compatibility checked.

@coveralls
Copy link

coveralls commented Oct 18, 2022

Coverage Status

Coverage decreased (-0.05%) to 27.582% when pulling dcf859e on AdmiringWorm:new-path-helper into baac40f on chocolatey:release/1.2.0.

@AdmiringWorm AdmiringWorm marked this pull request as ready for review October 19, 2022 11:06
This commit adds a new PowerShell helper to Chocolatey CLI
that allows maintainers to acquire the paths that we have stored
as private/internal environment variables.

This allows maintainers to still make use of these variables through
this new helper while still retaining the ability to push the package
to Chocolatey Community Repository.
This commit adds the `--pin` option to the list of available
options in the table completion.
The pin option was added to the install and upgrade command in this
release.
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 83b6d99 into chocolatey:release/1.2.0 Oct 19, 2022
@gep13
Copy link
Member

gep13 commented Oct 19, 2022

@AdmiringWorm thanks for getting this updated!

@AdmiringWorm AdmiringWorm deleted the new-path-helper branch October 22, 2022 18:01
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.

3 participants