예제 #1
0
        static void Main(string[] args)
        {
            string coreToolsVersion = GetCliVersion(args[0]);

            if (NuGetVersion.TryParse(coreToolsVersion, out NuGetVersion ver))
            {
                var coreToolsInfo = new CoreToolsInfo(coreToolsVersion, ver.Major, args[0]);

                // update this feed for Functions v2 only.
                if (ver.Major == 2)
                {
                    GenerateNewFeed(Constants.FeedV1AndV2Only, coreToolsInfo);
                }

                // update this feed for Functions v2 and v3
                GenerateNewFeed(Constants.FeedAllVersions, coreToolsInfo);

                // update v4 format feed for Functions v2 and v3
                GenerateNewFeed(Constants.FeedV4FormatAllVersions, coreToolsInfo);
            }
            else
            {
                throw new Exception($"Could not parse the version for core tools located at '{args[0]}'");
            }
        }
예제 #2
0
        public static void GenerateNewFeed(string feedName, CoreToolsInfo coreToolsInfo)
        {
            Console.WriteLine();
            Console.WriteLine($"Preparing CLI feed for version: '{coreToolsInfo.Version}' for feed: '{feedName}'");

            JObject    feedJson = GetFeedJSON(feedName);
            FeedFormat format   = _feedNameToFormat[feedName];

            if (TryUpdateFeedWithNewToolsAndTemplates(feedJson, format, coreToolsInfo))
            {
                string path = Path.Combine(coreToolsInfo.ArtifactsDirectory, feedName);
                WriteToJsonFile(feedJson, path);
            }
            else
            {
                Console.WriteLine($"WARNING: No existing entries found for version {coreToolsInfo.MajorVersion} in {feedName}. You may have to manually add a version before this tool will work. Skipping this feed.");
            }
        }
예제 #3
0
        private static JObject GetNewReleaseEntryJson(JObject currentReleaseEntry, FeedFormat format, CoreToolsInfo coreToolsInfo)
        {
            IFeedEntryUpdater feedEntryUpdater = FeedEntryUpdaterFactory.GetFeedEntryUpdater(format);

            return(feedEntryUpdater.GetUpdatedFeedEntry(currentReleaseEntry, coreToolsInfo));
        }
예제 #4
0
 private static bool TryUpdateFeedWithNewToolsAndTemplates(JObject feed, FeedFormat format, CoreToolsInfo coreToolsInfo)
 {
     try
     {
         // Get a cloned object to not modify the exisiting release
         JObject currentReleaseEntryJson = GetCurrentReleaseEntry(feed, coreToolsInfo.MajorVersion).DeepClone() as JObject;
         JObject newReleaseEntryJson     = GetNewReleaseEntryJson(currentReleaseEntryJson, format, coreToolsInfo);
         return(TryAddNewReleaseToFeed(feed, newReleaseEntryJson, coreToolsInfo.MajorVersion));
     }
     catch
     {
         return(false);
     }
 }