Ejemplo n.º 1
0
        private PackageSource GetPackageSourceWithCredentials(NugetInputModel nugetInput)
        {
            var packageSource = new PackageSource(nugetInput.nugetFeedUrl)
            {
                Credentials = new PackageSourceCredential(nugetInput.nugetFeedUrl, nugetInput.nugetUsername,
                                                          nugetInput.nugetPassword,
                                                          nugetInput.IsPasswordClearText, null)
            };

            return(packageSource);
        }
Ejemplo n.º 2
0
        private SourceRepository SetupNugetRepository(NugetInputModel nugetInput)
        {
            if (nugetInput == null || string.IsNullOrEmpty(nugetInput.nugetFeedUrl) ||
                string.IsNullOrEmpty(nugetInput.nugetUsername) || string.IsNullOrEmpty(nugetInput.nugetPassword))
            {
                return(Repository.Factory.GetCoreV3("https://api.nuget.org/v3/index.json"));
            }

            var packageSource =
                GetPackageSourceWithCredentials(nugetInput);

            return(Repository.Factory.GetCoreV3(packageSource));
        }
Ejemplo n.º 3
0
        public NugetV3Service(
            NugetInputModel nugetInput,
            IFileSystem fileSystem,
            List <string> packageCachePaths,
            IGithubService githubService,
            ILogger logger,
            bool disableHashComputation
            )
        {
            _fileSystem             = fileSystem;
            _packageCachePaths      = packageCachePaths;
            _githubService          = githubService;
            _disableHashComputation = disableHashComputation;
            _logger = logger;

            _sourceRepository   = SetupNugetRepository(nugetInput);
            _sourceCacheContext = new SourceCacheContext();
            _cancellationToken  = CancellationToken.None;
        }