public static bool EnsureCKSetupStores(this IEnvLocalFeedProvider @this, IActivityMonitor m) { try { string EnsureStore(IEnvLocalFeed feed, Uri prototypeUrl) { string path = feed.PhysicalPath.AppendPart("CKSetupStore"); if (!System.IO.Directory.Exists(path)) { System.IO.Directory.CreateDirectory(path); } using (var s = LocalStore.OpenOrCreate(m, path)) { s.PrototypeStoreUrl = prototypeUrl; } return(path); } string masterStore = EnsureStore(@this.Release, Facade.DefaultStoreUrl); string developStore = EnsureStore(@this.CI, new Uri(masterStore)); string localStore = EnsureStore(@this.Local, new Uri(developStore)); return(true); } catch (Exception ex) { m.Error("While creating local CKSetup stores.", ex); return(false); } }
internal static void RemoveCKSetupComponents(IActivityMonitor m, IEnumerable <ArtifactInstance> instances, string storePath) { var ckSetupComponents = instances.Where(i => i.Artifact.Type == CKSetupClient.CKSetupType) .ToDictionary(i => i.Artifact.Name, i => i.Version); if (ckSetupComponents.Count > 0) { using (var cache = LocalStore.OpenOrCreate(m, storePath)) { cache.RemoveComponents(c => ckSetupComponents.TryGetValue(c.Name, out var v) && c.Version == v); } } }
public void CollectMissing(IEnvLocalFeed feed, IActivityMonitor m, IEnumerable <ArtifactInstance> artifacts, HashSet <ArtifactInstance> missing) { var ckSetup = artifacts.Where(i => i.Artifact.Type == CKSetupClient.CKSetupType) .Select(a => CKSetupArtifactLocalSet.ToComponentRef(a)).ToList(); if (ckSetup.Count > 0) { using (var store = LocalStore.OpenOrCreate(m, feed.GetCKSetupStorePath())) { foreach (var c in ckSetup) { if (!store.Contains(c.Name, c.TargetFramework, c.Version)) { missing.Add(CKSetupArtifactLocalSet.FromComponentRef(c)); } } } } }