Esempio n. 1
0
        public void Execute(string[] arguments)
        {
            Settings.Parse(arguments);

            var fileSystem = new FileSystem();

            if (string.IsNullOrWhiteSpace(Path))
            {
                Path = Directory.GetCurrentDirectory();
            }

            if (string.IsNullOrWhiteSpace(Engine))
            {
                Engine = InferEngineFromDirectory(Path, fileSystem);
            }

            ISiteEngine engine;

            if (engineMap.TryGetValue(Engine, out engine))
            {
                var context = new SiteContext { Folder = Path };
                engine.Initialize(fileSystem, context);
                engine.Process();
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("Cannot find engine for input: '{0}'", Engine);
            }
        }
Esempio n. 2
0
        public void Execute(string[] arguments)
        {
            Tracing.Info("bake - transforming content into a website");

            Settings.Parse(arguments);

            if (string.IsNullOrWhiteSpace(Path))
            {
                Path = Directory.GetCurrentDirectory();
            }

            if (string.IsNullOrWhiteSpace(Engine))
            {
                Engine = InferEngineFromDirectory(Path);
            }

            ISiteEngine engine;

            if (engineMap.TryGetValue(Engine, out engine))
            {
                var context = new SiteContext { Folder = Path };
                engine.Initialize();
                engine.Process(context);
            }
            else
            {
                Console.WriteLine("Cannot find engine for input: '{0}'", Engine);
                System.Diagnostics.Debug.WriteLine("Cannot find engine for input: '{0}'", Engine);
            }
        }
Esempio n. 3
0
 private static Hash CreatePageData(SiteContext context)
 {
     return Hash.FromAnonymousObject(new { page = new { title = context.Title } });
 }
Esempio n. 4
0
        private static Hash CreatePageData(SiteContext context, PageContext pageContext)
        {
            var title = string.IsNullOrWhiteSpace(pageContext.Title) ? context.Title : pageContext.Title;

            return Hash.FromAnonymousObject(new { page = new { title }, content = pageContext.Content });
        }
Esempio n. 5
0
 public void Initialize(IFileSystem fileSystem, SiteContext context)
 {
     this.fileSystem = fileSystem;
     this.context = context;
 }