コード例 #1
0
        public static async Task CreateCatalogAsync(string root, string feedRoot, string nupkgFolder, Uri baseUri, ILogger log)
        {
            using (var cache = new LocalCache())
            {
                var sleetConfig = CreateSleetConfig(root, feedRoot, baseUri);
                var settings    = LocalSettings.Load(sleetConfig);
                var fileSystem  = FileSystemFactory.CreateFileSystem(settings, cache, "feed");

                var success = await InitCommand.RunAsync(settings, fileSystem, enableCatalog : true, enableSymbols : false, log : log, token : CancellationToken.None);

                if (success != true)
                {
                    throw new InvalidOperationException("Catalog init failed");
                }

                if (Directory.GetFiles(nupkgFolder).Any())
                {
                    success = await PushCommand.PushPackages(settings, fileSystem, new List <string>() { nupkgFolder }, false, false, log, CancellationToken.None);

                    if (success != true)
                    {
                        throw new InvalidOperationException("Push failed");
                    }
                }
            }
        }
コード例 #2
0
        public static async Task CreateCatalogAsync(string root, string feedRoot, string nupkgFolder, Uri baseUri, int catalogPageSize, ILogger log)
        {
            using (var cache = new LocalCache())
            {
                var sleetConfig  = CreateSleetConfig(root, feedRoot, baseUri);
                var settings     = LocalSettings.Load(sleetConfig);
                var fileSystem   = FileSystemFactory.CreateFileSystem(settings, cache, "feed");
                var feedSettings = await FeedSettingsUtility.GetSettingsOrDefault(fileSystem, log, CancellationToken.None);

                feedSettings.CatalogEnabled  = true;
                feedSettings.SymbolsEnabled  = false;
                feedSettings.CatalogPageSize = catalogPageSize;

                var success = await InitCommand.InitAsync(settings, fileSystem, feedSettings, log, CancellationToken.None);

                if (success != true)
                {
                    throw new InvalidOperationException("Catalog init failed");
                }

                if (Directory.GetFiles(nupkgFolder).Any())
                {
                    success = await PushCommand.PushPackages(settings, fileSystem, new List <string>() { nupkgFolder }, false, false, log, CancellationToken.None);

                    if (success != true)
                    {
                        throw new InvalidOperationException("Push failed");
                    }
                }
            }
        }
コード例 #3
0
        public static async Task PushPackagesAsync(string root, string nupkgFolder, Uri baseUri, ILogger log)
        {
            var sleetConfig = Path.Combine(root, "sleet.json");

            if (Directory.GetFiles(nupkgFolder).Any())
            {
                using (var cache = new LocalCache())
                {
                    var settings   = LocalSettings.Load(sleetConfig);
                    var fileSystem = FileSystemFactory.CreateFileSystem(settings, cache, "feed");

                    var success = await PushCommand.PushPackages(settings, fileSystem, new List <string>() { nupkgFolder }, true, false, log, CancellationToken.None);

                    if (success != true)
                    {
                        throw new InvalidOperationException("Push failed");
                    }
                }
            }
        }