Beispiel #1
0
 public static TOutput RunCheckpoint <TInput, TOutput>(this ICheckpointRunner runner,
                                                       IAbstractCheckpoint <TInput, TOutput> wrapper,
                                                       TInput input,
                                                       ILoadingConvention <TInput, TOutput> loadingConvention)
 {
     return(runner.RunCheckpoint(wrapper.GetStepName(), wrapper.Run, input, loadingConvention));
 }
Beispiel #2
0
 public static TOutput RunCheckpoint <TInput, TOutput>(this ICheckpointRunner runner,
                                                       IAbstractCheckpoint <TInput, TOutput> wrapper,
                                                       TInput input,
                                                       INamingConvention <TOutput> namingConvention)
 {
     return(runner.RunCheckpoint(wrapper.GetStepName(), dir => wrapper.Run(input, dir), namingConvention));
 }
Beispiel #3
0
        public IParsingResult <IModeLauncher> Parse(
            MainParser main, ILogger logger, ISettings settings, ICheckpointRunner checkpointRunner,
            IWorkDoer workDoer, string[] args, TextWriter standardWriter, TextWriter errorWriter)
        {
            var results = main.GetParseResults(args);

            var parsingResult = checkpointRunner.RunCheckpoint("Validate input", () =>
            {
                if (!results.Validate(out IParsingResult <IModeLauncher> failedResult))
                {
                    return(ParsingResult <T> .FailedResult(failedResult.ErrorMessage));
                }
                var successfulResults = new SuccessfulResultCollection(results);
                var commonOptions     = successfulResults.Get(MainParser.CommonOptionsParser);
                return(GetSerializedResult(successfulResults, commonOptions));
            });

            if (!parsingResult.Success)
            {
                ShowError(main, logger.Error, parsingResult.ErrorMessage);
                return(ParsingResult <IModeLauncher> .FailedResult(parsingResult));
            }
            var runner = GetRunner(parsingResult.Result);

            return(ParsingResult <IModeLauncher> .SuccessfulResult(new ModeLauncher(logger, settings, checkpointRunner, workDoer, runner, args, main.GetVersion(), Name)));
        }
Beispiel #4
0
 public static TOutput RunCheckpoint <TConvention, TInput, TOutput>(this ICheckpointRunner runner,
                                                                    IMoveableResultCheckpoint <TConvention, TInput, TOutput> wrapper,
                                                                    TInput input,
                                                                    TConvention convention)
 {
     return(runner.RunCheckpoint(wrapper, input, wrapper.GetNamingConvention(convention)));
 }
Beispiel #5
0
 public static TResult RunCheckpoint <TResult>(this ICheckpointRunner runner, string name, Func <IDirectoryLocation, TResult> run, INamingConvention <TResult> namingConvention)
 {
     return(runner.RunCheckpoint(name, (dir, mover) =>
     {
         var result = run(dir);
         return namingConvention.Move(result, mover.Move);
     }));
 }
Beispiel #6
0
 public static TResult RunCheckpoint <TInput, TResult>(this ICheckpointRunner runner, string name, Func <TInput, IDirectoryLocation, TResult> run, TInput input, ILoadingConvention <TInput, TResult> loadingConvention)
 {
     return(runner.RunCheckpoint(name, (dir, mover) =>
     {
         var result = run(input, dir);
         loadingConvention.Move(result, mover.Move);
         return loadingConvention.Load(input);
     }, () => loadingConvention.Load(input)));
 }
Beispiel #7
0
        public static Task <TOutput> RunCheckpointAsync <TOutput>(this ICheckpointRunner runner,
                                                                  string key,
                                                                  Func <IDirectoryLocation, TOutput> run,
                                                                  INamingConvention <TOutput> namingConvention)
        {
            var asyncNamingConvention = new NamingConventionAsync <TOutput>(namingConvention);

            return(runner.RunCheckpoint(key, dir => Task.Run(() => run(dir)), asyncNamingConvention));
        }
Beispiel #8
0
 public SampleSet <TCanvasOutput> Run(SampleSet <TCanvasInput> inputs, SampleStubNamingConvention sampleStubNamingConvention, ICheckpointRunner checkpointRunner)
 {
     return(checkpointRunner.RunCheckpoint(_canvasCheckpoint, inputs, sampleStubNamingConvention));
 }
Beispiel #9
0
 public static Task <TResult> RunCheckpointAsync <TResult>(this ICheckpointRunner checkpointRunner, string checkpointName, Func <IDirectoryLocation, IFileMover, TResult> function, Func <TResult> load)
 {
     return(checkpointRunner.RunCheckpoint(checkpointName, (tempDir, fileMover) => Task.Run(() => function(tempDir, fileMover)), () => Task.Run(load)));
 }
Beispiel #10
0
 public static Task <TResult> RunCheckpointAsync <TResult>(this ICheckpointRunner checkpointRunner, string key, Func <TResult> run, Func <TResult> load)
 {
     return(checkpointRunner.RunCheckpoint(key, () => Task.Run(run), () => Task.Run(load)));
 }
Beispiel #11
0
 public static Task <TResult> RunCheckpointAsync <TResult>(this ICheckpointRunner checkpointRunner, string checkpointName, Func <TResult> function)
 {
     return(checkpointRunner.RunCheckpoint(checkpointName, () => Task.Run(function)));
 }
Beispiel #12
0
 public static TResult RunCheckpoint <TResult>(this ICheckpointRunner checkpointRunner, string checkpointName, Func <ICheckpointRunner, IDirectoryLocation, IFileMover, TResult> run)
 {
     return(checkpointRunner.RunCheckpoint(checkpointName, (tempDir, fileMover) => run(checkpointRunner, tempDir, fileMover)));
 }
Beispiel #13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="runner"></param>
        /// <param name="key"></param>
        /// <param name="wrapper"></param>
        /// <param name="input"></param>
        /// <param name="loadingConvention"></param>
        /// <typeparam name="TInput"></typeparam>
        /// <typeparam name="TOutput"></typeparam>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public static Task <TOutput> RunCheckpointAsync <TInput, TOutput>(this ICheckpointRunner runner, string key, ISandboxedCheckpoint <TInput, TOutput> wrapper, TInput input, ILoadingConvention <TInput, TOutput> loadingConvention)
        {
            var asyncLoadingConvention = new LoadingConventionAsync <TInput, TOutput>(loadingConvention);

            return(runner.RunCheckpoint(key, (tempInput, dir) => Task.Run(() => wrapper.Run(tempInput, dir)), input, asyncLoadingConvention));
        }