-
Notifications
You must be signed in to change notification settings - Fork 75
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
Add function VM-Get-Category to retrieve the category from the nuspec #1272
Conversation
334ab62
to
42b0194
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice first step to move the categories to the nuspec! 😄
07f3d18
to
e9754f3
Compare
# Returns the category if the tags exist in the nuspec | ||
function VM-Get-Category { | ||
$installPath = $MyInvocation.MyCommand.Definition | ||
$toolDir = "$(Split-Path -parent (Split-Path -parent $installPath))" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to our documentation $toolDir
should only be used for directory where the tool is actually installed. We need a different name here. I think you can also remove the "
$toolDir = "$(Split-Path -parent (Split-Path -parent $installPath))" | |
$chocolateyToolDir = $(Split-Path -parent (Split-Path -parent $installPath)) |
function VM-Get-Category { | ||
$installPath = $MyInvocation.MyCommand.Definition | ||
$toolDir = "$(Split-Path -parent (Split-Path -parent $installPath))" | ||
$packageName = Split-Path -Path (Split-Path -parent $installPath) | Split-Path -Leaf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can get the package name from the environment variable ChocolateyPackageName
$toolDir = "$(Split-Path -parent (Split-Path -parent $installPath))" | ||
$packageName = Split-Path -Path (Split-Path -parent $installPath) | Split-Path -Leaf | ||
$nuspec = $packageName + ".nuspec" | ||
if (Test-Path ($toolDir)){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the directory must exist, otherwise we return an invalid category here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ana06 if $toolDir doesn't exist, the return value should be None?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is it possible that it does not exists? I think it MUST exists and you should check it with VM-Assert-Path
or -Resolve
which would raise an exception if it does not exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah ok, so I remove the condition Test-Path, I misunderstood your comment, thanks!
42b0194
to
7576727
Compare
scripts/test/lint.py
Outdated
@@ -94,6 +94,7 @@ class IncludesRequiredFieldsOnly(Lint): | |||
"description", | |||
"authors", | |||
"dependencies", | |||
"tags", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this change and add it after all packages have the category in the nuspec.
@@ -3,7 +3,7 @@ Import-Module vm.common -Force -DisableNameChecking | |||
|
|||
try { | |||
$toolName = '010Editor' | |||
$category = 'Hex Editors' | |||
$category = VM-Get-Category($MyInvocation.MyCommand.Definition) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documenting discussion: It is a good idea to edit two packages (common and an extra one) in this PR to test VM-Get-Category
. But it is a good idea to split the update of other packages in separate PR (for example 30 packages per PR) so that the CI takes less to run and we do not encounter any issues when pushing the packages to MyGet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note the issue with 010Editor (just in case you notice slow local testing or CI): #1275
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ana06 2 test packages have been removed from current PR
ec6ff24
to
e48bcf5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ed87abc
to
90c6e5a
Compare
Retrieves the category from the nuspec file through the helper function `VM-Get-Category` Make lint.py compatible with the new nuspec format: add tags to the list of required tags and validate categories from the nuspec file
Comment out the line that validates the categories from the chocolatey install package. This needs to be termporarily disabled until the new linter is ready and all the packages have the new structure. This is needed because the choco install package won't longer have a category, it will read it from the nuspec instead.
90c6e5a
to
944cddf
Compare
Retrieves the category from the nuspec file through the helper function
VM-Get-Category
Make lint.py compatible with the new nuspec format: add tags to the list of required tags and validate categories from the nuspec file
Closes #1107