Badgerati / Fudge

Fudge is a PowerShell tool to help manage software packages via Chocolatey for specific development projects. Think NPM and Bower, but for Chocolatey
MIT License
21 stars 3 forks source link

Latest version detection not always working #67

Closed jayvdb closed 5 years ago

jayvdb commented 5 years ago

When using develop branch, I am seeing a problem with the code added in https://github.com/Badgerati/Fudge/pull/55

The variable '$latest' cannot be retrieved because it has not been set.

See https://ci.appveyor.com/project/jayvdb/mobans/builds/25484849/job/fgbips38471hguug

And latest https://gitlab.com/coala/mobans/merge_requests/130

Badgerati commented 5 years ago

Ah, it'll be because you're setting Set-StrictMode -Version Latest in the scripts.

I'll get that set in Fudge and fix any other issues; but removing that as a temporarily solution should work.

Badgerati commented 5 years ago

I just quickly tried having Strict enabled, and I don't think it's feasible. I had a Fudgefile with no source defined, and it failed immediately because the JSON didn't have that property. This also happens in other areas as well, such as detecting if pre/post scripts are supplied. (If you have no script block, it errors).

jayvdb commented 5 years ago

ok, I'll see if I can disable and re-enable it around Fudge invocation.

jayvdb commented 5 years ago

But worth noting that im only seeing it in develop, and with the recently add $latest enhancement, probably because I am only directly using Invoke-Chocolatey (and Get-Fudgefile.. too)

Badgerati commented 5 years ago

It is strange how it's flagging on the $latest variable with strict set, but not with everything else that should be throwing 🤔 .

I've ran it quite a few times, but the only time I get the error is when strict is enabled; and failures just before that for source in the Fudgefile.

If having strict on for you is working at the moment, except for $latest, and you need strict; I can put the fix in, as it's only a line.