public void Start()
        {
            _controller = _input.BuildRemoteController();
            var context = new StorytellerContext(_controller, _input);

            if (_controller.BinPath.IsEmpty())
            {
                throw new Exception("Could not determine any BinPath for the testing AppDomain. Has the Storyteller specification project been compiled, \nor is Storyteller using the wrong compilation target maybe?\n\ntype 'st.exe ? open' or st.exe ? run' to see the command usages\n\n");
            }

            context.Start();

            var registry = new FubuRegistry();


            registry.AlterSettings<DiagnosticsSettings>(_ => _.TraceLevel = TraceLevel.Verbose);
            registry.Mode = "development";
            registry.HostWith<NOWIN>();
            registry.Services.For<IRemoteController>().Use(_controller);
            registry.Services.For<StorytellerContext>().Use(context);
            
            registry.Services.IncludeRegistry<WebApplicationRegistry>();


            _server = registry.ToRuntime();
        }
        public void Start()
        {
            _controller = _input.BuildRemoteController();
            var context = new StorytellerContext(_controller, _input);

            if (_controller.BinPath.IsEmpty())
            {
                throw new Exception("Could not determine any BinPath for the testing AppDomain. Has the Storyteller specification project been compiled, \nor is Storyteller using the wrong compilation target maybe?\n\ntype 'st.exe ? open' or st.exe ? run' to see the command usages\n\n");
            }

            context.Start();

            var registry = new FubuRegistry();


            registry.AlterSettings <DiagnosticsSettings>(_ => _.TraceLevel = TraceLevel.Verbose);
            registry.Mode = "development";
            registry.HostWith <NOWIN>();
            registry.Services.For <IRemoteController>().Use(_controller);
            registry.Services.For <StorytellerContext>().Use(context);

            registry.Services.IncludeRegistry <WebApplicationRegistry>();


            _server = registry.ToRuntime();
        }
Пример #3
0
        public void Start()
        {
            _controller = _input.BuildRemoteController();
            var context = new StorytellerContext(_controller, _input);

            var container = new Container(new WebApplicationRegistry(_controller, context));

            context.Start();

            var registry = new FubuRegistry();
            registry.AlterSettings<DiagnosticsSettings>(_ => _.TraceLevel = TraceLevel.Verbose);

            _server = FubuApplication.For(registry).StructureMap(container).RunEmbeddedWithAutoPort();
        }
Пример #4
0
        public void Start()
        {
            Controller = _input.BuildRemoteController();
            var context = new StorytellerContext(Controller, _input);

            Controller.AssertValid();


            context.Start();

            var port = PortFinder.FindPort(5000);

            if (_input.WebSocketAddressFlag.IsNotEmpty())
            {
                port = new Uri(_input.WebSocketAddressFlag).Port;
            }


            BaseAddress = "http://localhost:" + port;

            var webSockets = new WebSocketsHandler();


            var webSocketsAddress = $"ws://127.0.0.1:{port}";

            // TODO -- fugly as hell. Either do it all the SM way, or rip out SM
            var registry = new WebApplicationRegistry(webSocketsAddress, webSockets, Controller, context);

            _container = new Container(registry);



            var baseDirectory = AppContext.BaseDirectory;
            var host          = new WebHostBuilder()
                                .UseKestrel()
                                .UseContentRoot(baseDirectory)
                                .UseUrls($"http://localhost:{port}")
                                .Configure(app =>
            {
                app.UseWebSockets();

                app.Use(async(http, next) =>
                {
                    if (http.WebSockets.IsWebSocketRequest)
                    {
                        await webSockets.HandleSocket(http).ConfigureAwait(false);
                    }
                    else
                    {
                        await next().ConfigureAwait(false);
                    }
                });

                app.UseStaticFiles(new StaticFileOptions
                {
                    ServeUnknownFileTypes = true,
                    FileProvider          = new PhysicalFileProvider(baseDirectory)
                });

                app.Run(async(http) =>
                {
                    var endpoint = _container.GetInstance <HomeEndpoint>();
                    var html     = endpoint.Index().ToString();

                    http.Response.ContentType = "text/html";
                    await http.Response.WriteAsync(html).ConfigureAwait(false);
                });
            });

            _server = host.Start();


            Controller.AddListener(_container.GetInstance <IClientConnector>());

            _container.GetInstance <AssetFileWatcher>().Start();

            var persistence = _container.GetInstance <IPersistenceController>();

            persistence.StartWatching(context.SpecPath);
            context.AddRemoteListener(persistence);
        }