Beispiel #1
0
        static async Task Main(string[] args)
        {
            try
            {
                var config = new ConfigurationBuilder()
                             .SetBasePath(Directory.GetCurrentDirectory())
                             .AddJsonFile("appsettings.json", optional: true)
                             .AddJsonFile("appsettings.production.json", optional: true)
                             .Build();

                var userMapper = new UserMapper();
                config.GetSection("UserMapper").Bind(userMapper);

                var gitLabSettings = new GitLabSettings();
                config.GetSection("GitLab").Bind(gitLabSettings);
                var gitLabConnector = new GitLabConnector(gitLabSettings);

                var gitHubSettings = new GitHubSettings();
                config.GetSection("GitHub").Bind(gitHubSettings);
                var gitHubConnector = new GitHubConnector(gitHubSettings, userMapper);

                var migration = new Migration(gitLabConnector, gitHubConnector);
                await migration.MigrateOneProject();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
        public GitLabService(GitLabSettings settings, IMemoryCache memoryCache)
        {
            _settings = settings ?? throw new ArgumentException($"App__GitLab__Url and App__GitLab__Token must be set");
            if (string.IsNullOrEmpty(_settings.Url))
            {
                throw new ArgumentException("App__GitLab__Url can not bu null or empty");
            }
            if (string.IsNullOrEmpty(_settings.Token))
            {
                throw new ArgumentException($"App__GitLab__Token can not bu null or empty");
            }

            _settings.Url = _settings.Url.TrimEnd('/');
            _memoryCache  = memoryCache;
        }
Beispiel #3
0
 public GitLabConnector(GitLabSettings gitLabSettings)
 {
     _gitLabSettings = gitLabSettings;
     _gitLabClient   = new GitLabClient(gitLabSettings.Url, gitLabSettings.AccessToken);
 }