Пример #1
0
        protected virtual void PushPackageToCIRepository(
            SolutionPackageBase solutionPackage,
            List <SolutionPackageBase> solutionDependencies,
            NuGetSolutionPackageService packagingService,
            bool useLocal
            )
        {
            IPackageRepository repo = null;

            if (solutionDependencies != null)
            {
                foreach (var soutionDependency in solutionDependencies)
                {
                    if (useLocal)
                    {
                        var filePath = Path.Combine(LocalNuGetRepositoryFolderPath,
                                                    String.Format("{0}.{1}.nupkg", soutionDependency.Id, soutionDependency.Version));
                        packagingService.PackToFile(soutionDependency, filePath);
                    }
                    else
                    {
                        WithCINuGetContext((apiUrl, apiKey, repoUrl) =>
                        {
                            packagingService.Push(soutionDependency, apiUrl, apiKey);
                        });
                    }
                }
            }

            if (useLocal)
            {
                var filePath = Path.Combine(LocalNuGetRepositoryFolderPath,
                                            String.Format("{0}.{1}.nupkg", solutionPackage.Id, solutionPackage.Version));
                packagingService.PackToFile(solutionPackage, filePath);
            }
            else
            {
                WithCINuGetContext((apiUrl, apiKey, repoUrl) =>
                {
                    packagingService.Push(solutionPackage, apiUrl, apiKey);
                });
            }
        }
Пример #2
0
        private void Can_Push_Internal(NuGetSolutionPackageService packagingService)
        {
            WithCINuGetContext((apiUrl, apiKey, repoUrl) =>
            {
                var solutionPackage = CreateNewSolutionPackage(packagingService);

                UpdatePackageVersion(solutionPackage);
                packagingService.Push(solutionPackage, apiUrl, apiKey);

                var ciRepo    = PackageRepositoryFactory.Default.CreateRepository(repoUrl);
                var ciPackage = ciRepo.FindPackageSafe(solutionPackage.Id);

                Assert.IsNotNull(ciPackage);

                Trace.WriteLine(string.Format("Found package:[{0}]", ciPackage));
            });
        }