Exemple #1
0
        public int?Run(string[] argv)
        {
            try
            {
                var args = new MainArgs(argv, version: _version);
                if (args.Failed)
                {
                    _console.WriteLine(args.FailMessage);
                    return(args.FailErrorCode);
                }

                var gitData = ResolveGitData(_console, args);

                var settings = LoadSettings(args);

                var metadata = CoverageMetadataResolver.Resolve(args);

                var app    = new CoverallsPublisher(_console, _fileSystem);
                var result = app.Run(settings, gitData.ValueOrDefault(), metadata);
                if (!result.Successful)
                {
                    ExitWithError(result.Error);
                }

                return(null);
            }
            catch (ExitException ex)
            {
                _console.WriteErrorLine(ex.Message);
                return(1);
            }
        }
Exemple #2
0
        public int?Run(string[] argv)
        {
            try
            {
                var args = new MainArgs(argv, version: _version);
                if (args.Failed)
                {
                    _console.WriteLine(args.FailMessage !);
                    return(args.FailErrorCode);
                }

                var metadata = CoverageMetadataResolver.Resolve(args, _environmentVariables);

                if (args.OptCompleteParallelWork)
                {
                    var repoToken = ResolveRepoToken(args);

                    var pushResult = _coverallsService.PushParallelCompleteWebhook(repoToken, metadata.ServiceBuildNumber);
                    if (!pushResult.Successful)
                    {
                        ExitWithError(pushResult.Error);
                    }

                    return(null);
                }

                var settings = LoadSettings(args);

                var gitData = ResolveGitData(_console, args);

                var app    = new CoverallsPublisher(_console, _fileSystem, _coverallsService);
                var result = app.Run(settings, gitData, metadata);
                if (!result.Successful)
                {
                    ExitWithError(result.Error);
                }

                return(null);
            }
            catch (ExitException ex)
            {
                _console.WriteErrorLine(ex.Message);
                return(1);
            }
        }