コード例 #1
0
        /// <summary>
        /// Spins a in-process webserver.
        /// </summary>
        /// <param name="path"></param>
        public static void Serve(DirectoryInfo path)
        {
            // Load the project and fetch the files
            using (var project = SiteProject.FromDisk(path))
            {
                // Rebuid everything first
                SiteProject.Bake(path, BakeMode.Fast);

                // Register the handler
                Service.Http.Register(new SiteHandler(project));

                // Spin Spike Engine on this thread
                Service.Listen(
                    new TcpBinding(IPAddress.Any, project.Configuration.Port)
                    );
            }
        }
コード例 #2
0
        /// <summary>
        /// Builds the project.
        /// </summary>
        /// <param name="path"></param>
        /// <param name="mode"></param>
        public static void Bake(DirectoryInfo path, BakeMode mode)
        {
            // Read the configuration file at destination
            var config = SiteConfig.Read(path);

            if (config.Languages == null || config.Languages.Count == 0)
            {
                // Make sure we have a default language
                config.Languages = new List <string>();
                config.Languages.Add("default");
            }

            Tracing.Info("Bake", "Baking: " + path.FullName);

            foreach (var language in config.Languages)
            {
                // Load the project and fetch the files
                using (var project = SiteProject.FromDisk(path, language))
                {
                    // Bake the project
                    project.Bake(mode);
                }
            }
        }