This publisher publishes Google API packages to NuGet main repository.
Example #1
0
        /// <summary>Publishes new APIs to NuGet main repository.</summary>
        async Task PublishAsync(IEnumerable <DiscoveryItem> apis)
        {
            // TODO(peleyal): validate NuGetApiKey
            foreach (var item in apis)
            {
                var workingDir = Path.Combine(DownloadBundleTempDirectory,
                                              item.Name + "-" + item.Version);
                Directory.CreateDirectory(workingDir);

                var bundleUri = string.Format(DownloadUriFormat, item.Name, item.Version);
                if (!string.IsNullOrEmpty(options.GoogleApisVersion))
                {
                    bundleUri = bundleUri + "&lv=" + options.GoogleApisVersion;
                }

                var publisher = new NuGetApiPublisher(item)
                {
                    BundleDirectory   = workingDir,
                    BundleUri         = new Uri(bundleUri),
                    TemplateDirectory = TemplateDirectory,
                    NuGetApiKey       = options.NuGetApiKey,
                };

                try
                {
                    await publisher.Run();
                }
                catch (Exception ex)
                {
                    TraceSource.TraceEvent(TraceEventType.Error, "{0}\t Exception [{1}] occurred", item, ex.Message);
                }
            }
        }
Example #2
0
 /// <summary>
 /// Tests the main logic behave as expected. <see cref="NuGetApiPublisher.Test"/> for more details.
 /// </summary>
 async Task TestAsync(IEnumerable <DiscoveryItem> apis)
 {
     foreach (var item in apis)
     {
         var publisher = new NuGetApiPublisher(item)
         {
             TemplateDirectory = TemplateDirectory,
         };
         try
         {
             await publisher.Test(options.ApisDirectory);
         }
         catch (Exception ex)
         {
             TraceSource.TraceEvent(TraceEventType.Error, "{0}\t Exception [{1}] occurred", item, ex.Message);
         }
     }
 }
 /// <summary>
 /// Tests the main logic behave as expected. <see cref="NuGetApiPublisher.Test"/> for more details.
 /// </summary>
 async Task TestAsync(IEnumerable<DiscoveryItem> apis)
 {
     foreach (var item in apis)
     {
         var publisher = new NuGetApiPublisher(item)
             {
                 TemplateDirectory = TemplateDirectory,
             };
         try
         {
             await publisher.Test(options.ApisDirectory);
         }
         catch (Exception ex)
         {
             TraceSource.TraceEvent(TraceEventType.Error, "{0}\t Exception [{1}] occurred", item, ex.Message);
         }
     }
 }
        /// <summary>Publishes new APIs to NuGet main repository.</summary>
        async Task PublishAsync(IEnumerable<DiscoveryItem> apis)
        {
            // TODO(peleyal): validate NuGetApiKey
            foreach (var item in apis)
            {
                var workingDir = Path.Combine(DownloadBundleTempDirectory,
                    item.Name + "-" + item.Version);
                Directory.CreateDirectory(workingDir);

                var bundleUri = string.Format(DownloadUriFormat, item.Name, item.Version);
                if (!string.IsNullOrEmpty(options.GoogleApisVersion))
                {
                    bundleUri = bundleUri + "&lv=" + options.GoogleApisVersion;
                }

                var publisher = new NuGetApiPublisher(item)
                    {
                        BundleDirectory = workingDir,
                        BundleUri = new Uri(bundleUri),
                        TemplateDirectory = TemplateDirectory,
                        NuGetApiKey = options.NuGetApiKey,
                    };

                try
                {
                    await publisher.Run();
                }
                catch (Exception ex)
                {
                    TraceSource.TraceEvent(TraceEventType.Error, "{0}\t Exception [{1}] occurred", item, ex.Message);
                }
            }
        }