Esempio n. 1
0
 /// <summary>
 /// Gets all package files.
 /// </summary>
 /// <param name="m">The monitor to use.</param>
 /// <returns>The package files.</returns>
 public static IEnumerable <LocalNuGetPackageFile> GetAllNuGetPackageFiles(this IEnvLocalFeed @this, IActivityMonitor m)
 {
     return(System.IO.Directory
            .EnumerateFiles(@this.PhysicalPath, "*.nupkg")
            .Where(f => !f.EndsWith(".symbols.nupkg"))
            .Select(f => LocalNuGetPackageFile.Parse(f)));
 }
        public bool PushLocalArtifacts(IEnvLocalFeed feed, IActivityMonitor m, IArtifactRepository target, IEnumerable <ArtifactInstance> artifacts, bool arePublicArtifacts)
        {
            if (!target.HandleArtifactType(CKSetupClient.CKSetupType))
            {
                return(true);
            }
            string localStore = feed.GetCKSetupStorePath();

            return(target.PushAsync(m, new CKSetupArtifactLocalSet(artifacts, localStore, arePublicArtifacts)).GetAwaiter().GetResult());
        }
 public void CollectMissing(IEnvLocalFeed feed, IActivityMonitor m, IEnumerable <ArtifactInstance> artifacts, HashSet <ArtifactInstance> missing)
 {
     foreach (var n in artifacts)
     {
         if (n.Artifact.Type == NPMClient.NPMType)
         {
             if (feed.GetNPMPackageFile(m, n.Artifact.Name, n.Version) == null)
             {
                 missing.Add(n);
             }
         }
     }
 }
 public void Remove(IEnvLocalFeed feed, IActivityMonitor m, IEnumerable <ArtifactInstance> artifacts)
 {
     foreach (var n in artifacts)
     {
         if (n.Artifact.Type == NPMClient.NPMType)
         {
             var f = NPMEnvLocalFeedProviderExtension.GetNPMPackagePath(feed.PhysicalPath, n.Artifact.Name, n.Version);
             if (System.IO.File.Exists(f))
             {
                 System.IO.File.Delete(f);
                 m.Info($"Removed {n} from {feed.PhysicalPath}.");
             }
         }
     }
 }
        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));
                        }
                    }
                }
            }
        }
        public bool PushLocalArtifacts(IEnvLocalFeed feed, IActivityMonitor m, IArtifactRepository target, IEnumerable <ArtifactInstance> artifacts, bool arePublicArtifacts)
        {
            if (!target.HandleArtifactType(NuGetClient.NuGetType))
            {
                return(true);
            }
            var locals = new List <LocalNuGetPackageFile>();

            foreach (var a in artifacts)
            {
                var local = feed.GetNuGetPackageFile(m, a.Artifact.Name, a.Version);
                if (local == null)
                {
                    m.Error($"Unable to find local package {a} in {feed.PhysicalPath}.");
                    return(false);
                }
                locals.Add(local);
            }
            return(target.PushAsync(m, new NuGetArtifactLocalSet(locals, arePublicArtifacts)).GetAwaiter().GetResult());
        }
 public void Remove(IEnvLocalFeed feed, IActivityMonitor m, IEnumerable <ArtifactInstance> artifacts)
 {
     CKSetupEnvLocalFeedProviderExtension.RemoveCKSetupComponents(m, artifacts, feed.GetCKSetupStorePath());
 }
Esempio n. 8
0
        /// <summary>
        /// Gets a package or null if not found.
        /// </summary>
        /// <param name="m">The monitor to use.</param>
        /// <param name="packageId">The package name.</param>
        /// <param name="v">The package version.</param>
        /// <returns>The local package file or null if not found.</returns>
        public static LocalNuGetPackageFile GetNuGetPackageFile(this IEnvLocalFeed @this, IActivityMonitor m, string packageId, SVersion v)
        {
            var f = GetPackagePath(@this.PhysicalPath, packageId, v);

            return(System.IO.File.Exists(f) ? new LocalNuGetPackageFile(f, packageId, v) : null);
        }
Esempio n. 9
0
 /// <summary>
 /// Gets the best version for a NuGet package.
 /// </summary>
 /// <param name="m">The monitor to use.</param>
 /// <param name="packageId">The package name.</param>
 /// <returns>The version or null if not found.</returns>
 public static SVersion GetBestNuGetVersion(this IEnvLocalFeed @this, IActivityMonitor m, string packageId)
 {
     return(EnvLocalFeedProviderExtension.GetMaxVersionFromFeed(@this.PhysicalPath, packageId));
 }
 public static string GetCKSetupStorePath(this IEnvLocalFeed @this)
 {
     return(@this.PhysicalPath.AppendPart(CKSetupStoreName));
 }
Esempio n. 11
0
 public static IEnumerable <LocalNPMPackageFile> GetAllNPMPackageFiles(this IEnvLocalFeed @this, IActivityMonitor m)
 {
     return(NPMEnvLocalFeedProviderExtension.GetAllNPMPackageFiles(m, @this.PhysicalPath));
 }