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

            tool.New(_projectDirectory, Settings);
        }