DanGough / Nevergreen

This module is an alternative to Evergreen, and allows you to find the latest version and download URL for various Windows apps. Evergreen uses API queries to obtain its data whereas this module is more focussed on web scraping. This is more prone to breaking when websites are changed, hence the name.
The Unlicense
73 stars 17 forks source link

Module version not playing nicely with #Requires statement #3

Closed DanGough closed 3 years ago

DanGough commented 3 years ago

For some reason, most likely a bug in Powershell, if you add this Requires statement to your code:

#Requires -Modules @{ ModuleName='Nevergreen'; ModuleVersion='2105.2' }

It fails with:

ResourceUnavailable: The script 'AutoPackager.ps1' cannot be run because the following modules that are specified by the "#requires" statements of the script are missing: Nevergreen.

Yet it works if you retry!

I suspect this might be down to the version format used. I have copied the version format used by Evergreen, i.e. YYMM.Build, except my first release was 2105.001. However when I published the module it was coming up as 2105.1. Seeing that it stripped the preceeding zeroes, I just called the next release 2105.2 in the module manifest.

Visiting the Powershell Gallery at https://www.powershellgallery.com/packages/Nevergreen though redirects to 2105.1 instead of the latest version, which is odd, and the reason why I suspect the version being a cause.

DanGough commented 3 years ago

Next release will be 2105.100 to see if it alleviates this.

DanGough commented 3 years ago

I think this is resolved now.

When publishing the module, empty folders are removed. The Private folder was empty, and a non-existent Private folder was throwing an error during the init of import-module. Adding -ErrorAction Ignore to the line that scans for functions there seems to have sorted it!