示例#1
0
        public async Task Run(CommandLine commandLine)
        {
            var config = await this.LoadConfig(commandLine.SitePath, commandLine.OutputPath);

            var lastRunState = await this.LoadLastRunState(commandLine.SitePath);

            switch (commandLine.Command)
            {
                case ProcessingCommand.Render:
                    {
                        var engines = RenderingEngine.Load();
                        var command = new RunRenderCommand(config, lastRunState, engines);
                        await command.ExecuteAsync();

                        lastRunState = command.LastRunState;
                    }
                    break;

                case ProcessingCommand.Serve:
                    {
                        var command = new RunServeCommand();
                        command.Config = config;
                        command.Execute();
                    }
                    break;

                case ProcessingCommand.Watch:
                    {
                        var engines = RenderingEngine.Load();
                        var command = new RunWatchCommand(config, lastRunState, engines);
                        command.Execute();
                    }
                    break;

                default:
                    throw new InvalidOperationException(String.Format("Unknown ProcessingCommand: {0}", commandLine.Command));
            }

            await this.SaveLastRunState(commandLine.SitePath, lastRunState);
        }
示例#2
0
 private async Task Render()
 {
     var command = new RunRenderCommand(this.Config, this.LastRunState, this.Engines);
     await command.ExecuteAsync();
 }