TinySite.Commands.RunRenderCommand.Execute C# (CSharp) Method

Execute() public method

public Execute ( ) : IEnumerable
return IEnumerable
        public IEnumerable<LastRunDocument> Execute()
        {
            // Load the site documents.
            //
            var site = this.LoadSite(this.Config, this.InitialLastRunState, this.Engines.Keys);

            // Order the documents.
            //
            this.Order(site);

            // Paginate the documents.
            //
            this.Paginate(site);

            // TODO: do any other sweeping updates to the documents here.

            // Render the documents.
            //
            this.Render(site, this.Engines);

            return this.LastRunState = this.CalculateLastRunState(site).ToList();
        }

Usage Example

Ejemplo n.º 1
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);
        }
All Usage Examples Of TinySite.Commands.RunRenderCommand::Execute