-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Exception while trying to run Cake.MinVer with minver-cli installed as global tool #5
Comments
I wonder is this is more a cake issue... |
@dario-griffo-cko Thanks for reporting this and for the detailed repro! I see the same error on my end. I'll investigate this over the weekend and see if there's an easy fix, but at first glance it seems that the issue is on my end. I think I missed the difference between running global tools and local tools and I'm always assuming it's a local tool. When installing MinVer as a local tool, you can only run it using either In Cake.MinVer, I'm running |
@dario-griffo-cko I've just released a pre-release package on NuGet that should fix the issue of running MinVer as a global tool. If you have a chance, could you take it for a spin? I'd also appreciate any feedback on the implementation, if you think there's room for improvement. #addin "nuget:?package=Cake.MinVer&version=0.2.0-preview&prerelease=true"
var version = MinVer();
Task("Example")
.Does(context =>
{
context.Information($"Version: {version.Version}");
context.Information($"Major: {version.Major}");
context.Information($"Minor: {version.Minor}");
context.Information($"Patch: {version.Patch}");
context.Information($"PreRelease: {version.PreRelease}");
context.Information($"BuildMetadata: {version.BuildMetadata}");
});
RunTarget("Example"); I'll do some more tests and I'm planning to release an RTM version some time tomorrow. ImplementationI tried to do what I thought Microsoft was doing for me automatically (but as you found out, they weren't) of using the tool that is closer to the project, i.e.:
It's easy to detect if I considered a few different approaches:
Whilst I didn't particularly love any of these approaches, I ended up going with number 2. Number 1 seemed cleaner than all the others at first but, again, because I believe this tool is going to be used as a local tool most of the time, I didn't want to add the overhead of Thus, in a nutshell, I am running I added a couple more settings to tweak this behavior, so that if you know you're running a global tool in the path, or if you are running a global tool from a specific known location (tool-path), you can tell Cake.MinVer to skip trying to run the local tool, and run the global tool first, and you can also disable the fallback as well: var settings = new MinVerSettings
{
// Runs global tool first, fallback to local tool (unless NoFallback = true). Defaults to false.
PreferGlobalTool = true,
// Disable fallback in case of errors (i.e. only run one of the tools, either local (default)
// or global (if PreferGlobalTool = true)). Defaults to false.
NoFallback = true,
};
var version = MinVer(settings); or the same thing but with the extension methods:
I'll update the README after PR #7 is merged and before an RTM version is released: |
@dario-griffo-cko FYI stable version v0.2.0 released to nuget.org (release notes). |
I have been using the Cake.MinVer as local tool without problems, but today decided to give a try as a global tool and cannot run it.
What did I do?
Result
Result:
change the cake file to be
Result:
The text was updated successfully, but these errors were encountered: