Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
 private async Task Render()
 {
     var command = new RunRenderCommand(this.Config, this.LastRunState, this.Engines);
     await command.ExecuteAsync();
 }
Ejemplo n.º 3
0
        public void Run(CommandLine commandLine)
        {
            var config = this.LoadConfig(commandLine.SitePath, commandLine.OutputPath);

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

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

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

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

                default:
                    throw new InvalidOperationException($"Unknown ProcessingCommand: {commandLine.Command}");
            }

            this.SaveLastRunState(commandLine.SitePath, lastRunState);
        }
Ejemplo n.º 4
0
 private void Render()
 {
     var command = new RunRenderCommand(this.Config, this.LastRunState, this.Engines);
     command.Execute();
 }