Hello From The Engine
This is the first test from the engine. Markdown file are still added manually. But generating static site and git actions are all done automatically by web application.asdasdasdsad
And basically those are all the code (Configuration is a copy from Pretzel library since it's internal):
var path = Server.MapPath("~/Yard/In");
var destPath = Server.MapPath("~/Yard/Out");
var fileSystem = new FileSystem();
var contextGenerator = new SiteContextGenerator(fileSystem, new LinkHelper(), new BLL.Configuration(fileSystem, path));
var siteContext = contextGenerator.BuildContext(path, destPath, false);
var transforms = new List<ITransform>();
transforms.Add(new LessTransform(fileSystem));
transforms.Add(new VirtualDirectorySupport(fileSystem));
var engine = new LiquidEngine();
engine.FileSystem = fileSystem;
engine.Initialize();
engine.Process(siteContext);
foreach (var t in transforms){
t.Transform(siteContext);
}
engine.CompressSitemap(siteContext, fileSystem);
using (var repo = new Repository(destPath))
{
repo.Stage("*");
var author = new Signature("xxx", "@xxxx", DateTime.Now);
var committer = author;
try
{
var commit = repo.Commit("xxxxxx", author, committer);
}
catch (Exception ex)
{
//do sth later
}
var remote = repo.Network.Remotes["origin"];
var options = new PushOptions();
options.CredentialsProvider = (_url, _user, _cred) =>
new UsernamePasswordCredentials { Username = "xxxxx", Password = "xxxx" };
repo.Network.Push(remote, @"refs/heads/master", options);
}
It's very basic though. But good to know that this works.
-------------Update 06/03/2016-------------------
This is from the page editor now. All up and running.
-------------Update 06/03/2016-------------------
This is from deployed version.