private static void Main(string[] args) { var versionProvider = new CleanCodeToolVersionProvider(); versionProvider.GetLastVersion() .Then( meta => versionProvider.DownloadAndExtractToDirectory(meta, CliDirectory.WithSubDirectory("Tool"))) .Then(_ => CreateRunFile()) .Then(_ => SetToPathIfNeed()) .OnFail(ConsoleHelper.LogError); }
private static bool NewVersionWasInstalled() { var versionProvider = new CleanCodeToolVersionProvider(IsDeveloperMode()); return(versionProvider.GetLastVersion() .Then(meta => { if (meta.Version.Equals(CurrentVersion)) { return false; } return versionProvider .DownloadAndExtractToDirectory(meta, CliDirectory.WithSubDirectory("new-tool")) .Then(_ => true); }) .OnFail(ConsoleHelper.LogError) .GetValueOrThrow()); }