public void UpdateCollaborationPlatformSettings(CollaborationPlatformSettings settings)
        {
            settings.Username = Username;
            var envToken = _environmentVariablesProvider.GetEnvironmentVariable("NuKeeper_bitbucket_token");

            settings.Token    = Concat.FirstValue(envToken, settings.Token);
            settings.ForkMode = settings.ForkMode ?? ForkMode.SingleRepositoryOnly;
        }
示例#2
0
 public CollaborationFactory(IEnumerable <ISettingsReader> settingReaders,
                             INuKeeperLogger nuKeeperLogger, IHttpClientFactory httpClientFactory)
 {
     _settingReaders    = settingReaders;
     _nuKeeperLogger    = nuKeeperLogger;
     _httpClientFactory = httpClientFactory;
     Settings           = new CollaborationPlatformSettings();
 }
示例#3
0
        public void UpdateCollaborationPlatformSettings(CollaborationPlatformSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            var envToken = _environmentVariablesProvider.GetEnvironmentVariable(GiteaTokenEnvironmentVariableName);

            settings.Token = Concat.FirstValue(envToken, settings.Token);
        }
示例#4
0
        public void UpdateCollaborationPlatformSettings(CollaborationPlatformSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            var envToken = _environmentVariablesProvider.GetEnvironmentVariable("NuKeeper_azure_devops_token");

            settings.Token    = Concat.FirstValue(envToken, settings.Token);
            settings.ForkMode = settings.ForkMode ?? ForkMode.SingleRepositoryOnly;
        }
示例#5
0
        public void UpdateCollaborationPlatformSettings(CollaborationPlatformSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            var envToken = _environmentVariablesProvider.GetEnvironmentVariable("NuKeeper_github_token");

            settings.Token = Concat.FirstValue(envToken, settings.Token);
            settings.ForkMode ??= ForkMode.PreferFork;
        }
示例#6
0
        public void UpdatesAuthenticationTokenFromTheEnvironment()
        {
            _environmentVariablesProvider.GetEnvironmentVariable("NuKeeper_gitlab_token").Returns("envToken");

            var settings = new CollaborationPlatformSettings
            {
                Token = "accessToken",
            };

            _gitlabSettingsReader.UpdateCollaborationPlatformSettings(settings);

            Assert.AreEqual(settings.Token, "envToken");
        }
示例#7
0
        public void AuthSettings_GetsCorrectSettingsFromEnvironment()
        {
            _environmentVariablesProvider.GetEnvironmentVariable("NuKeeper_github_token").Returns("envToken");

            var settings = new CollaborationPlatformSettings
            {
                Token = "accessToken",
            };

            _gitHubSettingsReader.UpdateCollaborationPlatformSettings(settings);

            Assert.AreEqual("envToken", settings.Token);
        }
        public void AuthSettings_GetsCorrectSettingsFromEnvironment()
        {
            var settings = new CollaborationPlatformSettings
            {
                Token = "accessToken",
            };

            Environment.SetEnvironmentVariable("NuKeeper_azure_devops_token", "envToken");
            AzureSettingsReader.UpdateCollaborationPlatformSettings(settings);
            Environment.SetEnvironmentVariable("NuKeeper_azure_devops_token", null);

            Assert.AreEqual(settings.Token, "envToken");
        }
示例#9
0
        public void UpdateCollaborationPlatformSettings(CollaborationPlatformSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            settings.Username = Concat.FirstValue(Username, _environmentVariablesProvider.GetUserName());

            var envToken = _environmentVariablesProvider.GetEnvironmentVariable("NuKeeper_bitbucketlocal_token");

            settings.Token    = Concat.FirstValue(envToken, settings.Token);
            settings.ForkMode = settings.ForkMode ?? ForkMode.SingleRepositoryOnly;
        }
示例#10
0
        public void UpdateSettings_UpdatesSettings()
        {
            var settings = new CollaborationPlatformSettings
            {
                Token      = "accessToken",
                BaseApiUrl = new Uri("https://github.custom.com/")
            };

            _gitHubSettingsReader.UpdateCollaborationPlatformSettings(settings);

            Assert.IsNotNull(settings);
            Assert.AreEqual(new Uri("https://github.custom.com/"), settings.BaseApiUrl);
            Assert.AreEqual("accessToken", settings.Token);
            Assert.AreEqual(ForkMode.PreferFork, settings.ForkMode);
        }
示例#11
0
        public void UpdateSettings_UpdatesSettings()
        {
            var settings = new CollaborationPlatformSettings
            {
                Token      = "accessToken",
                BaseApiUrl = new Uri("https://internalserver/tfs/")
            };

            AzureSettingsReader.UpdateCollaborationPlatformSettings(settings);

            Assert.IsNotNull(settings);
            Assert.AreEqual(settings.BaseApiUrl, "https://internalserver/tfs/");
            Assert.AreEqual(settings.Token, "accessToken");
            Assert.AreEqual(settings.ForkMode, ForkMode.SingleRepositoryOnly);
        }
 public BitbucketLocalRepositoryDiscovery(INuKeeperLogger logger, ICollaborationPlatform collaborationPlatform, CollaborationPlatformSettings settings)
 {
     _logger = logger;
     _collaborationPlatform = collaborationPlatform;
     _setting = settings;
 }
 public void UpdateCollaborationPlatformSettings(CollaborationPlatformSettings settings)
 {
     settings.Username = Concat.FirstValue(Username, Environment.UserName);
     UpdateTokenSettings(settings);
     settings.ForkMode = settings.ForkMode ?? ForkMode.SingleRepositoryOnly;
 }
示例#14
0
 public void UpdateCollaborationPlatformSettings(CollaborationPlatformSettings settings)
 {
     UpdateTokenSettings(settings);
     settings.ForkMode = settings.ForkMode ?? ForkMode.SingleRepositoryOnly;
 }
示例#15
0
        public void UpdateCollaborationPlatformSettings(CollaborationPlatformSettings settings)
        {
            var envToken = _environmentVariablesProvider.GetEnvironmentVariable(GiteaTokenEnvironmentVariableName);

            settings.Token = Concat.FirstValue(envToken, settings.Token);
        }
示例#16
0
        private static void UpdateTokenSettings(CollaborationPlatformSettings settings)
        {
            var envToken = Environment.GetEnvironmentVariable("NuKeeper_azure_devops_token");

            settings.Token = Concat.FirstValue(envToken, settings.Token);
        }
示例#17
0
 public void UpdateCollaborationPlatformSettings(CollaborationPlatformSettings settings)
 {
     UpdateTokenSettings(settings);
     settings.ForkMode = settings.ForkMode ?? ForkMode.PreferFork;
 }