Exemplo n.º 1
0
        public static object CreateRunner <TSettings>(ICakeContext context)
            where TSettings : MkDocsSettings
        {
            object result = null;

            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (typeof(TSettings) == typeof(MkDocsVersionSettings))
            {
                result = new MkDocsVersionRunner(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools);
            }
            else if (typeof(TSettings) == typeof(MkDocsNewSettings))
            {
                result = new MkDocsNewRunner(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools);
            }
            else if (typeof(TSettings) == typeof(MkDocsBuildSettings))
            {
                result = new MkDocsBuildRunner(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools);
            }
            else if (typeof(TSettings) == typeof(MkDocsServeSettings))
            {
                result = new MkDocsServeRunner(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools);
            }
            else if (typeof(TSettings) == typeof(MkDocsServeAsyncSettings))
            {
                result = new MkDocsServeAsyncRunner(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools);
            }
            else if (typeof(TSettings) == typeof(MkDocsGhDeploySettings))
            {
                result = new MkDocsGhDeployRunner(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools);
            }

            return(result ?? throw new ArgumentException("Unknown settings."));
        }
Exemplo n.º 2
0
 protected override Task RunTool()
 {
     var tool = new MkDocsServeAsyncRunner(FileSystem, Environment, ProcessRunner, Tools);
     return tool.ServeAsync(_projectDirectory, Settings);
 }