Run() public method

This is the main logic, which does the following: Download the API's bundle from "https://google-api-client-libraries.appspot.com/" Extract the API's sources Build the sources Create a NuGet package Publish the package to NuGet main repository
Leave the NuGetApiKey empty to avoid publishing to NuGet main repository
public Run ( ) : System.Threading.Tasks.Task
return System.Threading.Tasks.Task
Esempio n. 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);
                }
            }
        }
        /// <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);
                }
            }
        }