Beispiel #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."));
        }
        protected override void RunTool()
        {
            var tool = new MkDocsGhDeployRunner(FileSystem, Environment, ProcessRunner, Tools);

            tool.GhDeploy(Settings);
        }