Beispiel #1
0
        public XWorld(
            FileSystem fileSystem,
            IWorldName worldName,
            WorldStore worldStore,
            IEnvLocalFeedProvider localFeeds,
            SecretKeyStore keyStore,
            ArtifactCenter artifacts,
            CommandRegister commandRegister,
            IBasicApplicationLifetime appLife,
            Initializer initializer)
            : base(initializer)
        {
            _localFeeds = localFeeds;
            _fileSystem = fileSystem;

            _userMonitorFilter = initializer.Monitor.Output.Clients.OfType <IActivityMonitorFilteredClient>().FirstOrDefault();
            if (_userMonitorFilter == null)
            {
                throw new InvalidOperationException();
            }

            bool isPublic = initializer.Reader.HandleRequiredAttribute <bool>("IsPublic");

            _world = new World(commandRegister, artifacts, worldStore, worldName, isPublic, _localFeeds, keyStore, _userMonitorFilter, appLife)
            {
                VersionSelector = new ReleaseVersionSelector()
            };
            _world.DumpWorldStatus += (o, e) => OnDumpWorldStatus(e.Monitor);
            initializer.Services.Add(_world);
            fileSystem.ServiceContainer.Add <ISolutionDriverWorld>(_world);
        }
Beispiel #2
0
        public void FileSystem_remotes_contains_the_remote_branches()
        {
            _commandRegister.UnregisterAll();
            var            w        = new WorldMock();
            SecretKeyStore keyStore = new SecretKeyStore();

            using (var fs = new FileSystem(LocalTestHelper.WorldFolder, _commandRegister, keyStore, new SimpleServiceContainer()))
            {
                fs.ServiceContainer.Add(keyStore);
                var proto = fs.FindOrCreateProtoGitFolder(TestHelper.Monitor, w, "TestGitRepository", LocalTestHelper.TestGitRepositoryUrl);
                fs.EnsureGitFolder(TestHelper.Monitor, proto);

                var f = fs.GetFileInfo("TestGitRepository/remotes/");
                f.IsDirectory.Should().BeTrue();
                f.Name.Should().Be("remotes");
                f.PhysicalPath.Should().BeNull();

                var c = fs.GetDirectoryContents("/TestGitRepository/remotes");
                c.Exists.Should().BeTrue();
                c.Should().OnlyContain(d => d.IsDirectory);
                c.Select(d => d.Name)
                .Should().Contain(new[] { "origin" });

                var fO = fs.GetFileInfo("/TestGitRepository/remotes/" + c.Single().Name);
                fO.IsDirectory.Should().BeTrue();
                fO.Name.Should().Be(c.Single().Name);
                fO.PhysicalPath.Should().BeNull();

                var cO = fs.GetDirectoryContents("/TestGitRepository/remotes/" + c.Single().Name);
                cO.Exists.Should().BeTrue();
                cO.Should().OnlyContain(d => d.IsDirectory);
                cO.Select(d => d.Name)
                .Should().Contain(new[] { "master" });
            }
        }
Beispiel #3
0
 public AppveyorFile(GitFolder f, SolutionDriver driver, SolutionSpec settings, SecretKeyStore keyStore, SharedWorldState sharedState, NormalizedPath branchPath)
     : base(f, branchPath, branchPath.AppendPart("appveyor.yml"))
 {
     _driver       = driver;
     _solutionSpec = settings;
     _keyStore     = keyStore;
     _sharedState  = sharedState;
 }
Beispiel #4
0
 internal INuGetFeed HandleFeed(SecretKeyStore keyStore, string url, string name, SimpleCredentials creds)
 {
     Debug.Assert(_feed == null && url.Equals(Url, StringComparison.OrdinalIgnoreCase));
     if (creds.IsSecretKeyName)
     {
         keyStore.DeclareSecretKey(creds.PasswordOrSecretKeyName, (s) => "PAT Used to authenticate CKli to the feeds, and retrieve informations about NuGet packages");
     }
     return(_feed = new ReadFeed(this, name, creds));
 }
Beispiel #5
0
 public NPMRCFiles(GitFolder f, NPMProjectsDriver driver, SolutionDriver solutionDriver, SecretKeyStore secretStore, SolutionSpec solutionSpec, NormalizedPath branchPath)
     : base(f, branchPath)
 {
     _solutionDriver = solutionDriver;
     _solutionSpec   = solutionSpec;
     _driver         = driver;
     _secretStore    = secretStore;
     _solutionDriver.OnSolutionConfiguration += OnSolutionConfiguration;
 }
Beispiel #6
0
 internal INuGetFeed HandleFeed(SecretKeyStore keyStore, string url, string name, SimpleCredentials creds)
 {
     Debug.Assert(_feed == null && url.Equals(Url, StringComparison.OrdinalIgnoreCase));
     if (creds?.IsSecretKeyName == true)
     {
         keyStore.DeclareSecretKey(creds.PasswordOrSecretKeyName, current => current?.Description
                                   ?? $"Used to enable CKli to retrieve informations about NuGet packages from feed '{name}' and to configure NuGet.config file.");
     }
     return(_feed = new ReadFeed(this, name, creds));
 }
Beispiel #7
0
        public NuGetClient(HttpClient httpClient, SecretKeyStore keyStore)
        {
            HttpClient     = httpClient;
            SecretKeyStore = keyStore;
            var c = new SourceCacheContext()
            {
                NoCache = true
            };

            SourceCache            = c.WithRefreshCacheTrue();
            _sourcePackageProvider = new SourcePackageProvider();
        }
Beispiel #8
0
 public XNuGetClient(
     HttpClient sharedHttpClient,
     SecretKeyStore secretKeyStore,
     ArtifactCenter artifact,
     IEnvLocalFeedProvider localFeedProvider,
     FileSystem fs,
     Initializer initializer)
     : base(initializer)
 {
     _nuGetClient = new NuGetClient(sharedHttpClient, secretKeyStore);
     localFeedProvider.Register(new EnvLocalFeedProviderNuGetHandler());
     fs.ServiceContainer.Add(_nuGetClient);
     artifact.Register(_nuGetClient);
     initializer.Services.Add(this);
 }
Beispiel #9
0
 public CKSetupStore(
     SecretKeyStore keyStore,
     HttpClient sharedHttpClient,
     Uri url,
     string name)
 {
     _sharedHttpClient = sharedHttpClient;
     _keyStore         = keyStore;
     Url           = url;
     Name          = name;
     SecretKeyName = name != "Public"
                     ? $"CKSETUPREMOTESTORE_{name.ToUpperInvariant()}_PUSH_API_KEY"
                     : "CKSETUPREMOTESTORE_PUSH_API_KEY";
     UniqueRepositoryName = CKSetupClient.CKSetupType.Name + ':' + name;
     _keyStore.DeclareSecretKey(SecretKeyName, current => current?.Description ?? $"Required to push to '{UniqueRepositoryName}'.");
 }
Beispiel #10
0
 public NugetConfigFile(GitFolder f, SolutionDriver driver, IEnvLocalFeedProvider localFeedProvider, SecretKeyStore secretStore, SolutionSpec s, NormalizedPath branchPath)
     : base(f, branchPath, branchPath.AppendPart("NuGet.config"), null)
 {
     _localFeedProvider = localFeedProvider;
     _solutionSpec      = s;
     _solutionDriver    = driver;
     _secretStore       = secretStore;
     if (IsOnLocalBranch)
     {
         f.OnLocalBranchEntered += OnLocalBranchEntered;
         f.OnLocalBranchLeaving += OnLocalBranchLeaving;
     }
     _solutionDriver.OnStartBuild            += OnStartBuild;
     _solutionDriver.OnZeroBuildProject      += OnZeroBuildProject;
     _solutionDriver.OnSolutionConfiguration += OnSolutionConfiguration;
 }
 public CodeCakeBuilderKeyVaultFile(
     CodeCakeBuilderFolder f,
     SolutionDriver driver,
     SolutionSpec solutionSpec,
     SecretKeyStore secretStore,
     SharedWorldState sharedState,
     NormalizedPath branchPath)
     : base(f.GitFolder, branchPath, f.FolderPath.AppendPart("CodeCakeBuilderKeyVault.txt"))
 {
     _f            = f;
     _driver       = driver;
     _secretStore  = secretStore;
     _sharedState  = sharedState;
     _solutionSpec = solutionSpec;
     _secretStore.DeclareSecretKey(SolutionDriver.CODECAKEBUILDER_SECRET_KEY, current => current?.Description
                                   ?? $"Allows update of CodeCakeBuilderKeyVault.txt used by CI/CD processes. This secret must be managed only by people that have access to the CI/CD processes and their configuration.");
 }
Beispiel #12
0
 public NPMClient(HttpClient httpClient, SecretKeyStore keyStore)
 {
     HttpClient     = httpClient;
     SecretKeyStore = keyStore;
 }
Beispiel #13
0
 public CKSetupClient(SecretKeyStore keyStore, HttpClient sharedHttpClient)
 {
     _keyStore         = keyStore;
     _sharedHttpClient = sharedHttpClient;
 }
Beispiel #14
0
 public CKSetupStore(SecretKeyStore keyStore, HttpClient sharedHttpClient)
     : this(keyStore, sharedHttpClient, Facade.DefaultStoreUrl, "Public")
 {
 }