-
-
Save orient-man/c29c299ed970fd097f80124ffde734ce to your computer and use it in GitHub Desktop.
Finds outdated NuGet references (with Paket)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module OutdatedPackages | |
#r "../../../packages/FAKE/tools/FakeLib.dll" | |
open System | |
open Fake | |
let timeout = TimeSpan.FromMinutes 5. | |
let parseOutput (lines: string seq) = | |
lines | |
|> Seq.fold (fun state line -> | |
match state, line.Trim() with | |
| (false, list), "Outdated packages found:" -> true, list | |
| (true, list), "Performance:" -> false, list | |
| (true, list), line when line.StartsWith "* " -> true, line :: list | |
| state, _ -> state) (false, []) | |
|> snd | |
|> List.rev | |
let filterByPrefix prefix (msg: string) = | |
if msg.StartsWith("* " + prefix) then true else trace msg; false | |
let runPaket () = | |
ProcessHelper.ExecProcessAndReturnMessages | |
(fun psi -> | |
psi.FileName <- ".paket/paket.exe" | |
psi.Arguments <- "outdated") | |
timeout | |
|> fun r -> r.Messages | |
let target packagePrefix = | |
runPaket () | |
|> parseOutput | |
|> List.filter (filterByPrefix packagePrefix) | |
|> function [] -> () | any -> failwithf "Outdated packages found: %A" any |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment