public void IncrementAndUpdateAll() { b.Verbose.Log("IncrementAndUpdateAll called"); ValidateForUpdate(); LoadVersioningComponent(); b.Verbose.Log("Versioning Loaded "); ver.Increment(); b.Verbose.Log("Saving"); SaveVersioningComponent(); b.Verbose.Log($"Searching {BaseSearchDir} there are {pendingUpdates.Count} pends."); var enumer = Directory.EnumerateFiles(BaseSearchDir, "*.*", SearchOption.AllDirectories).GetEnumerator(); bool shouldContinue = true; while (shouldContinue) { try { shouldContinue = enumer.MoveNext(); if (shouldContinue) { var v = enumer.Current; // Check every file that we have returned. foreach (var chk in pendingUpdates.Keys) { var mm = new Minimatcher(chk, new Options { AllowWindowsPaths = true, IgnoreCase = true }); b.Verbose.Log($"Checking {chk} against {v}"); if (mm.IsMatch(v)) { b.Info.Log("Match..."); // TODO Cache this and make it less loopey VersionFileUpdater sut = new VersionFileUpdater(ver); foreach (var updateType in pendingUpdates[chk]) { b.Verbose.Log($"Perform update {v}"); sut.PerformUpdate(v, updateType); } } } } } catch (System.UnauthorizedAccessException) { // If you run through all the filles in a directory you can hit areas of the filesystem // that you dont have access to - this skips those files and then continues. b.Verbose.Log("Unauthorised area of the filesystem, skipping"); } } VersionString = ver.GetVersionString(); }
public Versioning(VersionStorage jvp, bool dryRun = false) { b.Verbose.Log($"Versioning Online - DryRun {dryRun}"); testMode = dryRun; repo = jvp; cv = repo.GetVersion(); vfu = new VersionFileUpdater(cv); fileUpdateMinmatchers.Add(FileUpdateType.NetAssembly, new List <string>()); fileUpdateMinmatchers[FileUpdateType.NetAssembly].Add("**\\properties\\assemblyinfo.cs"); fileUpdateMinmatchers[FileUpdateType.NetAssembly].Add("**\\properties\\commonassemblyinfo.cs"); fileUpdateMinmatchers.Add(FileUpdateType.Nuspec, new List <string>()); fileUpdateMinmatchers[FileUpdateType.Nuspec].Add("**\\*.nuspec"); }