public void Execute() { this.Config.LiveReloadScript = "<script type=\"text/javascript\" src=\"http://livejs.com/live.js\"></script>"; var thread = new Thread(RenderThread); try { using (var documentsWatcher = this.CreateWatcher(this.Config.DocumentsPath)) using (var filesWatcher = this.CreateWatcher(this.Config.FilesPath)) using (var layoutsWatcher = this.CreateWatcher(this.Config.LayoutsPath)) { documentsWatcher.EnableRaisingEvents = true; filesWatcher.EnableRaisingEvents = true; layoutsWatcher.EnableRaisingEvents = true; thread.Start(this); var serve = new RunServeCommand(); serve.Config = this.Config; serve.Execute(); } } finally { this.Waits[(int)EventTypes.EndWatch].Set(); thread.Join(); } }
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); }
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); }